Forum Discussion

JWall40's avatar
JWall40
Icon for New Contributor rankNew Contributor
5 years ago

FFT IP Core - Input and output number format?

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

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

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

I’ve also attached a project archive.

Any help is greatly appreciated

Thanks for reading.

9 Replies

  • CheepinC_altera's avatar
    CheepinC_altera
    Icon for Regular Contributor rankRegular Contributor

    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

    • JWall40's avatar
      JWall40
      Icon for New Contributor rankNew Contributor

      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

      • CheepinC_altera's avatar
        CheepinC_altera
        Icon for Regular Contributor rankRegular Contributor
        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
  • CheepinC_altera's avatar
    CheepinC_altera
    Icon for Regular Contributor rankRegular Contributor

    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.

    • JWall40's avatar
      JWall40
      Icon for New Contributor rankNew Contributor

      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:

      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

  • CheepinC_altera's avatar
    CheepinC_altera
    Icon for Regular Contributor rankRegular Contributor

    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.

  • CheepinC_altera's avatar
    CheepinC_altera
    Icon for Regular Contributor rankRegular Contributor

    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.