Scatter-Gather DMA Design Example
The Scatter-Gather Direct Memory Access (SGDMA) design example illustrates how you can perform data transfers without processor overhead becoming a limiting factor. The SGDMA intellectual property (IP) is available for free in SOPC Builder and allows you to transfer between Avalon® memory-mapped and streaming interfaces. The main difference between the SGDMA and a regular DMA is that multiple transfers are handled by the hardware itself instead of by intervention from a host such as the Nios® II embedded processor. This typically reduces the downtime between transfers to a single clock cycle. Applications that typically benefit from using a SGDMA are networking, audio, and video processing.
The design example performs memory transfers between an external SSRAM memory component and on-chip FIFOs components. Nios II software is provided that demonstrates how to configure the SGDMA and create the necessary descriptor information used by the SGDMA. The design also demonstrates how to use the on-chip FIFO component to perform efficient clock domain crossing.
Download sg-dma.zip (418 KB).
Design Specifications
The design contains the following components:
- Nios II processor
- Two SGDMAs
- Two on-chip FIFOs
- Tri-state bridge
- SSRAM
- JTAG UART
- Phase-locked loop (PLL)
- System ID
This design targets the Nios Cyclone® II and Stratix® II restriction of hazardous substances (RoHS) development boards. The Cyclone II design uses an 83-MHz control plane and a 200-MHz data plane. The Stratix II design uses a 100-MHz control plane and a 300-MHz data plane.
Figure 1. Scatter-Gather DMA Design Example

View Full Size
Notes:
- S: Avalon memory-mapped slave port
- M: Avalon memory-mapped Master Port
- SRC: Avalon streaming source port
- SNK: Avalon streaming sink port
Design Functionality
The Nios II processor coordinates the design by performing the following steps in the order shown:
- Allocates memory to store the descriptors (transmit and receive pairs)
- Allocates memory to store the data that will be transferred (transmit and receive buffers)
- Creates incrementing test data in the transmit buffers and populates the descriptor pairs
- Writes the first descriptor pair to the SGDMAs, thereby starting the transfer
- Waits until both SGDMAs complete the transfer of all data buffers
- Validates that the received data matches what was transferred
All the descriptors and data buffers are stored in external SSRAM. Each data buffer is transmitted through the system interconnect fabric via Avalon memory-mapped and Avalon streaming ports. The SGDMA fetches the data from SSRAM (Avalon memory-mapped port) and transmits the data to the on-chip FIFO component (Avalon streaming port). Avalon streaming ports provide flow control between source and sink pairs, allowing two on-chip FIFO components to transmit data between each other. The second SGDMA performs a similar transfer by reading the contents out of the on-chip FIFO component and sending the data to SSRAM to be later validated.
Design Adaptation
You can use this design example as a reference for any number of applications that require data and control plane segmentation. Instead of placing on-chip FIFO components in the data plane, you can insert any high-speed IP, for example, a video processing block. You can also use the SGDMAs to read and write to many separate interfaces, which is common in channel processing.
Related Links
Feedback
Did this information help you?
If not, please log onto mySupport to file a technical request or enhancement.
These Website Design Examples may be used within Altera Corporation devices only and remain the property of Altera. They are being provided on an "as-is" basis and as an accommodation, and therefore all warranties, representations, or guarantees of any kind (whether express, implied or statutory) including, without limitation, warranties of merchantability, non-infringement, or fitness for a particular purpose, are specifically disclaimed. Altera expressly does not recommend, suggest, or require that these examples be used in combination with any other product not provided by Altera.
|