After completing this lab, you will be able to:
Select Verilog as the Target Language, Mixed as the Simulator language, and for IP location, type {labs}\led_ip and click Finish (leave other settings as defaults and click OK if prompted to create the directory)
New IP Location form (**Needs to be Updated**)
Fill in the details for the IP.
Name: led_ip
Display Name: led_ip_v1_0
(Fill in a description, Vendor Name, and URL)
Leave the other settings as default and click Next (Lite interface, Slave mode, Data Width: 32, Number of Registers: 4).
In the sources panel, double-click the led_ip_v1_0.v file.
This file contains the HDL code for the interface(s) selected above. The top level file contains a module which implements the AXI interfacing logic, and an example design to write to and read from the number of registers specified above. This template can be used as a basis for creating custom IP. A new parameterized output port to the LEDs will be created at the top level of the design, and the AXI write data in the sub-module will be connected back up to the external LED port.
Scroll down to line 7 where a user parameters space is provided.
Add the line:
parameter integer LED_WIDTH = 8,
Go to line 18 and add the line:
output wire [LED_WIDTH-1:0] LED,
don’t forget to add commas when adding a port.
.LED_WIDTH(LED_WIDTH),
.LED(LED),
Add the LED parameter and port to this file too, at lines 7 and 18 (done in steps 2 ands 3).
Scroll down to ~line 400 and insert the following code to instantiate the user logic for the LED IP. (This code can be typed directly, or copied from the user_logic_instantiation.txt file in the lab3 source folder.)
lab3_user_logic # (
.LED_WIDTH(LED_WIDTH)
)
U1(
.S_AXI_ACLK(S_AXI_ACLK),
.slv_reg_wren(slv_reg_wren),
.axi_awaddr(axi_awaddr[C_S_AXI_ADDR_WIDTH-1:ADDR_LSB]),
.S_AXI_WDATA(S_AXI_WDATA),
.S_AXI_ARESETN(S_AXI_ARESETN),
.LED(LED)
);
Check all the signals that are being connected and where they originate.
Click on the Add Sources in the Flow Navigator pane, select Add or Create Design Sources, click Next, then click the Plus icon then Add Files…, browse to {sources}\lab3, select the lab3_user_logic.v file and click OK, and then click Finish to add the file.
Check the contents of this file to understand the logic that is being implemented. Notice the formed hierarchy.
Make sure that when adding the source lab3_user_logic.v, untick the option: Copy sources into IP directory.
Check the Messages tab for any errors and correct if necessary before moving to the next step
When Synthesis completes successfully, click Cancel.
Package IP
Skip the next two steps (2 and 3) if you see /Basic_Elements under the Categories section, (like the one shown in figure)
Compatibility under Package IP
If this does not match up with what you have, click the blue plus then Add Family Explicitly… from the menu. Select the Zynq family (This is the family of devices the PYNQ-Z2 belongs to) and click OK.
Click on File Groups and click Merge changes from File Groups Wizard.
Compatibility under Package IP
This is to update the IP Packager with the changes that were made to the IP and the lab3_user_logic.v file that was added to the project. Expand Verilog Synthesis and notice lab3_user_logic.v has been included.
Select Customization GUI and notice that the Led Width is visible.
Customization GUI under Package IP
You may encounter errors in later labs if you are using a Windows machine.
INCLUDEFILES=led_ip.h
LIBSOURCES=led_ip.c led_ip_selftest.c
OUTS=led_ip.o led_ip_selftest.o
Specify IP Repository
Select the LED port on the led_ip instance (by clicking on its pin), right-click and select Make External. Rename the port as LED.
LED external port added and connected
Select the Address Editor tab and verify that an address has been assigned to led_ip.
Completed Block Diagram
Press F6 to validate the design one last time.
Vivado IP packager was used to import a custom IP block into the IP library. The IP block was then added to the system. Connection automation was run where available to speed up the design of the system by allowing Vivado to automatically make connections between IP. An additional BRAM was added to the design. Finally, pin location constraints were added to the design. This lab is build upon and tested in Lab 4.