Forum Discussion
Altera_Forum
Honored Contributor
16 years agoI get two symmetrical lines in the spectrum. Fine, so far. The frequency values are the expected ones.
second, you need to think of fixed point only(unless your fft is not). Since I'm using burst architecture, I can not chose fixed or floating point representation like with the variable streaming architecture. I assume the output is fixed point by default. Another issue is, that referring to Alteras documentation, it seems to me that Altera does not differ between integer and fixed-point data format. Theortically that is not the same, but if +0,9999999 (fixed-point) or +32767 (integer) is just a question of interpretation, istn't it? The digital number I give the FFT module is the same, in this case 0x7FFF (16bit). third, you should get two symmetrical bins at nearly your amplitude value. I do not get neraly identical bins at neraly my amplitude value. I monitored the direct output signals of the FFT Megacore instance with the SignaltapII and I got 0x0D38 (real) and 0xC7C9 (imag) at the output for the frequency part I'm interested in. The exponent output shows 0x36 for the entire block. So this is not a bug in the wrapper I wrote around the FFT instance. That's why I asked for the input format, too. Maybe the input is not correct. Input example: For a 9Hz sine signal, sampled with 3kHz and an amplitude of 2,3V the maximum input amplitude integer (16bit signed) is 30147 decimal. This should be correct. about scaling: (why you say input is 16 bits, output is 31 ?)if altera says divide output by 2^exp i.e. multiply by 2^-exp
then:
I said the output is 31 bit, because I referred to the FFT user guide, where it is mentioned that you have to extend your output by the maximum number of shifts, that is possible... in my case 15bits. Since I'am using the NiosII processor to process the results I can use the entire 31 bits for a high resolution, if I want. But where is the difference between these: --output unscaled 0x7FFF -- output scaled: shifting e.g. four times left (mult) 0x7FFF0 --> 0x7FFF when taking the upper 16bits I win no new information with this multiplication, do I? for mult:shift magnitude bits towards sign bit inserting leading zeros. Should I scale the magnitude? I think you mean I should scale real and imginary parts. We should not mix the terms here. This is confusing. By the way the spectrum is always mirrored at half the sample rate. The information above fs/2 is redundant and obviously not helpful. Why is this output? I could save half the memory by dropping the data above fs/2. Is this correct?