By Adam Taylor

In last week’s blog, we uploaded a new overlay and used it to run a Sobel filter on the PYNQ-Z1’s HDMI I/O stream. What I want to do, however, is to create my own overlay. We will do this over the next few blogs. (If you’re just joining this discussion, the PYNQ project combines the capability of the Xilinx Zynq SoC and the productivity of the Python programming language. You can read an overview of it in this earlier post: “Adam Taylor's MicroZed Chronicles Part 155: Introducing the PYNQ (Python + Zynq) Dev Board.”)

The recommended way to create a PYNQ hardware overlay is to use the existing base overlay Vivado design as a starting point, so we need to recreate that first. The reason behind the recommendation to base new overlays on the initial overlay is because the supplied overlay predefines all the configurations needed for the Zynq SoC’s PS and defines the PS-PL interface.

The first thing we need to do is download the design files from the PYNQ GitHub page. We can easily download or clone the GitHub repository from the repository’s top level.

Once downloaded, we need to extract the files into a working directory. To recreate the project in Vivado, the first thing we need is the correct version of Vivado. The current version of the PYNQ base overlay was created using the 2016.1 release of the Vivado Design Suite, so we need to ensure that we have this version installed. If we do not have it, we need to download it from the Xilinx webpage.

With the correct Vivado version installed navigate to the following directory:

<working directory> \PYNQ-master\PYNQ-master\Pynq-Z1\vivado\base

Within this directory, you will see a make file that you can run from a command shell. This make file builds the Vivado project for us and allows us to explore the base overlay design for the PYNQ board.

Before we can do this however we need to ensure that we have the correct settings in the make file. The command we need to use varies if we are using a PC running Microsoft Windows or Linux.

Open the make file with a text editing program. If you are using Linux then the command should be:

vivado -mode batch -source ${PYNQ_ROOT}/Pynq-Z1/bitstream/base.tcl

However, if you are using Microsoft Windows, then we’ll need the following command:

cmd /c "vivado -mode batch -source ${PYNQ_ROOT}/Pynq-Z1/bitstream/base.tcl"

With the correct command in the make file, open a command window in the working directory and type:

make -f makefile

This will rebuild the Vivado project so that we can begin to explore the base overlay design and then start adding in our own functionality. If you have trouble running the make file, you may want to check out Xilinx user guide UG1198, which explains how to configure Make on your system.

Once the script has been completed you will see the base overlay as shown below. It may initially look complex but it’s not so complicated once you analyze it.

The first thing to explore is the interconnectivity implemented using the AXI interfaces. At the simplest level, the Zynq SoC’s High-Performance AXI interconnects are used for interfaces that require DMA to transfer data to or from DDR memory. For the PYNQ overlay, these interconnects are used for the trace buffers for the Arduino and PMOD ports and the video stream.

The Master General-Purpose AXI interfaces are used to control and configure the remaining blocks within the design. Most interestingly, these ports are used to configure the MicroBlaze BRAMs on the fly. The MicroBlaze processor communicates with the PMODS and the Arduino shield port, providing a seamless interface.

Some of the in-depth detail of the base overlay is shown in the tables below:

Now that we have rebuilt the base platform in Vivado and we understand how it is interconnected, we can start building our own PYNQ overlay. The first one will be simple, just to demonstrate the process. After that, we can move on to creating more complex examples.

Code is available on Github as always.

If you want E book or hardback versions of previous MicroZed chronicle blogs, you can get them below.

First Year E Book here

First Year Hardback here

Second Year E Book here

Second Year Hardback here

All of Adam Taylor’s MicroZed Chronicles are cataloged here.