<< Chapter < Page Chapter >> Page >
1 .align 32 % Align to a multiple of 32 2 coef .copy "filter1.asm" % Copy FIR filter coefficients 3 4 .align 32 % Align to a multiple of 32 5 state .space 16*20 % Allocate 20 words of data space

Assemble your code, set PMST to 0xFFE0 , reset the DSP, and run. Ensure that it is has the correct frequency response. After you have verifiedthat this code works properly, proceed to the next step.

Part 2: dual-channel fir filters

First, make a copy of your modified filter.asm file from Part 1 . Work from this copy; do not modify your working filter from the previouspart. You will use that code again later.

Next, modify your code so that in addition to sending the output of your first filter (with a 4 kHz to 8 kHz passband)to output channel 1 and the unfiltered input to output channel 2, it sends the output of your second filter (with a 8 kHz to12 kHz passband) to output channel 3. To do this, you will need to use the .align and .copy directives to load the second set of coefficients into data memory. You will also need to add instructions to initializea pointer to the second set of coefficients and to perform the calculations for the second filter.

Extra credit problem

One extra credit point will be awarded to you and your partner if you can implement the dual-channel systemwithout using the auxiliary registers AR4 and AR5 ? Why is this more difficult? Renaming AR4 and AR5 using the .asg directive does not count!

Using the techniques introduced in DSP Development Environment: Introductory Exercise for TITMS320C54x , generate an appropriate test vector and expected outputs in MATLAB. Then, using the test-vector corefile also introduced in DSP Development Environment: Introductory Exercise for TITMS320C54x , find the system's output given this test vector. In MATLAB, plot the expected and actual outputs ofthe both filters and the difference between the expected and actual outputs. Why is the output from the DSP system notexactly the same as the output from MATLAB?

Part 3: alternative single-channel fir implementation

An alternative method of implementing symmetric FIR filters uses the firs instruction. Modify your code from Part 1 to implement the filter with a 4 kHz to 8 kHz passband using the firs .

Two differences in implementation between your code from Part 1 and the code you will write for this part are that (1) the firs instruction expects coefficients to be located in program memory insteadof data memory, and (2) firs requires the states to be broken up into two separate circular buffers. Refer tothe firs instruction on page 4-59 in the Mnemonic Instruction Set manual, as well as a description and example of its use on pages 4-5 through 4-8 of the Applications Guide for more information ( Volumes 2 and 4 respectively of the TMS320C54x DSP Reference Set ).

AR0 needs to be set to -1 for this code to work properly. Why?

COEFF is a label to the coefficients now expected to be in programmemory. Refer to the firs description for more information).

1 mvdd *AR2,*AR3+0% ; write x(-N/2) over x(-N) 2 sth A,*AR2 ; write x(0) over x(-N/2) 3 add *AR2+0%,*AR3+0%,A ; add x(0) and x(-(N-1)) 4 ; (prepare for first multiply) 5 6 rptz B,#(FIR_len/2-1) 7 firs *AR2+0%,*AR3+0%,COEFF 8 mar ??????? ; Fill in these two instructions 9 mar ??????? ; They modify AR2 and AR3. 10 11 ; note that the result is now in the 12 ; B accumulator

Because states and coefficients are now treated differently than in your previous FIR implementation, you will need tomodify the pointer initializations to

1 stm #(FIR_len/2),BK ; initialize circular buffer length 2 stm #firstate_,AR2 ; initialize location containing first 3 ; half of states 4 5 stm #-1,AR0 ; Initialize AR0 to -1 6 7 stm #firstate2_,AR3 ; initialize location containing last half

Use the test-vector core file to find the output of this system given the same test vector you used to test thetwo-filter system. Compare the output of this code against the output of the same filter implemented using the mac instruction. Are the results the same? Why or why not? Ensure that the filtered output is sent to outputchannel 1, and that the unmodified output is still sent to output channel 2.

You will lose credit if the unmodified output is not present or if the channels arereversed!

Quiz information

The quiz for Lab 1 is broken down as follows:

  • 1 point: Prelab (must be ready to show the TA the week before the quiz)
  • 4 points: Working code: you must demonstrate that your code works using input from function generator and that itworks using input from appropriate test vectors. Have an .asm file ready to demonstrate each. Of the 4 points, you get 0.5 points for asingle 20-tap filter, 2 points for the two-filter system, and 1.5 points for the system using the firs opcode.
  • 5 points: Oral quiz score.
  • 1 extra credit point: As described above .

The oral quiz may cover signal processing material relating to FIR filters, including, but not limited to, the delay throughFIR filters, generalized linear phase, and the differences between ideal FIR filters and realizable FIR filters. You mayalso be asked questions about digital sampling theory, including, but not limited to, the Nyquist sampling theoremand the relationship between the analog frequency spectrum and the digital frequency spectrum of a continuous-time signalthat has been sampled.

The oral quiz will cover the code that you have written during the lab. You are expected tounderstand, in detail, all of the code in the files you have worked on, even if your partner or a TA wrote it. (You arenot expected to understand the core file in detail). The TA will ask you to explain various lines of code as part of thequiz. The TAs may also ask questions about 2's complement fractional arithmetic, circular buffers, alignment, and themechanics of either of the two FIR filter implementations. You could be ready to trace through any of the code on paperand explain what each line of code does.

Use the TI documentation, specifically the Mnemonic Instruction Set manual. Hard-copies of this manual can also be found in the lab. Also, feel free to ask the TAs tohelp explain the code that you have been given.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Ece 320 - spring 2003. OpenStax CNX. Jan 22, 2004 Download for free at http://cnx.org/content/col10096/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ece 320 - spring 2003' conversation and receive update notifications?

Ask