Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

FFT Megacore V11.1 problem

Hi all,

I am using Terasic's DE2-70 dev board and I am building a windowed FFT processor (8192 points each, 16 non-overlapping windows) using Quartus II and Modelsim-Altera. The megacore uses buffered burst architecture with block floating points. 18-bit data and 18-bit twiddle. Now I have read previous threads about the sink_sop and sink_eop threads, and i developed a state machine to provide these signals properly. Additionally, the source_valid signal fluctuates when the FFT processor is providing the outputs (once every 4 outputs in simulation). I assume that is normal and I just ignore the clock cycles where the source_valid is de-asserted.

I tested the hardware implementation with a simple hard-wired 64 point (that cycles 128 times to fill each 8192 window). the modelsim simulations, matlab fft, quartus-generated matlab testbench, and the hardware output perform very well, with little or no differences (the data did not span the whole dynamic range but just 8 out of 18 bits. Only real data was fed into the processor with the imaginary input tied permanently to ground).

With this testing sequence, everything was fine. Now I put in real data from a 14-bit ADC (tested with a single tone sine wave). i took the raw data output of the ADC (which was stored in memory) (the exact same sequence of data that passes through the FFT processor). Matlab's FFT and the quartus generated test bench give perfect answers, but the hardware results are incorrect now ! I am attaching the FFT results as an image (just for one window, the others are almost identical). Any help as to what this problem is would be quite appreciated.

Side note: I know that precision is sacrificed in the block floating point by the fft processor in favor of high-amplitude signals. And since a zero average sine wave will have a DC offset of (0x2000) in a 14-bit ADC output, I subtracted this value out of each data point so that the input data to the FFT is centered about 0. Still, the output is not close to satisfactory. only when my input amplitude is really small (1mVpp), such that only a very small dynamic range of the input (32 LSB (5 bits) or less), does the FFT work.

Additional info: signal was 300kHz sine, which at a 25MHz sampling rate, and 8192-point FFT, would correspond to FFT output sample number 99 as in the figure (delta_f = 25Mhz/8192 = 3.05kHz approx). Figure only shows output FFT in the range of interest, but the actual data is 8192 points wide as expected. the blue spectrum is what both quartus's matlab test bench and what matlab FFT predict (identical), but the red is what I get from the hardware (same hardware that worked perfectly for very small dynamic range input).

15 Replies