<< Chapter < Page Chapter >> Page >

In general, to have a pointer index memory in bit-reversed order, the AR0 register needs to be set to one-half the length of the circular buffer; a statement suchas ARx+0B is used to move the ARx pointer to the next location. For more information regarding the bit-reversed addressing mode, refer to page 5-18 in the TI-54x CPU and Peripherals manual . Is it possible to bit-reverse a buffer in place? For a diagram of theordering of the data expected by the FFT routine, see Figure 4-10 in the TI-54x Applications Guide . Note that the FFT code uses all the pointers available and does not restore the pointers totheir original values.

C fft routine

A bit-reversing and FFT routine have also been provided in lab4fft.c , listed in Appendix C . Again, make sure you understand how the bit reversal is takingplace. In lab4main.c , the line defining C_FFT must not be commented for use of the C FFT routine. The sine tables (twiddle factors) are located in sinetables.h . This fft requires its inputs in two buffers, the real buffer real and the imaginary buffer imag , and the output is placed in the same buffers.The length of the FFT, N , and logN are defined in lab4.h , which is also listed in Appendix C . When experimenting with the C FFT make sure you modify these length values instead of the onesin the assembly code and lab4main.c !

Creating the window

As mentioned, you will be using the FFT to compute the spectrum of a windowed input. For your implementation youwill need to create a 1024-point Hamming window. First, create a Hamming window in matlab using the function hamming . For the assembly FFT, use save_coef to save the window to a file that can then be included in your code with the .copy directive. For the C FFT, use the matlab function write_intvector_headerfile with name set to 'window' and elemperline set to 8 to create the header file that is included in lab4main.c .

Displaying the spectrum

Once the DFT has been computed, you must calculate the squared magnitude of the spectrum for display.

X k 2 X k 2 X k 2
You may find the assembly instructions squr and squra useful in implementing .

Because the squared magnitude is always nonnegative, you can replace one of the magnitude values with a -1.0 as a triggerpulse for display on the oscilloscope. This is easily performed by replacing the DC term ( k 0 ) with a -1.0 when copying the magnitude values to the output buffer. Thetrigger pulse is necessary for the oscilloscope to lock to a specific point in the spectrum and keep the spectrum fixed on the scope.

Intrinsics

If you are planning on writing some of the code in C, then you may be forced to use intrinsics. Intrinsic instructionsprovide a way to use assembly instructions directly in C. An example of an intrinsic instruction is bit_rev_data[0]=_smpyr(bit_rev_data[0],window[0]) which performs the assembly signed multiply round instruction. You may also find the _lsmpy instruction useful. For more information on intrinsics, see page 6-22 of the TI-C54x Optimizing C/C++ Compiler User's Guide .

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Digital signal processing laboratory (ece 420). OpenStax CNX. Sep 27, 2006 Download for free at http://cnx.org/content/col10236/1.14
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing laboratory (ece 420)' conversation and receive update notifications?

Ask