Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

To build a FIFO using SRAM

Hi,

I would like to build a DCFIFO using a SRAM chip on DE2-115. Any idea on where i should start?

I know SRAM reads and writes on a different clock cycle as the dataIn and dataOut share the same bidirectional databus, but do you think i can increase the frequency by 2 times (based on spec sheet, max performance of my SRAM is 125MHz), meaning if my ADC data coming in at 60MHz, i am inputting data and outputting data to/from my SRAM on an alternate cycle at 120MHz. is it possible? if yes, what are the things i need to be concerned about?

regards,

Michael

37 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Dave,

    The width of ADC is 14 bits, but i am sending 16 bits across every transfer.

    The SRAM on my DE2-115 has access time of 8ns, so its maximum performance is 125MHz, so i guess it is more than enough to hold 2MB of sample from the ADC at 65 MHz. Am i right on this? I only need a "window" (1024000 ADC samples), not to stream continuous raw data, as some portion of the data will be lost(which is fine).

    I want to see the streaming of "window" of data.

    Regards,

    Michael
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Michael,

    --- Quote Start ---

    My ADC is sampling at 65MHz. i am trying to capture 2MB(1024000 samples) of ADC data and send to through QuickUSB at 30MB/s, and graph it on my laptop using Matlab.

    --- Quote End ---

    What is the bit-width of the ADC?

    --- Quote Start ---

    Do you think NIOS 2 is capable of handling 65MHz data? or the SRAM controller is running at slower speed than 65MHz?

    --- Quote End ---

    The NIOS II never actually touches the ADC data, its just there to coordinate movement of the data.

    The key design parameter is whether you can find a memory target that can maintain a sustained data transfer rate of 65MHz x ADC bit-width.

    You'll need to see whether the SRAM or SDRAM on the DE-115 can handle that data rate.

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    My ADC is sampling at 65MHz. i am trying to capture 2MB(1024000 samples) of ADC data and send to through QuickUSB at 30MB/s, and graph it on my laptop continuously .

    Do you think NIOS 2 is capable of handling 65MHz data? or the SRAM controller is running at slower speed than 65MHz?

    regards,

    Michael
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Michael,

    --- Quote Start ---

    Is there any DMA IP core in Quartus 2 i could use? or do i need DMA if i am writing to a SRAM? what does DMA do? can i just use a controller(with a up counter for address bus, etc..) ?

    --- Quote End ---

    Read the Altera documentation on SOPC Builder (old tool) and Qsys (newer tool), and the Avalon bus specification.

    What you want is an SOPC/Qsys system with an Avalon-ST ADC source, an SGDMA controller, an SRAM controller, and an Avalon-MM master (eg. the JTAG-to-Avalon-MM bridge or a NIOS II processor).

    You will need to design the ADC to Avalon-ST streaming component (its pretty simple though). You can then use the SGDMA controller for Avalon-ST (ADC) to Avalon-MM (SRAM) data movement.

    What are you trying to do with the data? Capture snapshots of data, or continuously stream it somewhere (other than the SRAM)?

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Why dont you make a system with NIOS2, DMA and a SRAM controller to do this? It would be easier

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Dave,

    Is there any DMA IP core in Quartus 2 i could use? or do i need DMA if i am writing to a SRAM? what does DMA do? can i just use a controller(with a up counter for address bus, etc..) ?

    regards,

    Michael
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I would like to build a DCFIFO using a SRAM chip on DE2-115. Any idea on where i should start?

    --- Quote End ---

    You'd be designing a FIFO, not a (dual-clock) DCFIFO.

    --- Quote Start ---

    I know SRAM reads and writes on a different clock cycle as the dataIn and dataOut share the same bidirectional databus, but do you think i can increase the frequency by 2 times (based on spec sheet, max performance of my SRAM is 125MHz), meaning if my ADC data coming in at 60MHz, i am inputting data and outputting data to/from my SRAM on an alternate cycle at 120MHz. is it possible? if yes, what are the things i need to be concerned about?

    --- Quote End ---

    You'd likely want to perform burst writes and reads to the SRAM (its likely a clock or two faster, since there is no need for the SRAM controller FSM to conservatively insert bus turn-around cycles).

    So you'd have your ADC write to a DCFIFO or dual-ported RAM internal to the FPGA at 60MHz, and then once the FIFO was filled above a threshold, start a DMA to the SRAM at its maximum speed. Then when that DMA is done, perform another DMA to read older data back.

    However, what's the point? You're just adding delay. Of course, if you are aligning multiple different data streams, this might be what you want.

    Cheers,

    Dave