cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AXI DMA MM2S simulation using the AXI VIP core

Moderator
Moderator
1 0 234

Introduction:

This Blog is intended to illustrate the AXI DMA Simulation in Scatter Gather mode using AXI4 VIP cores and the AXI Stream VIP core. The AXI Master VIP configures the DMA in Scatter Gather mode. Scatter Gather Engine reads the Descriptor pointers from the AXI Slave VIP memory model and starts the data transfer. This simulation example shows the data transfer on the MM2S channel.

The example design is created in the 2020.1 version of Vivado® and targets a VC709 evaluation board. The Tcl script for this design and testbench are available in the attachments to this blog entry.

AXI DMA:

The AXI Direct Memory Access (DMA) IP core provides the direct memory access between the AXI4 Memory mapped and AXI4 Stream Interfaces.

The primary high-speed DMA data movement between the system memory and stream target is through the MM2S (memory mapped to stream) channel and the AXI stream to memory-mapped data movement is through the S2MM (Stream to memory mapped) channel. The MM2S channel and S2MM channels operate independently.

The AXI DMA provides 4 KB address boundary protection and automatic burst mapping, and also provides the ability to queue multiple transfer requests using nearly the full bandwidth capabilities of the AXI4-Stream buses. It has an optional Scatter/Gather Engine.

 

savula_0-1599627676065.png

Figure 1: AXI DMA block diagram

 

Scatter/Gather mode:

This mode provides offloading of DMA management work from the CPU. The Scatter/Gather Engine fetches and updates buffer descriptors from the system memory through the AXI4 Scatter Gather Read/Write Master interface.

 

AXI VIP:

The AXI Verification IP (VIP) core has been developed to support the simulation of customer designed AXI based IP. The AXI VIP core supports three versions of the AXI protocol (AXI3, AXI4, and AXI4-Lite). It can be configured as Master, Slave and pass-through.

 

AXI Master VIP:  

The AXI Master VIP generates AXI commands and the write payload, and sends it to the AXI system. The AXI Master VIP is used to configure the DMA in this simulation.

 

savula_1-1599627676071.png

Figure 2: AXI Master VIP

 

AXI Slave VIP:

The AXI Slave VIP responds to the AXI commands and generates the read payload and write responses. The AXI Slave VIP is used as a memory mapped source in this simulation.

 

savula_2-1599627676074.png

Figure 3: AXI Slave VIP

AXI Stream VIP:

AXI Stream VIP has been developed to support the simulation of customer designed AXI Stream based IPs. It generates AXI4-Stream commands and data payload when configured as Master and generates slave AXI4-Stream response when configured as slave. It also checks protocol compliance of AXI4-Stream transactions.

  

Vivado Block Design:

savula_3-1599627676090.png

Address Mapping:

savula_4-1599627676101.png

Test bench to simulate the project:

We need to initialize the VIP cores before using them and also need to load the descriptor file in memory which will be used for scatter gather mode.  The complete testbench file is attached to this blog entry.

code snippet to Import the VIP packages into test bench:

savula_5-1599627676103.png

Generate the wready and tready of the Slave VIPs.

savula_6-1599627676104.png

AXI Master VIP Write register API:

savula_7-1599627676106.png

AXI Master VIP Read register API:

savula_8-1599627676106.png

Simulation:

Import the attached test bench and mem file to the project and run the simulation.

Once the simulation is done, please check the below status register information in the Tcl console.

savula_9-1599627676108.png

Now open the wave form window and check the DMA configuration register on the AXI DMA S_AXI_LITE interface.

savula_10-1599627676120.png

 Reading Descriptor pointers from memory over the SG read interface port:

savula_11-1599627676129.png

Data Transfer from memory to Stream over the MM2S channel:

savula_12-1599627676144.png