- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm working with Altera streaming 256 point FFT core. I've discovered the errata on the core (V9) rearding mismatch between the Matlab sims and HDL sims and the limit on the input range.
Looking at the FFT User Guide, it tells me that the sink_valid signal must be asserted for the source valid to be asserted (and a valid data output). It also says that the sink_sop and sink_eop must be driven while extracting the final frames of data even if no further valid input data is being supplied. If I run the Verilog testbench that is generated by the core generator, I see that the above conditions are not met yet the core puts out correct data. Anybody else run into this? How are others driving the inputs while pulling out the delayed FFT results? Thanks for any input on this.Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I got the same problem: some mismatch among matlab output and modelsim quartus (even after scaling!!). did you get any answer???
thx in advance. G.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assuming you're using the Matlab core model that Quartus generates for your Matlab runs, you should see exact matches between Verilog sims and Matlab sims. If you're using the software FFT in Matlab, you will see differences, especially for low values of input into the Altera core...accuracy improves as input level goes up but you will never see exact matches between the core and a software fft.
If your question is regarding how to pull out the last two lines of the FFT values, you need a state machine to drive sink_valid, sink_eop and sink_sop. You need to drop sink_valid at the last sink_eop that corresponds to your last valid input data. You then need to drive sink_sop/sink_eop pairs for the last two lines out of the core. If you provide more detail regarding the problem you're seeing, perhaps I (or someone else here) can provide you with better answers.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mmyers, first of all thx for the support! Let me explain the context: I implemented a FFT block using megawizard tool of Quartus, with the following parameters:
■ Transform length: 2048 ■ I/O data flow: burst architecture ■ FFT engine architecture: quad output ■ Number of parallel engines: 2 Input of FFT module is a sine at 50 Hz, amplitude = 5 and fixed point data. I stored imaginary, real and exponent data on 3 different files. After that, using the same input file, I calculated FFT using Matlab. I multiplied (scaling operation) Matlab output data by 2^exponent ( -5 in my case). I realized an excel file where I compare results from Modelsim and Matlab. Many of all ( maybe 97%) are similar: the difference among Modelsim and Matlab data, is at most equal to +/- 2 . Anyway I saw that for some of them there is no correspondance: difference amoung these particular case is equal to +123,-36, -118. Looking at "Release Notes and Errata" of Megacore IP library, on paragraph "Simulation Errors—MATLAB Model Mismatch", I saw that there could be some problem. ( the link to document is) http://www.altera.com/literature/rn/rn_ip.pdf Am i wrong??? (http://www.alteraforum.com/forum/member.php?u=4052)- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I haven't used the Burst FFT architecture (I've been using streaming) but they should all behave about the same.
You say you have a sine input at 50Hz. The amplitude is 5. First of all, what is the bitwidth of your fft core input? If 8 bits, you should probably use a test signal that has peaks near 127 and -127. The core expects signed data (2's comp). Be careful to not let the input hit -128. While that is a valid value for 8bit 2's comp data, the core has an error when handling that extreme. This is in the errata. The core's accuracy gets better when the input uses all or near all of its dynamic range. When you generate your input samples, are your sample points at a frequency at least twice the Nyquist? (100 Hz for your case) The scaling is 2^(-exp). You probably did this but it's not what you typed. So, if exponent is -5, you would scale by 2^(5). For your Matlab sim, are you using the Matlab core model? If you use Matlab's real fft (FFTW from MIT), that is floating point software and those results will come close to the core's values but will differ significantly for low values of input into the core. When I was working on the accuracy issues, I ran three sims. A pure Matlab sim using Matlab's software fft, a Matlab sim using the fft core model that the MegaWizard generates and a Verilog sim using the core's behavioral model (core.vo). Let me know how you're doing.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sink_ready and sink sop must be asserted at the same time,the differences is the sink_ready is asserted for N clocks,N is fftpoints, and sink_sop keep only one clock,and sink_eop is asserted at the (N-1)th clock
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- FOR mmeyers:
"you say you have a sine input at 50hz. the amplitude is 5. first of all, what is the bitwidth of your fft core input? if 8 bits, you should probably use a test signal that has peaks near 127 and -127. the core expects signed data (2's comp). be careful to not let the input hit -128. while that is a valid value for 8bit 2's comp data, the core has an error when handling that extreme. this is in the errata." The bitwidth is 16. Input data are signed fixed point (12, -34, -32767, etc..) "when you generate your input samples, are your sample points at a frequency at least twice the nyquist? (100 hz for your case)" Sample frequency is 2 KHz, which is >> than 100 Hz. "the scaling is 2^(-exp). you probably did this but it's not what you typed. so, if exponent is -5, you would scale by 2^(5)."
If you multiply the output by scaling factor you use 2^(-exp); If you divide the output by scaling factor you use 2^(exp);In my case exp = -5. "for your matlab sim, are you using the matlab core model? if you use matlab's real fft (fftw from mit), that is floating point software and those results will come close to the core's values but will differ significantly for low values of input into the core.
when i was working on the accuracy issues, i ran three sims. a pure matlab sim using matlab's software fft, a matlab sim using the fft core model that the megawizard generates and a verilog sim using the core's behavioral model (core.vo)."
I think the model I'm using on Matlab enviromental is the right one: I repeat that outputs from Modelsim and Matlab are different only for ~20 values; others 2048-(~20) values are almost perfectly the same! Anyway on matlab i type: y= fft(x_sin,2048) I had exactly the same results of Modelsim when i tried to use Matlab model generated by Quartus megawizard. Did you check the document i linked?? Thx. - FOR Planet1997 "sink_ready and sink sop must be asserted at the same time,the differences is the sink_ready is asserted for n clocks,n is fftpoints, and sink_sop keep only one clock,and sink_eop is asserted at the (n-1)th clock"
I did exactly what you said. Thx. Gianfranco.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I'm using the FFT IP, ver.9.0 (Stratix III, 128 points, 16 bit of data and twiddle precisions, single output, 1 engine, burst I/O, global clock enable). I don't understand how to use the signal clk_ena or it doesn't work correctly. In detail, the following cases: 1. clk_ena = always 1: it correctly produce spectrums after about 800 hundred cycles; 2. clk_ena = always 0: it correctly doesn't produce spectrums; 3. clk_ena used to slow down the process (in my example clk=100mhz, clk_ena=50mhz): the behavior looks like case n.2. Is this correct? How did you solve this problem? Thanks a lot! ps: the behaviour is the same also with FFT ver 8.0.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For FraGuidi
I don't use CLKEN as I can guarantee a constant stream of input data so I don't have any knowledge about how to deal with it. Sorry. For Gianfranco Don't know if you're still seeing the mismatches on your outputs. Everything you're describing sounds right to me. Here's how I call the fft model in Matlab. [outputrow, exp_out] = fft128_8b_model(inputrow,128,0); I'm running image frames thru so I need to save results in arrays so I save the fft data in "outputrow" and the exponent out in "exp_out". I don't see that you tell the model whether it's a forward or inverse transform. I feed it a zero which is a forward transform. (It probably defaults to zero in the model.) Nothing is jumping out at me wrt what you are seeing. Anybody else have any input for gianfranco?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I went deeper in FFT IP tests and "global clock enable" on. In the attached screenshot a typical results is reported. It seems that the fft module works well also by the use of clk_ena during the spectral computing phase and the data out phase, while, if I use clk_ena during the data in phase, no output is provided. Does this make sense for you? Do you know if there is an up-date document or an errata corrige that can explain this better? Thank a lot.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
for Mmeyers:
Thanks for the answer. I'm trying to validate FFT generated by Quartus II not using Matlab model generated by it. I'm trying to use only fft function implemented by Matlab: y= fft(x_sin,2048)
That's because I think there is a bug in the FFT megafunction. Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I am using FFT megafunction too for my final year project. The problem i had face is i can't get the output of last FFT block since it's size(eg 7 points) is not same with the previous FFT blocks size (eg 8 points). I had follow the instruction Dynamically changing the FFT Size in the manual but still can't get the output of the last FFT block. Anyone face this problem before or any idea to solve it? Here my waveform attached. I had refer to the Figure 3-8 (Dynamically Changing the FFT Size) of FFT megafunction.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page