Forum Discussion

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

Avalon Streaming simple example

Hi,

does anybody have a simple example of avalon streaming implementation? I have a system with huge amont of serial data and I want to use avalon streaming interface. simple example will give me an idea of starting point.

thanks:)

14 Replies

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

    I think you want to use a DMA that accepts streaming data and writes it to memory which can then be sent later to flash or over Ethernet. There is a scatter-gather DMA that comes installed with the IP suite that gets used for various things like feeding streaming video to the screen or moving Ethernet packets back and forth in various designs that are installed with the Nios II EDS or on the Altera Nios II design examples page: http://www.altera.com/support/examples/nios2/exm-nios2.html

    Here is an alternative SGDMA that you might find suites your needs better called the modular SGDMA: http://www.altera.com/support/examples/nios2/exm-modular-scatter-gather-dma.html

    Here is an example of how I'm using it to implement dirt simple frame buffering to a streaming video pipeline: http://www.nioswiki.com/exampledesigns/modular_sgdma_video_frame_buffer

    Streaming is a really simple standard to use especially if you have no 'ready latency' Most of the time when I use streaming I use only three signals:

    data (payload data)

    ready (tells the data source that the sink is ready for data)

    valid (tells the data sink that the source is sending valid data)

    Data flows from the source to the sink in only one direction. Assuming that there is no ready latency then the handshaking is literally 'valid == 1' and 'ready == 1' --> move data. In other words the source says "here's some data" and the sink says "I'm ready for some data", when that case occurs the data moves from the source to the sink and the next 1+ cycles this all starts again. Ready latency makes things a little more complicated and it's intended to factor in latency into the handshake. You can read more about it here: http://www.altera.com/literature/manual/mnl_avalon_spec.pdf

    Since you are working with ADC you will probably use FIFOs to provide buffering so if the FIFO is configured for lookahead mode then you shouldn't have any ready latency to deal with.

    *edit: I forgot about these too, I think DMAs would be better for you but just in case: http://www.altera.com/support/examples/nios2/exm-avalon-mm.html
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    Many thanks for your reply. I am currently developing an autonomous data acquisition vehicle for oil and gas pipelines. We have nearly 300 analog sensors which ADC modules control them. Every second I should collect nearly 1MB of data which all are in packets and serially is being transferred to the FPGA. I collect this data and write them to CF in FAT32 format or send it through Ethernet. I implement some templates which write data into DDR RAM directly. This will avid processor to access ram for a while. There is an option which I can either implement another Ram or processor. However, power consumption on this system is very critical and I don’t want to implement extra devices. As data from ADC to RAM are serial and are in packets so I think I can use the Avalon streaming for achieving higher performance. So you are right. I want to read data serially from ADCs and buffer it somewhere. I need more reliable algorithms for that. I was wondering if you give me something to start with as I have never used Avalon streaming before. For Ethernet I am not using the Avalon streaming either as I am using my own IP. If I am able to use Avalon streaming so I can increase the TCP/IP stack performance.

    Thanks,

    Aidin.

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

    Do you need to buffer the data in memory? I'm not sure what a good example would be since I'm not sure what you are trying to implement. The simplest example of streaming would be to hook up the output of a FIFO to the input of another FIFO if you just want to see how the streaming handshaking works.