Last updated
Last updated
This tutorial contains information about the ZYNQ SoC and a simple example on how to integrate our custom RTL module to the ZYNQ PS.
This repository contains all of the code required in order to follow this tutorial.
In computer architecture, the system bus is an interconnection that connects the CPU with memory and I/O. The following figure provides an illustration. The system bus consists of control, data, and address lines. Data can be sent both ways from the CPU to memory or I/O, or vice versa with the CPU as the master.
The following figure is an illustration of the FPGA SoC architecture. There is an FPGA that can be connected to the CPU via the system bus.
There are various types of system buses: APB, AHB, AXI, Avalon, etc. On the Zynq SoC, the system bus used is APB, AHB, and AXI. These buses belong to the ARM Advanced Microcontroller Bus Architecture (AMBA). APB and AHB are used on internal PS only, while AXI can be used to connect to PL.
This is a detailed block diagram of the Xilinx Zynq architecture. It consists of the CPU, controller for DRAM and flash memory, input/output, FPGA, and system bus.
The method of CPU access to memory and I/O using addresses is called memory mapping. Each DDR memory location and I/O register has its own address.
The following is the memory map on the Zynq-7000:
The Zynq-7000 still uses a 32-bit address width, so the maximum total address space is 4 GB.
Location from 0x0000_0000 for DDR memory
Location from 0x4000_0000 for AXI slave port 0 in PL
Location from 0x8000_0000 for AXI slave port 1 in PL
Location from 0xE000_0000 for IO peripherals such as UART, USB, Ethernet, etc.
In AXI, the components are known as master and slave. The master controls whether to read or write. The slave can only respond by reading or writing.
The master is usually the CPU, but custom modules that we create in the FPGA can also act as masters. For example, in the case of an FPGA module, it must read or write from or to DDR memory.
In this design example, we are going to integrate the PE module into the ZYNQ system with memory map access. The following figure shows the block diagram of the PE module.
The following code shows the code for the PE module.
The PE module is a simple module. The I/O of the PE module is not a standard protocol. Therefore, we have to make a top module that wraps the PE module with a standard protocol that can be integrated with the ZYNQ system. The following code shows the AXI-Stream wrapper module for the PE.
Now that we have our PE module that can talk with AXI-Stream protocol, the next step is to build the block design. The following figure shows the block design. We use an IP called AXI-Stream FIFO. This IP converts memory map access to the AXI-Stream interface.
This is the configuration for the AXI-Stream FIFO IP.
After the AXI-Stream FIFO is connected to the PS, it gets the address as shown in the following figure. This address will be used in the C program.
The following code shows the C code to access the AXI-Stream FIFO. In this example, we send a packet of data that consists of 8x32-bit of data.
The following figure shows the result of the serial terminal.
In this tutorial, we covered the ZYNQ SoC and a simple example on how to integrate our custom RTL module to the ZYNQ PS.
Zynq 7000 Technical Reference Manual,
The number of addresses is determined by the bit width of the address. If the address bit width is 32, then there are or 4 GB of addresses. If the address bit width is 40, then there are or 1 TB of addresses.