Before I continued with my design, I wanted to make sure I understood how to use the FFT(IFFT) megacore block properly.
To test, I wrote a .m file where I performed the IFFT using the Matlab's built in ifft() function and Altera's IFFT megacore block using the .m file interface created when the block is generated.
I got the result from Matlab's ifft function and Altera's IFFT block to come out to be exactly the same (note about scaling later).
Now, I implemented the FFT block inside of DSP Builder and created a dummy setup with the same inputs as the data in the .m file. I compared the output of the Altera FFT block (from dsp builder) to the output of the Altera FFT (from matlab .m file) and they are totally different.
Here's a screenshot giving you an idea of what I'm talking about:
http://img353.imageshack.us/img353/5056/ifftcomparisonmh7.th.png (
http://img353.imageshack.us/img353/5056/ifftcomparisonmh7.png)
I'm attaching both files.
-------------------
Now about the scaling issue (this
might be related to my problem).
I have read many different things about "scaling" related the ifft block.
You have to scale your FFT/IFFT block output by
2^(-exponent)
I have also read, that if your input is very small, then it's recommended to scale it on the input side and the same on the output side (aside from the 2^(-exponent)).
In my .m file, to match the Matlab ifft block output with the Altera IFFT, I tried many scaling factor and somehow came upon this magical scaling property which works for all cases (different N points, different data or twiddle precision):
Scale input by:2^(Nbits)
Scale output by:2^(-exponent) / (2^(Nbits+Nbits-1))
WHEREo Nbits = log2(N) + 1
o N = transform length (points)
The thing is, I don't know why it works, but it does (at least in the .m file). For different N (transform length/points) and different data/twiddle precision, it just works!
Maybe I'm completely off here. I need some more help!
Thanks