<< Chapter < Page Chapter >> Page >

The length of the FFT is defined as a label K_FFT_SIZE and the bit-reversing algorithm assumes that theinput starts at data memory location _fft_data. To have your code assemble for anN-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

The FFT provided by TI requires that the input be in normal order, with alternating real and imaginary components. The output will be in bit-reversed order, so bit-reversing needs to be done after the FFT. Bit-reversed addressing is a convenient way toorder input/output x n into a FFT so that the output/input 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 FFT output data. The routine assumes that the output 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.

_bit_rev ENTER_ASM MOV #_fft_data, AR3 ;AR3 -> original input MOV #_bit_rev_data, AR7 ;AR7 -> data processing buffer MOV AR7, AR2 ;AR2 -> bit-reversed data MOV #K_FFT_SIZE-1, BRC0 MOV #K_FFT_SIZE, T0 ; T0 = 1/2 size of circ buffer RPTB bit_rev_end-1 MOV dbl(*AR3), AC0 MOV AC0, dbl(*AR2+) AMAR *(AR3+T0B) bit_rev_end: LEAVE_ASM RET

As mentioned, in the above code _fft_data is a label indicating the start of the input data and _bit_rev_data is a label indicating the start of a circular buffer where the bit-reversed data will bewritten.

In general, to have a pointer index memory in bit-reversed order, the T0 register needs to be set to one-half the length of the circular buffer; a statement suchas ARx+T0B is used to move the ARx pointer to the next location. For more information regarding the bit-reversed addressing mode, refer to Chapter 6 in the DSP Programmer's Reference Guide . Is it possible to bit-reverse a buffer in place?

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 main.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 main.c !

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 55x). OpenStax CNX. Jan 18, 2010 Download for free at http://cnx.org/content/col10397/1.10
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 55x)' conversation and receive update notifications?

Ask