FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6343 Discussions

FFT IP Core - Input and output number format?

JWall40
Beginner
1,180 Views

I am unsure what data format I should use for the FFT IP core input and what data format it will output

 

I can only find a few references to this topic in the user guide:

 

“Imaginary input data, which represents a signed number of data precision bits.” (in reference to sink_imag)

 

“Real input data, which represents a signed number of data precision bits.” (in reference to sink_real)

 

“The fixed transform FFT accepts a two's complement format complex data vector of length N inputs, where N is the desired transform length in natural order.”

 

I am assuming the input and output should always be in two’s compliment format then?

 

I have designed a system which takes the output of an on-chip ADC (MAX10) and performs an FFT on the data.

 

I am using a 1KHz test waveform and approx 4.5V.

I sample the output of the ADC every 598th tick of a 50MHz clock (83.6KHz sample rate)

 

I convert the 12-bit ADC data to 14-bit twos compliment by appending “00” to the front, as the signal is always positive anyway due to a DC offset.

 

This is then fed into the FFT core’s sink_real, whilst sink_imag is set to 0.

 

The FFT appears to be performing correctly with no errors, but my output looks incorrect:

sink_real format: signed line chart

source_real/imag format: unsigned line chart

fft1.PNG

The output is always almost either “11111111111111” or “00000000000000”. It is also different every time

fft2.PNG

setting the source_real/imag format to signed line chart looks like this

signed.PNG

I’ve also attached a project archive.

Any help is greatly appreciated

Thanks for reading.

0 Kudos
9 Replies
CheePin_C_Intel
Employee
1,115 Views

Hi,

 

As I understand it, you have some inquiries regarding to the data format for the FFT. For your information, by default, the data format configuration in the FFT = Fixed Point. With Fixed Point, the FFT will treat the input and output data as normal binary data without sign. Note that after the FFT, there will be bit grow. So, you will ensure you have sufficient output width.

 

Please let me know if there is any concern. Thank you.

 

Best regards,

Chee Pin

0 Kudos
JWall40
Beginner
1,115 Views

So using fixed point number format means that the FFT cannot deal with negative numbers and will treat all values as unsigned fixed point with no scale factor. So just whole, positive numbers?

 

So to see a correct display of my output values in signal tap, I should set the bus display format to unsigned decimal?

 

Many thanks

Jack

 

0 Kudos
CheePin_C_Intel
Employee
1,115 Views
Hi Jack, Yes, you are right. When you are using fixed point number format, the FFT will treat the number as if positive binary number. You can use unsigned decimal for bus display in signaltap to view. Alternatively, you can also use single floating point if you would like to the FFT to process decimal and signed/unsigned number. Please let me know if there is any concern. Thank you. Best regards, Chee Pin
0 Kudos
JWall40
Beginner
1,115 Views

Hi Chee

 

In that case, do you have any clue why my FFT might be outputting such strange values?

 

I've configure the FFT for fixed point representation, have given lots of extra bits to the output for bit grow (12 bits in, 22 bits out) and have no error flags with all ready/valid outputs working as expected.

stfftconfig.PNG

 

But despite a reasonably clean sine input signal, my FFT outputs either near maximum or near minimum out put value seemingly at random (data in and out of the FFT displayed as unsigned line chart).stfull.PNG

stzoom.PNG

The output of the FFT always looks different every time, but always just contains a seemingly random array of near min and near max values.

 

The input is a 1Khz sine wave sampled at approximately 83KHz

 

Any suggestions are very much appreciated.

 

Many thanks

Jack

0 Kudos
CheePin_C_Intel
Employee
1,115 Views

Hi Jack,

 

Thanks for your update. By merely looking at the FFT output, it is rather difficult for me to tell if they are expected without a reference for comparison. Just to check with you on the following:

 

  1. What is your expected output from the FFT?
  2. Just wonder if you have had a chance to run a Modelsim simulation for comparison?
  3. One thing that you can try is to connect the output of the FFT to an iFFT to see if you can recover back similar shape of input waveform to FFT.

 

Please let me know if there is any concern. Thank you.

 

 

0 Kudos
JWall40
Beginner
1,115 Views

Hi Chee,

 

  1. Given that my input is a sine wave of 1KHz, with a DC offset, sampled at approximately 83KHz, I would expect the real output of the FFT to look like this:

fftplot.PNG

2. I have tried to run a modelsim simulation but I am yet to successful simulate the FFT IP Core, I get errors when loading the simulation and the FFT outputs never even change state

3. This would be very interesting but my data out of the ADC is fixed point and ifft only supports floating point data. I cannot seem to find a way of using my fixed point ADC data in a floating point FFT system?

 

Kind regards

Jack

0 Kudos
CheePin_C_Intel
Employee
1,115 Views

Hi Jack,

 

Thanks for your update. Sorry as for the delay. I was out for the last few days due to Public Holidays.

 

Regarding your latest inquiry on iFFT, please see my response as following:

 

3. This would be very interesting but my data out of the ADC is fixed point and ifft only supports floating point data. I cannot seem to find a way of using my fixed point ADC data in a floating point FFT system?

[CP] For iFFT, it also support Fixed Point. Mind further elaborate on the floating point data only support?

 

For your information, not sure if you have come across the following simple example design which demonstrate a C10GX Cosine -> FFT -> iFFT -> Cosine data for your reference:

 

https://fpgacloud.intel.com/devstore/platform/17.1.0/Pro/cyclone-10-gx-fft-to-ifft-with-natural-input-and-output-order-using-cosine-data-example-design-171/

 

You can try to see if it is helpful.

 

Thank you.

0 Kudos
CheePin_C_Intel
Employee
1,110 Views

Hi Jack,


Just to follow up with you on this. Thank you.


0 Kudos
CheePin_C_Intel
Employee
1,084 Views

Hi,


As I understand it, it has been some time since I last heard from you. This thread will be transitioned to community support. If you have a new question, feel free to open a new thread to get the support from Intel experts. Otherwise, the community users will continue to help you on this thread. Thank you.


0 Kudos
Reply