<< Chapter < Page Chapter >> Page >

Now, we explain how to use the FFT routine provided by TI for the C54x. The FFT routine fft.asm located in v:\ece420\54x\dsplib\ computes an in-place, complex FFT. The length of the FFT is defined as a label K_FFT_SIZE and the algorithm assumes that the input starts at data memory location _fft_data . To have your code assemble for an N -point FFT, you will have to include the following label definitions in your assembly code.

N .set 1024 K_FFT_SIZE .set N ; size of FFT K_LOGN .set 10 ; number of stages (log_2(N))

In addition to defining these constants, you will have to include twiddle-factor tables for the FFT. These tables( twiddle1 and twiddle2 ) are available in the shared directory v:\ece420\54x\dsplib\ . Note that the tables are each N points long representing values from 0 to just shy of 180 degrees and must be accessed using a circular pointer . To include these tables at the proper location in memory with the appropriatelabels referenced by the FFT, use the following

.sect ".data" .align 1024 sine .copy "v:\ece420\54x\dsplib\twiddle1" .align 1024 cosine .copy "v:\ece420\54x\dsplib\twiddle2"

The FFT provided requires that the input be in bit-reversed order, with alternating real and imaginarycomponents. Bit-reversed addressing is a convenient way to order input x n into a FFT so that the output X k is in sequential order ( i.e. X 0 , X 1 , …, X N 1 for an N -point FFT). The following table illustrates the bit-reversed order for an eight-point sequence.

Input Order Binary Representation Bit-Reversed Representation Output Order
0 000 000 0
1 001 100 4
2 010 010 2
3 011 110 6
4 100 001 1
5 101 101 5
6 110 011 3
7 111 111 7

The following routine performs the bit-reversed reordering of the input data. The routine assumes that the input isstored in data memory starting at the location labeled _bit_rev_data , which must be aligned to the least power of two greater than the input buffer length, andconsists of alternating real and imaginary parts. Because our input data is going to be purely real in this lab, youwill have to make sure that you set the imaginary parts to zero by zeroing out every other memory location.

1 bit_rev: 2 STM #_bit_rev_data,AR3 ; AR3 -> original input 3 STM #_fft_data,AR7 ; AR7 -> data processing buffer 4 MVMM AR7,AR2 ; AR2 -> bit-reversed data 5 STM #K_FFT_SIZE-1,BRC 6 RPTBD bit_rev_end-1 7 STM #K_FFT_SIZE,AR0 ; AR0 = 1/2 size of circ buffer 8 MVDD *AR3+,*AR2+ 9 MVDD *AR3-,*AR2+ 10 MAR *AR3+0B 11 bit_rev_end: 12 NOP 13 RET

As mentioned, in the above code _bit_rev_data is a label indicating the start of the input data and _fft_data is a label indicating the start of a circular buffer where the bit-reversed data will bewritten. Note that although AR7 is not used by the bit-reversed routine directly, it is used extensively inthe FFT routine to keep track of the start of the FFT data space.

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