├── README.md ├── images ├── add_ip.png ├── connect.png ├── disconnect.png ├── lab1 │ ├── Fig1.png │ ├── Fig10.png │ ├── Fig11.png │ ├── Fig12.png │ ├── Fig13.png │ ├── Fig14.png │ ├── Fig15.png │ ├── Fig16-1.png │ ├── Fig16-2.png │ ├── Fig17.png │ ├── Fig18.png │ ├── Fig2.png │ ├── Fig3.png │ ├── Fig4.png │ ├── Fig5.png │ ├── Fig6.png │ ├── Fig7.png │ ├── Fig8.png │ └── Fig9.png ├── lab2 │ ├── Fig1.png │ ├── Fig10.png │ ├── Fig11.png │ ├── Fig12.png │ ├── Fig13.png │ ├── Fig14.png │ ├── Fig15.png │ ├── Fig16.png │ ├── Fig17.png │ ├── Fig18.png │ ├── Fig19-1.png │ ├── Fig19-2.png │ ├── Fig19-3.png │ ├── Fig2.png │ ├── Fig20.png │ ├── Fig21.png │ ├── Fig22.png │ ├── Fig23.png │ ├── Fig24.png │ ├── Fig3.png │ ├── Fig4.png │ ├── Fig5.png │ ├── Fig6.png │ ├── Fig7.png │ ├── Fig8.png │ ├── Fig9.png │ └── disconnect.png ├── lab3 │ ├── Fig1.png │ ├── Fig2.png │ ├── Fig3.png │ ├── Fig4.png │ ├── Fig5.png │ ├── Fig6.png │ └── Fig7.png ├── lab4 │ ├── Fig1.png │ ├── Fig10.png │ ├── Fig2.png │ ├── Fig3.png │ ├── Fig4.png │ ├── Fig5.png │ ├── Fig6.png │ ├── Fig7.png │ ├── Fig8.png │ └── Fig9.png ├── lab5 │ ├── Fig1.png │ ├── Fig10.png │ ├── Fig2.png │ ├── Fig3.png │ ├── Fig4.png │ ├── Fig5.png │ ├── Fig6.png │ ├── Fig7.png │ ├── Fig8-1.png │ └── Fig9.png ├── lab6 │ ├── Fig1.png │ ├── Fig10.png │ ├── Fig11.png │ ├── Fig2.png │ ├── Fig3.png │ ├── Fig4.png │ ├── Fig5.png │ ├── Fig6.png │ ├── Fig7.png │ ├── Fig8.png │ ├── Fig9.png │ └── FigSort.png ├── resume.png ├── terminal.png ├── validate.png └── zoom_in.png ├── lab1.md ├── lab2.md ├── lab3.md ├── lab4.md ├── lab5.md ├── lab6.md ├── slides ├── 01_Class_Intro.pdf ├── 11_Embedded_System_Design_Review.pdf ├── 11a_Lab1_Intro.pdf ├── 12_Advanced_Zynq_Architecture.pdf ├── 13_System_Debugging.pdf ├── 13a_Lab2_Intro.pdf ├── 14_Memory_Interfacing.pdf ├── 14a_Lab3_Intro.pdf ├── 15_Interrupts.pdf ├── 16_Low_Latency_High_Bandwidth.pdf ├── 16a_Lab4_Intro.pdf ├── 17_Configuration_and_Bootloading.pdf ├── 17a_Lab5_Intro.pdf ├── 18_Profiling_and_Performance_Improvement.pdf └── 18a_Lab6_Intro.pdf └── sources ├── lab1 └── lab1.c ├── lab2 ├── iladata.ila ├── lab2.c ├── lab2_pynqz1.xdc ├── lab2_pynqz2.xdc ├── lab2_user_logic.vhd ├── math_ip.v └── math_ip │ ├── component.xml │ ├── math_ip.data │ ├── constrs_1 │ │ └── fileset.xml │ ├── sim_1 │ │ └── fileset.xml │ ├── sources_1 │ │ └── fileset.xml │ └── wt │ │ ├── java_command_handlers.wdf │ │ ├── project.wpc │ │ └── webtalk_pa.xml │ ├── math_ip.srcs │ └── sources_1 │ │ └── imports │ │ └── lab2 │ │ ├── lab2_user_logic.vhd │ │ └── math_ip.v │ ├── math_ip.xpr │ └── xgui │ └── math_ip_v1_0.tcl ├── lab3 └── lab3.c ├── lab4 └── lab4.c ├── lab5 ├── bit_files.bif ├── devcfg.c ├── devcfg.h ├── lab5_qspi.c ├── lab5_sd.c ├── load_elf.s ├── pynqz1 │ ├── QSPI │ │ ├── lab1.bin │ │ ├── lab3.bin │ │ └── lab5.zip │ └── SDCard │ │ ├── lab1.bin │ │ ├── lab1elf.bin │ │ ├── lab3.bin │ │ └── lab3elf.bin └── pynqz2 │ ├── QSPI │ ├── lab1.bin │ ├── lab3.bin │ └── lab5.zip │ └── SDCard │ ├── lab1.bin │ ├── lab1elf.bin │ ├── lab3.bin │ └── lab3elf.bin └── lab6 ├── fir.c ├── fir.h ├── fir_coef.dat ├── fir_ip ├── component.xml ├── fir_ip.data │ ├── constrs_1 │ │ └── fileset.xml │ ├── sim_1 │ │ └── fileset.xml │ ├── sources_1 │ │ └── fileset.xml │ └── wt │ │ ├── java_command_handlers.wdf │ │ ├── project.wpc │ │ └── webtalk_pa.xml ├── fir_ip.filter ├── fir_ip.srcs │ └── sources_1 │ │ └── imports │ │ └── verilog │ │ ├── fir.v │ │ ├── fir_ap_rst_if.v │ │ ├── fir_c.v │ │ ├── fir_c_rom.dat │ │ ├── fir_io_if.v │ │ ├── fir_shift_reg.v │ │ ├── fir_shift_reg_ram.dat │ │ └── fir_top.v ├── fir_ip.xpr ├── fir_top_0 │ ├── fir_top_0.xci │ └── fir_top_0.xml ├── fir_top_0_0 │ ├── fir_top_0.xci │ └── fir_top_0.xml └── xgui │ └── fir_top_v1_0.tcl ├── lab6.c ├── lab6.h └── xfir_fir_io.h /README.md: -------------------------------------------------------------------------------- 1 | # Advanced Embedded System Design Flow on Zynq 2 | This workshop provides participants the necessary skills to develop complex embedded systems and enable them to improve their designs by using the tools available in Vivado. It also helps developers understand and utilize advanced components of embedded systems design for architecting a complex system in the Zynq™ System on a Chip (SoC) 3 | 4 | The labs have been developed on a PC running Microsoft Windows 10 professional edition and using **Vivado 2018.2** version tools. 5 | 6 | ## Source Files Setup 7 | 8 | To use the source files for each of the labs in this workshop, you have to clone this repository from XUP Github. For that, do the following: 9 | 10 | git clone https://github.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq.git 11 | 12 | --- 13 | #### In the instructions for the labs; 14 | 15 | **{sources}** refers to C:\xup\adv\_embedded\2018\_2\_zynq\_sources. Copy the **sources** directory from the cloned directory as 2018\_2\_zynq\_sources under c:\xup\adv\_embedded OR you can download the source files for the labs from [here](https://www.xilinx.com/support/university/vivado/vivado-workshops/Vivado-adv-embedded-design-zynq.html) 16 | 17 | **{labs}** refers to C:\xup\adv\_embedded\2018\_2\_zynq\_lab. It assumes that you will create the mentioned directory structure to carry out the labs of this workshop 18 | 19 | --- 20 | **NOTE** 21 | 22 | Board support for the PYNQ-Z1 and PYNQ-Z2 are not included in Vivado 2018.2 by default. The relevant files need to be extracted and saved to: 23 | 24 | {Vivado installation}\data\boards\board\_files\zynq 25 | 26 | These files can be downloaded from [board_files](https://www.xilinx.com/support/university/vivado/vivado-workshops/Vivado-adv-embedded-design-zynq.html). 27 | 28 | --- 29 | 30 | ## Hardware Setup 31 | 32 | 33 | **PYNQ-Z2**: Connect the board to the PC using a micro USB cable. Make sure that a jumper is connected to JTAG (between JP1_1 and JP1_2) to use the board in the development mode. Also, make sure that another jumper is placed between J9\_2 and J9\_3 to select USB as a power source. 34 | 35 | **PYNQ-Z1**: Connect the board to the PC using a micro USB cable. Make sure that a jumper is connected to JTAG (between JP4\_1 and JP4\_2) to use the board in the development mode. Also, make sure that another jumper is placed between JP5\_2 and JP5\_3 to select USB as a power source. 36 | 37 | ## Labs Overview: 38 | 39 | ### Lab 1 40 | 41 | This lab guides you through the process of using Vivado and IP Integrator to create a complete Zynq ARM Cortex-A9 based processor system targeting either the PYNQ-Z1 or PYNQ-Z2 boards. You will use the Block Design feature of IP Integrator to configure the Zynq PS and add IP to create the hardware system, and SDK to create an application to verify the design functionality 42 |
43 |
44 |
46 |
47 | 48 | ### Lab 2 49 | Software and hardware interact with each other in an embedded system. The SDK includes System Debugger as a software debugging tool. The hardware analyzer tool has different types of cores that allow hardware debugging by providing access to internal signals without requiring the signals to be connected to package pins. These hardware debug cores may reside in the programmable logic (PL) portion of the device and can be configured with several modes that can monitor signals within the design. In this lab you will be introduced to the various debugging cores. 50 |
51 |
52 |
54 |
55 | 56 | ### Lab 3 57 | The Zynq device supports various types of memory including volatile (e.g. DDR3) and non-volatile (e.g. QSPI Flash). There are volatile and non-volatile hard memory controllers on the Zynq PS. The PL portion of the Zynq device has plenty of Block RAM (BRAM) which can be used by an IP without contending for external resources and creating performance bottleneck. This lab guides you through the process of extending the memory space in Zynq-based platform using available PL based BRAM resource. 58 |
59 |
60 |
62 |
63 | 64 | ### Lab 4 65 | In Zynq, multiple interconnections are available between the PS and PL sections with different performance levels for data transfer between the two subsystems. The General Purpose (GP) Master and Slave AXI interconnect used in the previous labs are intended for peripherals that do not have high bandwidth requirements. E.g. switches, leds, keyboard, mouse. There are four High Performance PS slave to PL master AXI interfaces available for peripherals that need higher bandwidth. E.g. Video and image processing applications. This lab guides you through the process of enabling a High Performance AXI slave port in the PS, adding an AXI central DMA (CDMA) controller, and performing Direct Memory Access (DMA) operations between various memories. 66 |
67 |
68 |
70 |
71 | 72 | ### Lab 5 73 | This lab guides you through creating a bootable system capable of booting from the SD card or the QSPI flash memory located on the board. It also demonstrates how different bitstreams can be loaded in the PL section after the board is booted up and the corresponding application can be executed. 74 |
75 |
76 |
78 |
79 | 80 | ### Lab 6 81 | This lab guides you through the process of profiling an application and analyzing the output. The application is then accelerated in hardware and profiled again to analyze the performance improvement. 82 |
83 |
84 |
86 |
87 | -------------------------------------------------------------------------------- /images/add_ip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/add_ip.png -------------------------------------------------------------------------------- /images/connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/connect.png -------------------------------------------------------------------------------- /images/disconnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/disconnect.png -------------------------------------------------------------------------------- /images/lab1/Fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig1.png -------------------------------------------------------------------------------- /images/lab1/Fig10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig10.png -------------------------------------------------------------------------------- /images/lab1/Fig11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig11.png -------------------------------------------------------------------------------- /images/lab1/Fig12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig12.png -------------------------------------------------------------------------------- /images/lab1/Fig13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig13.png -------------------------------------------------------------------------------- /images/lab1/Fig14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig14.png -------------------------------------------------------------------------------- /images/lab1/Fig15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig15.png -------------------------------------------------------------------------------- /images/lab1/Fig16-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig16-1.png -------------------------------------------------------------------------------- /images/lab1/Fig16-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig16-2.png -------------------------------------------------------------------------------- /images/lab1/Fig17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig17.png -------------------------------------------------------------------------------- /images/lab1/Fig18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig18.png -------------------------------------------------------------------------------- /images/lab1/Fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig2.png -------------------------------------------------------------------------------- /images/lab1/Fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig3.png -------------------------------------------------------------------------------- /images/lab1/Fig4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig4.png -------------------------------------------------------------------------------- /images/lab1/Fig5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig5.png -------------------------------------------------------------------------------- /images/lab1/Fig6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig6.png -------------------------------------------------------------------------------- /images/lab1/Fig7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig7.png -------------------------------------------------------------------------------- /images/lab1/Fig8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig8.png -------------------------------------------------------------------------------- /images/lab1/Fig9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab1/Fig9.png -------------------------------------------------------------------------------- /images/lab2/Fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig1.png -------------------------------------------------------------------------------- /images/lab2/Fig10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig10.png -------------------------------------------------------------------------------- /images/lab2/Fig11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig11.png -------------------------------------------------------------------------------- /images/lab2/Fig12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig12.png -------------------------------------------------------------------------------- /images/lab2/Fig13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig13.png -------------------------------------------------------------------------------- /images/lab2/Fig14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig14.png -------------------------------------------------------------------------------- /images/lab2/Fig15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig15.png -------------------------------------------------------------------------------- /images/lab2/Fig16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig16.png -------------------------------------------------------------------------------- /images/lab2/Fig17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig17.png -------------------------------------------------------------------------------- /images/lab2/Fig18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig18.png -------------------------------------------------------------------------------- /images/lab2/Fig19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig19-1.png -------------------------------------------------------------------------------- /images/lab2/Fig19-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig19-2.png -------------------------------------------------------------------------------- /images/lab2/Fig19-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig19-3.png -------------------------------------------------------------------------------- /images/lab2/Fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig2.png -------------------------------------------------------------------------------- /images/lab2/Fig20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig20.png -------------------------------------------------------------------------------- /images/lab2/Fig21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig21.png -------------------------------------------------------------------------------- /images/lab2/Fig22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig22.png -------------------------------------------------------------------------------- /images/lab2/Fig23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig23.png -------------------------------------------------------------------------------- /images/lab2/Fig24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig24.png -------------------------------------------------------------------------------- /images/lab2/Fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig3.png -------------------------------------------------------------------------------- /images/lab2/Fig4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig4.png -------------------------------------------------------------------------------- /images/lab2/Fig5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig5.png -------------------------------------------------------------------------------- /images/lab2/Fig6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig6.png -------------------------------------------------------------------------------- /images/lab2/Fig7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig7.png -------------------------------------------------------------------------------- /images/lab2/Fig8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig8.png -------------------------------------------------------------------------------- /images/lab2/Fig9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/Fig9.png -------------------------------------------------------------------------------- /images/lab2/disconnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab2/disconnect.png -------------------------------------------------------------------------------- /images/lab3/Fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab3/Fig1.png -------------------------------------------------------------------------------- /images/lab3/Fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab3/Fig2.png -------------------------------------------------------------------------------- /images/lab3/Fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab3/Fig3.png -------------------------------------------------------------------------------- /images/lab3/Fig4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab3/Fig4.png -------------------------------------------------------------------------------- /images/lab3/Fig5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab3/Fig5.png -------------------------------------------------------------------------------- /images/lab3/Fig6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab3/Fig6.png -------------------------------------------------------------------------------- /images/lab3/Fig7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab3/Fig7.png -------------------------------------------------------------------------------- /images/lab4/Fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab4/Fig1.png -------------------------------------------------------------------------------- /images/lab4/Fig10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab4/Fig10.png -------------------------------------------------------------------------------- /images/lab4/Fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab4/Fig2.png -------------------------------------------------------------------------------- /images/lab4/Fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab4/Fig3.png -------------------------------------------------------------------------------- /images/lab4/Fig4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab4/Fig4.png -------------------------------------------------------------------------------- /images/lab4/Fig5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab4/Fig5.png -------------------------------------------------------------------------------- /images/lab4/Fig6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab4/Fig6.png -------------------------------------------------------------------------------- /images/lab4/Fig7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab4/Fig7.png -------------------------------------------------------------------------------- /images/lab4/Fig8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab4/Fig8.png -------------------------------------------------------------------------------- /images/lab4/Fig9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab4/Fig9.png -------------------------------------------------------------------------------- /images/lab5/Fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab5/Fig1.png -------------------------------------------------------------------------------- /images/lab5/Fig10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab5/Fig10.png -------------------------------------------------------------------------------- /images/lab5/Fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab5/Fig2.png -------------------------------------------------------------------------------- /images/lab5/Fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab5/Fig3.png -------------------------------------------------------------------------------- /images/lab5/Fig4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab5/Fig4.png -------------------------------------------------------------------------------- /images/lab5/Fig5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab5/Fig5.png -------------------------------------------------------------------------------- /images/lab5/Fig6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab5/Fig6.png -------------------------------------------------------------------------------- /images/lab5/Fig7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab5/Fig7.png -------------------------------------------------------------------------------- /images/lab5/Fig8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab5/Fig8-1.png -------------------------------------------------------------------------------- /images/lab5/Fig9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab5/Fig9.png -------------------------------------------------------------------------------- /images/lab6/Fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/Fig1.png -------------------------------------------------------------------------------- /images/lab6/Fig10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/Fig10.png -------------------------------------------------------------------------------- /images/lab6/Fig11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/Fig11.png -------------------------------------------------------------------------------- /images/lab6/Fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/Fig2.png -------------------------------------------------------------------------------- /images/lab6/Fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/Fig3.png -------------------------------------------------------------------------------- /images/lab6/Fig4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/Fig4.png -------------------------------------------------------------------------------- /images/lab6/Fig5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/Fig5.png -------------------------------------------------------------------------------- /images/lab6/Fig6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/Fig6.png -------------------------------------------------------------------------------- /images/lab6/Fig7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/Fig7.png -------------------------------------------------------------------------------- /images/lab6/Fig8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/Fig8.png -------------------------------------------------------------------------------- /images/lab6/Fig9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/Fig9.png -------------------------------------------------------------------------------- /images/lab6/FigSort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/lab6/FigSort.png -------------------------------------------------------------------------------- /images/resume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/resume.png -------------------------------------------------------------------------------- /images/terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/terminal.png -------------------------------------------------------------------------------- /images/validate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/validate.png -------------------------------------------------------------------------------- /images/zoom_in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/images/zoom_in.png -------------------------------------------------------------------------------- /lab1.md: -------------------------------------------------------------------------------- 1 | # Building a Complete Embedded System 2 | 3 | ## Objectives 4 | 5 | After completing this lab, you will be able to: 6 | 7 | * Create an embedded system design using Vivado and SDK flow 8 | * Configure the Processing System (PS) 9 | * Add Xilinx standard IP in the Programmable Logic (PL) section 10 | * Use SDK to build a software project and verify the design functionality in hardware. 11 | 12 | ## Steps 13 | 14 | ## Create a Vivado Project 15 | ### Launch Vivado and create an empty project targeting the PYNQ-Z1 or PYNQ-Z2 board, selecting Verilog as a target language 16 | 1. Open Vivado by selecting **Start > All Programs >** **Xilinx Design Tools** **> Vivado 2018.2 > Vivado 2018.2** 17 | 1. Click **Create Project** to start the wizard. You will see the _Create A New Vivado Project_ wizard page. Click **Next**. 18 | 1. Click the Browse button of the _Project Location_ field of the **New Project** form, browse to **{labs}** , and click **Select**. 19 | 1. Enter **lab1** in the _Project Name_ field. Make sure that the _Create Project Subdirectory_ box is checked. Click **Next**. 20 |
21 |
22 |
24 | Project Name Entry 25 |
26 | 1. Select the **RTL Project** option in the _Project Type_ form, and click **Next**. 27 | 1. Select **Verilog** as the _Target Language_ and _Simulation Language_ in the _Add Sources_ form, and click **Next**. 28 | 1. Click **Next** to skip adding constraints. 29 | 1. In the _Default Part_ form, click **Boards** filter. 30 | 1. Select **www.digilentinc.com** for the _PYNQ-Z1_ board, **tul.com.tw** for the _PYNQ-Z2_ board in the Vendor field, select _PYNQ-Z1__or pynq-z2_, and click **Next**. 31 |
32 |
33 |
35 | Board Selection (pynq-z2) 36 |
37 | 1. Click **Finish** to create an empty Vivado project. 38 | 39 | ### Creating the Hardware System Using IP Integrator 40 | 41 | 1. Create a block design in the Vivado project using IP Integrator to generate the ARM Cortex-A9 processor based hardware system. 42 | 1. In the Flow Navigator, click **Create Block Design** under IP Integrator. 43 | 1. Name the block **system** and click **OK**. 44 | 1. Click on the button. 45 | 1. Once the IP Catalog is open, type zy into the Search bar, and double click on the **ZYNQ7 Processing System** entry to add it to the design. 46 | 1. Click on **Run Block Automation** and click **OK** to automatically configure the board presets. 47 |
48 |
49 |
51 | Zynq Block Automation View (pynq-z2) 52 |
53 | 1. Double click on the Zynq block to open the _Customization_ window for the Zynq processing system. 54 | 55 | A block diagram of the Zynq PS should now be open, showing various configurable blocks of the Processing System. 56 | 57 | 1. At this stage, designer can click on various configurable blocks (highlighted in green) and change the system configuration. 58 |
59 |
60 |
62 | Zynq Processing System Configuration View (pynq-z2) 63 |
64 | #### Configure the I/O Peripherals block to only have UART 0 support. 65 | 1. Click on the _MIO Configuration_ panel to open its configuration form. 66 | 1. Expand the I/O Peripherals (and GPIO). 67 | 1. Deselect all the peripherals except _UART 0_ (Deselect ENET 0, USB 0, SD 0, and GPIO). 68 |
69 |
70 |
72 | Selecting only UART 0 Peripheral of PS 73 |
74 | 1. Click **OK**. 75 | 76 | The configuration form will close and the block diagram will be updated as shown below. 77 |
78 |
79 |
81 | ZYNQ7 Processing System configured block 82 |
83 | ### Add one instance of GPIO, name it _buttons_, and configure for the board. Connect the block to the Zynq. 84 | 85 | 1. Click the  button and search for **AXI GPIO** in the catalog. 86 | 1. Double-click the **AXI GPIO** to add an instance of the core to the design. 87 | 1. Click on the **AXI GPIO** block to select it, and in the _Block properties_ tab, change the name to **buttons.** 88 | 1. Double click on the **AXI GPIO** block to open the customization window. Under _Board Interface_, for _GPIO_, click on **Custom** to view the drop down menu options, and select **btns 4Bits** for the PYNQ-Z2 or the PYNQ-Z1 board. 89 | 90 | As the board was selected during the project creation, and a board support package is available for these boards, Vivado has knowledge of available resources on the board. 91 | 92 | 1. Click the **IP Configuration** tab. Notice the GPIO Width is set to 4 (PYNQ-Z1 and PYNQ-Z2) and is greyed out. If a board support package was not available, the width of the IP could be configured here. 93 | 1. Click **OK** to finish configuring the GPIO and to close the _Re-Customize IP_ window. 94 | 1. Click on **Run Connection Automation** , and select **buttons** (which will include GPIO and S\_AXI) 95 | 96 | Click on **GPIO** and **S\_AXI** to check the default connections for these interfaces. 97 |
98 |
99 |
101 | Connection Automation for the GPIO (PYNQ-Z2) 102 |
103 | 1. Click **OK** to automatically connect the _S\_AXI_ interface to the Zynq _GP0_ port (through the AXI interconnect block), and the GPIO port to an external interface. 104 | 105 | Notice that after block automation has been run, two additional blocks that are required to connect the blocks, _Processor System Reset_, and _AXI Interconnect_ have automatically been added to the design. 106 | 107 | 1. Add another instance of GPIO, name the instance _leds_, configure it and connect it to the Zynq. 108 | 1. Add another instance of the _GPIO_ peripheral **.** 109 | 1. Change the name of the block to **leds.** 110 | 1. Double click on the _leds_ block, and select **leds 4bits** (PYNQ-Z1 and PYNQ-Z2) for the _GPIO_ interface and click **OK.** 111 | 1. Click on **Run Connection Automation** 112 | 1. Click **leds** , and check the connections for _GPIO_ and _S\_AXI_ as before 113 | 1. Click **OK** to automatically connect the interfaces as before. 114 | 115 | Notice that the AXI Interconnect block has the second master AXI (M01\_AXI) port added and connected to the S\_AXI of the leds. 116 | 117 | 1. Add another instance of GPIO, name the instance _switches_, configure it and connect it to the Zynq. 118 | 1. Add another instance of the _GPIO_ peripheral **.** 119 | 1. Change the name of the block to **switches.** 120 | 1. Double click on the _switches_ block, and select **sws 2bits** (PYNQ-Z1 and PYNQ-Z2) for the _GPIO_ interface and click **OK.** 121 | 1. Click on **Run Connection Automation** 122 | 1. Click **switches** , and check the connections for _GPIO_ and _S\_AXI_ as before 123 | 1. Click **OK** to automatically connect the interfaces as before. 124 | 125 | Notice that the AXI Interconnect block has the third master AXI (M02\_AXI) port added and connected to the S\_AXI of the leds. 126 | 127 | At this stage the design should look like as shown below. 128 |
129 |
130 |
132 | Completed design 133 |
134 | 1. Verify that the addresses are assigned to the two GPIO instances and validate the design for no errors. 135 | 1. Select the **Address Editor** tab and see that the addresses are assigned to the three GPIO instances. They should look like as follows. 136 |
137 |
138 |
140 | Assigned addresses 141 |
142 | The addresses should be in the 0x40000000 to 0xbfffffff range as the instances are connected to M\_AXI\_GP0 port of the processing system instance. 143 | 144 | 1. Select the _Diagram_ tab, and click on the  145 | (Validate Design) button to make sure that there are no errors. 146 | 147 | Ignore warnings. 148 | 149 | 1. Select **File > Save Block Design** to save the design. 150 | 1. Since all IO pins are board-aware no additional user constraints are need. 151 | 152 | ### Generate the Bitstream 153 | 1. Create the top-level HDL of the embedded system. Add the provided constraints file and generate the bitstream. 154 | 1. In Vivado, select the _Sources_ tab, expand the _Design Sources,_ right-click the _system.bd_ and select **Create HDL Wrapper…** 155 |
156 |
157 |
159 | Selecting the system design to create the wrapper file 160 |
161 | 1. Click **OK** when prompted to allow Vivado to automatically manage this file. 162 | 163 | The wrapper file, _system\_wrapper.v_, is generated and added to the hierarchy. The wrapper file will be displayed in the Auxiliary pane. 164 |
165 |
166 |
168 | Design Hierarchy View 169 |
170 | 1. Click on the **Generate Bitstream** in the _Flow Navigator_ pane to synthesize and implement the design, and generate the bitstream. Click **Save** and **Yes** if prompted. Click **OK** to launch the runs. 171 | 1. When the bitstream generation is complete, click **Cancel**. 172 | 173 | ### Export the Design to the SDK 174 | #### Exporting the design and launch SDK 175 | 1. Export the hardware configuration by clicking **File > Export > Export Hardware** … Tick the box to include the bitstream and click **OK**. 176 |
177 |
178 |
180 | Exporting the hardware 181 |
182 | 1. Launch SDK by clicking **File > Launch SDK** and click **OK** 183 | 184 | (Launching SDK from Vivado will automatically load the SDK workspace associated with the current project. If launching SDK standalone, the workspace will need to be selected.) 185 | 186 | ## Generate an Application in SDK 187 | ### Generate a board support package project with default settings and default software project name. 188 | 189 | SDK should open and automatically create a hardware platform project based on the configuration exported from Vivado. A board support package and software application will be created and associated with this hardware platform. 190 | 191 | 1. Select **File** > **New** > **Board Support Package** 192 |
193 |
194 |
196 | Create BSP 197 |
198 | 1. Click **Finish** with the default settings selected (using the Standalone operating system). 199 | 200 | This will open the Software Platform Settings form showing the OS and libraries selections. 201 | 202 | 1. Click **OK** to accept the default settings as we want to create a **standalone\_bsp\_0** software platform project without any additional libraries. 203 | 1. The library generator will run in the background and will create the **xparameters.h** file in the **lab1.sdk\standalone\_bsp\_0\ps7\_cortexa9\_0\include** directory. 204 | 1. Create an empty application project, named lab1, and import the provided lab1.c file. 205 | 1. Select **File > New** > **Application Project.** 206 | 1. In the _Project Name_ field, enter **lab1** as the project name. 207 | 1. Select the _Use existing_ option in the _Board Support Package_ field and then click **Next.** 208 |
209 |
210 |
212 | Create a Blank Application Project 213 |
214 | 1. Select the **Empty Application** template and click **Finish.** 215 | 216 | The lab1 project will be created in the Project Explorer window of SDK. 217 | 218 | 1. Select **lab1 > src** directoryin the project view, right-click, and select **Import.** 219 | 1. Expand the **General** category and double-click on **File System.** 220 | 1. Browse to the **{sources}\lab1** folder. 221 | 1. Select the **lab1.c** source file and click **Finish.** 222 | 223 | A snippet of the source code is shown in the following figure. Note the greyed out code will be used in Lab5. The code reads from the switches, and writes to the LEDs. The BTN is read, and written to the LED. 224 |
225 |
226 |
228 |
229 |
231 | Snippet of Source Code 232 |
233 | ## Test in Hardware 234 | ### Connect and power up the board. Establish serial communications using the SDK's Terminal tab. Verify the design functionality. 235 | 1. Connect and power up the board. 236 | 1. Select the  237 | tab. If it is not visible then select **Window > Show view > Other > Terminal > Terminal**. 238 | 1. Click on  and select appropriate COM port (depending on your computer), and configure the terminal with the parameters as shown below. 239 |
240 |
241 |
243 | SDK Terminal Settings 244 |
245 | 1. Select **Xilinx** > **Program FPGA** and then click the **Program** button. 246 | 1. Make sure that the **SW0-1** are not set to "11". 247 | 1. Select the **lab1** project in the _Project Explorer_, right-click and select **Run As > Launch on Hardware(System Debugger)** to download the application, execute ps7\_init, and execute lab1.elf. 248 | 1. You should see the following output on the Terminal console. 249 |
250 |
251 |
253 | SDK Terminal Output 254 |
255 | 1. Press BTN0-BTN3 (PYNQ-Z1, PYNQ-Z2) and see the corresponding LED light up. 256 | 1. Set the two slide switches on PYNQ-Z1 or PYNQ-Z2 to the ON position to exit the program. 257 | 1. Close SDK and Vivado programs by selecting **File > Exit** in each program. 258 | 1. Turn OFF the power to the board. 259 | 260 | ## Conclusion 261 | 262 | In this lab, you created an ARM Cortex-A9 processor based embedded system using the Zynq device for the PYNQ-Z1/PYNQ-Z2 board. You instantiated the Xilinx standard GPIO IP to provide input and output functionality. 263 | 264 | You created the project in Vivado, created the hardware system using IPI, implemented the design in Vivado, exported the generated bitstream to the SDK, created a software application in the SDK, and verified the functionality in hardware after programming the PL section and running the application from the DDR memory. -------------------------------------------------------------------------------- /lab2.md: -------------------------------------------------------------------------------- 1 | # Debugging Using Hardware Analyzer 2 | 3 | ## Objectives 4 | After completing this lab, you will be able to: 5 | 6 | * Add a VIO core in the design 7 | * Use a VIO core to inject stimulus to the design and monitor the response 8 | * Mark nets as debug so AXI transactions can be monitored 9 | * Add an ILA core in Vivado 10 | * Perform hardware debugging using the hardware analyzer 11 | * Perform software debugging using the SDK 12 | 13 | ## Steps 14 | 15 | ## Open the Project 16 | ### Open the Vivado program. Open the lab1 project you created in the previous lab or use the lab1 project from the labsolution directory, and save the project as lab2. Set Project Settings to point to the IP repository provided in the sources directory. 17 | 18 | 1. Start Vivado if necessary and open either the lab1 project (lab1.xpr) you created in the previous lab or the lab1 project in the labsolutions directory using the **Open Project** link in the Getting Started page. 19 | 1. Select **File > Project > Save As …** to open the Save Project As dialog box. Enter lab2 as the project name. Make sure that the Create Project Subdirectory option is checked, the project directory path is {labs} and click **OK.** 20 | This will create the lab2 directory and save the project and associated directory with lab2 name 21 | 1. Click **Settings** in the _Flow Navigator_ pane. 22 | 1. Expand **IP** in the left pane of the _Project Settings_ form and select **Repository.** 23 | 1. Click on the _plus_ button of the IP Repositories panel, browse to **{sources}\lab2\math_ip** and click **Select.** 24 | The directory will be scanned and one IP will be detected and reported. 25 |
26 |
27 |
29 | Specify IP Repository 30 |
31 | 1. Click **OK** twice to close the window. 32 | 33 | ## Add the Custom IP 34 | ### Open the Block Design and add the custom IP to the system. 35 | 1. Click **Open Block Design** in the _Flow Navigator_ pane to open the block diagram. 36 | 1. Click the  button and search for **math** in the catalog. 37 | 1. Double-click the **math\_ip\_v1\_0** to add an instance of the core to the design. 38 | 1. Click on **Run Connection Automation**, ensure math\_ip\_0 and S\_AXI are selected, and click **OK.** 39 | 40 | The _Math IP_ consists of a hierarchical design with the lower-level module performing the addition. The higher-level module includes the two slave registers. 41 |
42 |
43 |
45 | Custom Core's Main Functional Block 46 |
47 | ## Add the ILA and VIO Cores 48 | 49 | We want to connect the ILA core to the LED interface. Vivado prohibits connecting ILA cores to interfaces. In order to monitor the LED output signals, we need to convert the LED interface to simple output port. 50 | 51 | ### Disable LEDs interface. 52 | 1. Double-click the _leds_ instance to open its configuration form. 53 | 1. Click **Clear Board Parameters** and click **OK** to close the configuration form. 54 | 1. Select _leds\_4bit_ port and delete it. 55 | 1. Expand the _gpio_ interface of the **leds** instance to see the associate ports. 56 | ### Make the gpio\_io\_o port of the leds instance external and rename it as _leds_. 57 | 1. Move the mouse close to the end of the _gpio\_io\_o_ port, left-click to select (do not select the main GPIO port), and then right click and select **Make External**. 58 |
59 |
60 |
62 | Select the gpio_io_o port 63 |
64 | The port connector named gpio_io_o will be created and connected to the port. 65 | 66 | 1. Select the port _gpio\_io\_o_ and change its name to **leds** by typing it in the properties form. 67 | 1. Enable cross triggering between the PL and PS 68 | 1. Double click on the _Zynq_ block to open the configuration properties. 69 | 1. Click on PS-PL Configuration, and enable the _PS-PL Cross Trigger interface_. 70 | 1. Expand _PS-PL Cross Trigger interface > Input Cross Trigger_, and select **CPU0 DBG REQ** for _Cross Trigger Input 0._ 71 | 1. Similarly, expand Output Cross Trigger, and select **CPU0 DBG ACK** for _Cross Trigger Output 0_ and click **OK.** 72 |
73 |
74 |
76 | Enabling cross triggering in the Zynq processing system 77 |
78 | ### Add the ILA core and connect it to the LED output port. 79 | 1. Click the  button and search for **ila** in the catalog. 80 | 1. Double-click on the **ILA (Integrated Logic Analyzer)** to add an instance of it. The _ila\_0_ instance will be added. 81 | 1. Double-click on the _ila\_0_ instance. 82 | 1. Select **Native** as the _Monitor type_. 83 | 1. Enable _Trigger Out Port_, and _Trigger In port._ 84 | 1. Select the **Probe Ports** tab, and set the **Probe Width** of _PROBE0_ to **4** and click **OK**. 85 | 1. Using the drawing tool, connect the **PROBE0** port of the _ila\_0_ instance to the **gpio\_io\_o** port of the _leds_ instance. 86 | 1. Connect the **clk** port of the _ila\_0_ instance to the **FCLK\_CLK0** port of the Zynq subsystem. 87 | 1. Connect **TRIGG\_IN** of the ILA to **TRIGGER\_OUT\_0** of the Zynq processing system, and **TRIG\_OUT** of the ILA to the **TRIGGER\_IN\_0**. 88 | ### Add the VIO core and connect it to the math\_ip ports. 89 | 1. Click the  button and search for **vio** in the catalog. 90 | 1. Double-click on the **VIO (Virtual Input/Output)** to add an instance of it. 91 | 1. Double-click on the _vio_instance to open the configuration form. 92 | 1. In the _General Options_ tab, leave the _Input Probe Count_ set to **1** and set the _Output Probe Count_ to **3** 93 | 1. Select the _PROBE\_IN Ports_ tab and set the _PROBE\_IN0_ width to **9**. 94 | 1. Select the _PROBE\_OUT Ports_ tab and set _PROBE\_OUT0_ width to **1** , _PROBE\_OUT1_ width to **8** , and _PROBE\_OUT2_ width to **8**. 95 | 1. Click **OK**. 96 | 1. Connect the VIO ports to the math instance ports as follows: 97 | ``` 98 | PROBE_IN -> result 99 | PROBE_OUT0 -> sel 100 | PROBE_OUT1 -> ain_vio 101 | PROBE_OUT2 -> bin_vio 102 | ``` 103 | 1. Connect the **CLK** port of the _vio\_0_ to FCLK\_CKL0 net. 104 | 1. The block diagram should look similar to shown below. 105 |
106 |
107 |
109 | VIO added and connections made 110 |
111 | ### Mark Debug the S\_AXI connection between the AXI Interconnect and math\_0 instance. Validate the design. 112 | 1. Select the **S\_AXI** connection between the AXI Interconnect and the _math\_ip\_0_ instance **.** 113 | 1. Right-click and select **Debug** to monitor the AXI4Lite transactions. 114 | 115 | Notice that a system\_ila IP instance got added and the M03\_AXI <-> S\_AXI connection is connected to its SLOT\_0\_AXI interface. 116 | 117 | The block diagram should look as shown below. 118 |
119 |
120 |
122 | Block diagram of the design after marking AXI connection to the math_ip_0 instance for debugging 123 |
124 | 1. Click the **Run Connection Automation** link to see the form where you can select the desired channels to monitor. 125 | 1. Change _AXI Read Address_ and _AXI Read Data_ channels to **Data** since we will not trigger any signals of those channels. 126 | 127 | This saves resources being used by the design. 128 |
129 |
130 |
132 | Selecting channels for debugging 133 |
134 | 1. Select the _Diagram_ tab, and click on the  (Validate Design) button to make sure that there are no errors. 135 | 1. Verify that there are no unmapped addresses shown in the _Address Editor_ tab. 136 | ## Add Design Constraints and Generate Bitstream 137 | ### Add the provided lab2\_<board>.xdc from the sources\lab2 directory. Generate bitstream. 138 | 1. Right click in the _Sources_ panel, and select **Add Sources.** 139 | 1. Select _Add or Create Constraints_ and click **Next**. 140 | 1. Click the _Plus_ button then **Add Files**, browse to **{sources}\lab2\** and select **lab2\_pynz1.xdc,** or **lab2\_pynqz2.xdc** depending on the board you are using. 141 | 1. Click **OK** and then click **Finish.** 142 | 1. Click on the **Generate Bitstream** to run the implementation and bit generation processes. 143 | 1. Click **Save** to save the project (if prompted), **OK** to ignore the warning (if prompted), and **Yes** to launch Implementation (if prompted). Click **OK** to launch the runs. 144 | 1. When the bitstream generation process has completed successfully, click **Cancel**. 145 | ## Generate an Application in SDK 146 | ### Export the implemented design and launch SDK. 147 | 1. Export the hardware configuration by clicking **File > Export > Export Hardware…** , click the box to _Include Bitstream_ 148 | 1. Click **OK** to export and **Yes** to overwrite the previous project created by lab1. 149 | 1. Launch SDK by clicking **File > Launch SDK** and click **OK.** 150 | 1. Right-click on the **lab1** and **standalone\_bsp\_0** and **system\_wrapper\_hw\_platfrom\_0** projects in the Project Explorer view and select **close project**. 151 | ### Create an empty application project named lab2, and import the provided lab2.c file. 152 | 1. Select **File > New** > **Application Project.** 153 | 1. In the _Project Name_ field, enter **lab2** as the project name, leave all other settings to their default's and click **Next** (a new BSP will be created) **.** 154 | 1. Select the **Empty Application** template and click **Finish.** 155 | 156 | The lab2 project will be created in the Project Explorer window of the SDK. 157 | 158 | 1. Select **lab2 > src** in the project view, right-click, and select **Import.** 159 | 1. Expand the **General** category and double-click on **File System.** 160 | 1. Browse to the **{sources}\lab2** folder. 161 | 1. Select **lab2.c** and click **Finish.** 162 | 163 | A snippet of the part of the source code is shown in the following figure. It shows that two operands are written to the custom core, the result is read, and printed out. The write transaction will be used as a trigger condition in the Vivado Logic Analyzer. 164 |
165 |
166 |
168 | Source Code snippet 169 |
170 | 1. Right click on _lab2_, and select **Debug As > Debug Configurations** 171 | 1. Double click on Xilinx C/C++ application (System Debugger) to create a new configuration (_lab2 Debug will be created_), and in the _Target__Setup_ tab, check the **Enable Cross-Triggering** option **,** and click the Browse button. 172 |
173 |
174 |
176 | Enable cross triggering in the software environment 177 |
178 | 1. When the _Cross Trigger Breakpoints_ dialog box opens, click **Create** 179 | 1. Select the options as shown below and click **OK** to set up the cross-trigger condition for _Processor to Fabric_. 180 |
181 |
182 |
184 | Enabling CPU0 for request from PL 185 |
186 | 1. In the _Cross Trigger Breakpoints_ dialog box click **Create** again. 187 | 1. Select the options as shown below and click **OK** to set up the cross trigger condition for _Fabric to Processor_. 188 |
189 |
190 |
192 | Enabling CPU0 for request to PL 193 |
194 | 1. Click **OK** , then click **Apply,** then **Close** 195 | ## Test in Hardware 196 | ### Connect and power up the board. Download the bitstream into the target device. Start the debug session on lab2 project. Switch to the Debug perspective and establish serial communication. 197 | 1. Connect and power up the board. 198 | 1. Select **Xilinx** > **Program FPGA** and click **Program** 199 | 1. Select the **lab2** project in _Project Explorer_, right-click and select **Debug As > Launch on Hardware** (System Debugger) to download the application, execute ps7\_init. (If prompted, click **Yes** to switch to the Debug perspective.) The program execution starts and suspends at the entry point. 200 | 1. Select the  tab. If it is not visible then select **Window > Show view > Terminal** tab. 201 | 1. Click on  and select the appropriate COM port (depending on your computer), and configure it as you did it in Lab 1. 202 | ### Start the hardware session from Vivado. 203 | 1. Switch to Vivado. 204 | 1. Click on **Open Hardware Manager** from the _Program and Debug_ group of the _Flow Navigator_ pane to invoke the analyzer. 205 | 1. Click on the **Open Target > Auto connect** to establish the connection with the board. 206 | 1. Select **Window > Debug Probes** 207 | 208 | The hardware session will open showing the **Debug Probes** tab in the **Console** view. 209 |
210 |
211 |
213 | Debug probes 214 |
215 | The hardware session status window also opens showing that the FPGA is programmed (we did it in SDK), there are three cores out of which the two ila cores are in the idle state. 216 |
217 |
218 |
220 | Hardware session status 221 |
222 | 1. Select the XC7Z020, and click on the **Run Trigger Immediate** button to see the signals in the waveform window. 223 |
224 |
225 |
227 | Opening the waveform window 228 |
229 | ### Setup trigger conditions to trigger on a write transaction (WSTRB) when the desired data (WDATA) of XXXX\_XX12 is written. The transaction takes place when WVALID and WREADY are equal to 1. 230 | 1. Click on the _hw\_ila\_2_ tab to select it. In the **Debug Probes** window, under _hw\_ila\_2_, drag and drop the **WDATA** signal to the _ILA Basic Trigger setup_ window **.** 231 | 1. Set the value to **XXXX\_XX12** (HEX) (the value written to the math\_0 instance at line 24 of the program). 232 | 1. Similarly, add **WREADY,**** WSTRB, **and** WVALID** signals to the _ILA Basic Trigger setup_ window. 233 | 1. Change the radix to binary for _WSTRB_, and change the value from **xxxx** to **xxx1** 234 | 1. Change the value of **WVALID** and **WREADY** to 1. 235 | 1. Set the trigger position of the _hw\_ila\_2_ to **512** in the _Settings – hw\_ila\_2_ 236 |
237 |
238 |
240 | Setting up the ILA 241 |
242 | 1. Similarly, set the trigger position in the _Settings __–__ hw\_ila\_1_ tab to **512**. 243 | 1. Select **hw\_ila\_2** in the _Hardware_ window and click on the **Run Trigger** button and observe that the _hw\_ila\_2_ core is armed and showing the status as **Waiting For Trigger**. 244 |
245 |
246 |
248 | Hardware analyzer running and in capture mode 249 |
250 | 1. Switch to SDK. 251 | 1. Near line 27 (right click in the margin and select _Show Line Numbers_ if necessary_),_ double click on the left border on the line where xil\_printf statement is (before the while (1) statement) is defined in the lab2.c window to set a breakpoint. 252 |
253 |
254 |
256 | Setting a breakpoint 257 |
258 | 1. Click on the **Resume** () button to execute the program and stop at the breakpoint. 259 | 1. In the Vivado program, notice that the **hw\_ila\_2** status changed from _Waiting for Trigger_ to _Idle_, and the waveform window shows the triggered output (select the _hw\_ila\_data\_2.wcfg_ tab if necessary). 260 | 1. Move the cursor to closer to the trigger point and then click on the  button to zoom at the cursor. Click on the **Zoom In** button couple of times to see the activity near the trigger point. Similarly, you can see other activities by scrolling to right as needed. 261 |
262 |
263 |
264 |
265 |
267 | Zoomed waveform view of the three AXI transactions 268 |
269 | Observe the following: 270 | 271 | Around the 512th sample WDATA being written is 0x012 at offset 0 (AWADDR=0x0). 272 | At the 536th sample, offset is 0x4 (AWADDR), and the data being written is 0x034. 273 | At the 559th sample, data is being read from the IP at the offset 0x0 (ARADDR), and at 561# st mark the result (0x46) is on the RDATA bus. 274 | 1. You also should see the following output in the SDK Terminal console. 275 |
276 |
277 |
279 | Terminal Output 280 |
281 | ### In Vivado, select the VIO Cores related from the Dashboard Options windows, set the vio\_1\_probe\_out0 so math\_ip's input can be controlled manually through the VIO core. Try entering various values for the two operands and observe the output on the math\_ip\_1\_result port in the Console pane. 282 | 1. Select the **hw\_vio\_1** core in the _Dashboard Options_ panel. 283 | 1. Click on the  button and select all signals to stimulate and monitoring. Change the **vio\_0\_probe\_out0** value to **1** so the math\_ip core input can be controlled via the VIO core. 284 |
285 |
286 |
288 | VIO probes 289 |
290 | 1. Change **vio\_0\_probe\_out1** value to **55** (in Hex), and similarly, **vio\_0\_probe\_out2** value to **44** (in Hex). Notice that for a brief moment a blue-colored up-arrow will appear in the Activity column and the result value changes to **099** (in Hex). 291 |
292 |
293 |
295 | Input stimuli through the VIO core's probes 296 |
297 | 1. Try a few other inputs and observe the outputs. 298 | 1. Once done, set the _vio\_0\_probe\_out0_ to **0** to isolate the vio interactions with the math\_ip core. 299 | ### Setup the ILA core (hw\_ila\_1) trigger condition to 0x2 for the PYNQ-Z1/PYNQ-Z2. Make sure that the switches on the board are not set at x3 (for PYNQ-Z1/PYNQ-Z2). Set the trigger equation to be ==, and arm the trigger. Click on the Resume button in the SDK to continue executing the program. Change the switches and observe that the hardware core triggers when the preset condition is met. 300 | 1. Select the **hw\_ila\_1** in the _Dashboard Options_ panel. 301 | 1. Add the LEDs to the _Basic Trigger Setup_, and set the trigger condition of the _hw\_ila\_1_ to trigger at LED output value equal to **0x5** for the PYNQ-Z1/PYNQ-Z2. 302 |
303 |
304 |
306 | Setting up Trigger for hw_ila_1 307 |
308 | 1. Ensure that the trigger position for the _hw\_ila\_1_ is set to **512**. 309 | 310 | Make sure that the switches are not set to 11 (PYNQ-Z1/PYNQ-Z2) as this is the exit pattern. 311 | 312 | 1. Right-click on the _hw\_ila\_1_ in the _hardware_ window, and arm the trigger by selecting **Run Trigger.** 313 | 314 | The hardware analyzer should be waiting for the trigger condition to occur. 315 | 316 | 1. In the SDK window, click on the _Resume_ button. 317 | 1. Press the push-buttons and see the corresponding LED turning ON and OFF. 318 | 1. When the condition is met, the waveform will be displayed. 319 |
320 |
321 |
323 | ILA waveform window after Trigger 324 |
325 | ### Cross trigger a debug session between the hardware and software 326 | 1. In Vivado, select _hw\_ila\_1_ 327 | 1. In the ILA properties, set the _Trigger mode_ to **BASIC\_OR\_TRIGG\_IN** , and the _TRIG\_OUT_ mode to **TRIGGER\_OR\_TRIG\_IN** 328 | 1. In SDK, in the C/C++ view, relaunch the software by right clicking on the lab2 project, and selecting _Debug As > Launch on Hardware (System Debugger)_. 329 | 330 | Click **OK** if prompted to reset the processor. 331 | The program will be loaded and the excution will suspend at the entry point 332 | 333 | 1. Arm the _hw\_ila\_1_ trigger. 334 | 1. In SDK continue execution of the software to the next breakpoint (line 27). 335 | 336 | When the next breakpoint in SDK is reached, return to Vivado and notice the ILA has triggered. 337 | 338 | ### Trigger the ILA and cause the software to halt 339 | 1. Click Step Over (F6) button twice to pass the current breakpoint 340 | 1. Arm the _hw\_ila\_1_ trigger 341 | 1. Resume the software (F8) until it enters the while loop 342 | 1. Verify it is executing by toggling the dip switches 343 | 1. In Vivado, arm the _hw\_ila\_1_ trigger 344 | 1. Press the push-buttons to 0x5, and notice that the application in SDK will break at some point (This point will be somewhere within the while loop) 345 | 1. Click on the **Resume** button 346 | 347 | The program will continue execution. Flip switches until it is _0x03_. 348 | 349 | 1. Click the Disconnect button () in the SDK to terminate the execution. 350 | 1. Close the SDK by selecting **File > Exit**. 351 | 1. Close the hardware session by selecting **File > Close Hardware Manager**. Click **OK**. 352 | 1. Close Vivado program by selecting **File > Exit**. 353 | 1. Turn OFF the power on the board. 354 | 355 | ## Conclusion 356 | 357 | In this lab, you added a custom core with extra ports so you can debug the design using the VIO core. You instantiated the ILA and the VIO cores into the design. You used Mark Debug feature of Vivado to debug the AXI transactions on the custom peripheral. You then opened the hardware session from Vivado, setup various cores, and verified the design and core functionality using SDK and the hardware analyzer. 358 | 359 | . -------------------------------------------------------------------------------- /lab3.md: -------------------------------------------------------------------------------- 1 | # Extending Memory Space with Block RAM 2 | 3 | ## Objectives 4 | 5 | After completing this lab, you will be able to: 6 | 7 | * Add BRAM and connect it to the processing system's AXI master port 8 | * Execute the software application having data section in the BRAM 9 | 10 | ## Steps 11 | ## Open the Project 12 | ### Open the Vivado program. Open the _lab1_ project you created earlier or use the _lab1_ project from the labsolution directory, and save the project as _lab3_. 13 | 1. Start Vivado if necessary and open either the _lab1_ project (lab1.xpr) you created earlier or the lab1 project in the _labsolutions_ directory using the **Open Project** link in the Getting Started page. 14 | 1. Select **File > Project > Save As …** to open the _Save Project As_ dialog box. Enter **lab3** as the project name. Make sure that the _Create Project Subdirectory_ and _Import All Files to the New Project_ options are checked, the project directory path is **{labs}** and click **OK**. 15 | 16 | This will create the _lab3_ directory and save the project and associated directory with lab3 name. 17 | 18 | ## Configure the Processor to Enable M\_AXI\_GP1 19 | 1. Open the Block Design and enable the M\_AXI\_GP1 interface. 20 | 1. Click **Open Block Design** in the _Flow Navigator_ pane 21 | 1. Double-click on the _Zynq processing system_ instance to open its configuration form. 22 | 1. Select _PS-PL Configuration_ in the Page Navigator window in the left pane, expand _AXI Non Secure Enablement>GP Master AXI Interface_, and click on the check-box of the **M\_AXI GP1 Interface** to enable it. 23 | 1. Select _Clock Configuration_ in the Page Navigator window in the left pane, expand _PL Fabric Clocks_ on the right, and click on the check-box of the **FCLK\_CLK1** to enable it. 24 | 1. Enter the_Requested Frequency_for the **FCLK\_CLK1** as **140.00000** MHz. 25 | 1. Click **OK** to accept the settings and close the configuration form. 26 | 27 |
28 |
29 |
31 | M_AXI_GP1 interface enabled 32 |
33 | 34 | ## Extend with BRAM 35 | ### Add an AXI BRAM Controller instance with BRAM. 36 | 1. Click the  button and search for **BRAM** in the catalog. 37 | 1. Double-click the **AXI BRAM Controller** to add an instance to the design. 38 | 1. Click on **Run Connection Automation** , and select **axi\_bram\_ctrl\_0** 39 | 1. Click on **BRAM\_PORTA** and **BRAM\_PORTB** check boxes. 40 | 1. Click **S\_AXI** , and change the _Master_ option to **/processing\_system7\_0/M\_AXI\_GP1**, change the Clock source for driving interconnect IP, Clock source for Master interface,_ and _Clock source for Salve interface_ to **/processing\_system7\_0/FCLK\_CLK1 (140 MHz)** as they all run in the same clock domain, and click **OK** 41 | 42 |
43 |
44 |
46 | Connecting AXI BRAM Controller to M_AXI_GP1 to run at faster clock speed 47 |
48 | 49 | Notice that an instance of AXI SmartConnect and Processor System Reset are added, and the M\_AXI\_GP1\_ ACLK is connected to FCLK\_CLK1. 50 | 51 |
52 |
53 |
55 | Clocking network connections 56 |
57 | 1. Double-click on the **axi\_bram\_ctrl\_0** instance to open the configuration form. 58 | 1. Set the _Data Width_ to **64**. 59 | 60 |
61 |
62 |
64 | Setting the BRAM controller data width to 64 65 |
66 | 1. Click **OK**. 67 | ### Using the Address Editor tab, set the BRAM controller size to 64KB. Validate the design. 68 | 1. Select the **Address Editor** tab and notice that the BRAM controller memory space is **8K**. 69 | 1. Click in the _Range_ column of the _axi\_bram\_ctrl\_0_ instance and set the size as **64K**. 70 | 71 |
72 |
73 |
75 | AXI BRAM space assignment 76 |
77 | 78 | Notice that the address range changed to 0x80000000-0x8000FFFF. This is in the M\_GP1 addressing space. 79 | 80 | 1. Select the _Diagram_ tab, and click on the  (Validate Design) button to make sure that there are no errors. 81 | ## Generate the Bitstream 82 | 1. Click on the **Generate Bitstream** to run the synthesis, implementation, and bit generation processes. 83 | 1. Click **Save** if prompted to save the project, and **Yes** to run the processes. Click **OK** to launch the runs. 84 | 1. When the bitstream generation process has completed successfully, click **Cancel**. 85 | ## Generate Applications in the SDK 86 | ### Export the implemented design, and start SDK 87 | 1. Export the hardware configuration by clicking **File > Export > Export Hardware…** 88 | 1. Click the box to _Include Bitstream_and click **OK** (Click _Yes_ if prompted to overwrite the previous module) 89 | 1. Launch SDK by clicking **File > Launch SDK** and click **OK** 90 | 1. Right-click on the **lab1** and **standalone\_bsp\_0** and **system\_wrapper\_hw\_platfrom\_0** projects in the Project Explorer view and select **close project**. 91 | ### Create an empty application project, named lab3, and import the provided lab3.c file. 92 | 1. Select **File > New** > **Application Project.** 93 | 1. In the _Project Name_ field, enter **lab3** as the project name. 94 | 1. Use the default settings to create a new BSP and click **Next.** 95 | 1. Select the **Empty Application** template and click **Finish.** 96 | 97 | The lab3 and lab3\_bsp projects will be created in the Project Explorer window of SDK. 98 | 99 | 1. Select **lab3 > src** directoryin the project view, right-click, and select **Import.** 100 | 1. Expand the **General** category and double-click on **File System.** 101 | 1. Browse to **{sources}\lab3** folder. 102 | 1. Select **lab3.c** and click **Finish.** 103 | 104 | A snippet of the source code is shown in the following figure. It shows that we write a pattern to the LED port and execute a software delay loop. Repeat for 16 times. It also shows the code (greyed) which will be used in Lab5. 105 | 106 |
107 |
108 |
110 | Source Code 111 |
112 | 113 | ## Test in Hardware 114 | ### Connect and power up the board. Establish the serial communication using the SDK Terminal tab. Program the FPGA. 115 | 1. Connect and power up the board. 116 | 1. In SDK, select **Xilinx > Program FPGA** and click the **Program** button to program the FPGA. 117 | 1. Select the  tab. If it is not visible then select **Window > Show view > Terminal**. 118 | 1. Click on  to initiate the serial connection and select the appropriate COM port (depending on your computer). Configure it with 115200 baud rate. 119 | ### Run the lab3 application. 120 | 1. Select the **lab3** project in _Project Explorer_, right-click and select **Run As > Launch on Hardware (System Debugger).** Click **Yes** to terminate the previous run. 121 | 122 | The application (lab3.elf) will be downloaded into the target device, execute ps7\_init, and execute. 123 | 124 | 1. You should see the on-board LEDs changing patterns at roughly a one second delay rate. 125 | ### Modify the linker scipt to use the ps7\_ddr\_0 for the code and data sections, and the BRAM for the Heap and Stack segments. Change the loop limit from 99999999 to 999999. Execute the program. 126 | 1. Select the **lab3** application in the _Project Explorer_ view. 127 | 1. Right-click and select **Generate Linker Script**. 128 | 1. Change the _code_ and _Data_ sections to **ps7\_ddr\_0** and the _Heap and Stack_ segment memory to **axi\_bram\_ctrl\_0\_Mem0.** 129 | 1. Click the **Generate** button. 130 | 1. Click the **Yes** button to overwrite. 131 | 1. Change the loop limit from 99999999 to **9999999**. Save changes so the program recompiles. 132 | 1. Select the **lab3** project in _Project Explorer_, right-click and select **Run As > Launch on Hardware (System Debugger).** 133 | 134 | Click OK to terminate the exisiting run and relaunch if shown. 135 | 136 | 1. You should see the on-board LEDs changing patterns very slowly (about 5 seconds). 137 | 1. Change the loop limit from 9999999 to **999999**. Save changes so the program recompiles. 138 | 1. Select the **lab3** project in _Project Explorer_, right-click and select **Run As > Launch on Hardware (System Debugger).** 139 | 140 | Click Yes to terminate the existing run. 141 | 142 | 1. You should see the on-board LEDs changing patterns relatively faster (about 1 seconds). 143 | 1. Close the SDK program by selecting **File > Exit**. 144 | 1. Close the Vivado program by selecting **File > Exit.** 145 | 1. Turn OFF the power on the board. 146 | 147 | ## Conclusion 148 | 149 | This lab led you through adding BRAM memory in the PL section thereby extending the total memory space available to the PS. You have verified the functionality by creating an application, targeting the stack and heap sections to the added BRAM, and executing the application. 150 | -------------------------------------------------------------------------------- /lab4.md: -------------------------------------------------------------------------------- 1 | # Direct Memory Access using CDMA 2 | 3 | ## Objectives 4 | 5 | After completing this lab, you will be able to: 6 | 7 | * Enable a High Performance (HP) port of the processing system 8 | * Add and connect the CDMA controller in the programmable logic 9 | * Perform DMA operation between various memories 10 | 11 | ## Steps 12 | ## Open the Project 13 | ### Open the Vivado program. Open the _lab3_ project you created earlier or use the _lab3_ project from the labsolutions directory, and save the project as _lab4_. 14 | 1. Start Vivado if necessary and open either the lab3 project (lab3.xpr) you created earlier or the lab3 project in the labsolution directory using the **Open Project** link in the Getting Started page. 15 | 1. Select **File > Project > Save As …** to open the _Save Project As_ dialog box. Enter **lab4** as the project name. Make sure that the _Create Project Subdirectory_ option is checked, the project directory path is **{labs}** and click **OK**. 16 | 1. This will create the lab4 directory and save the project and associated directory with lab4 name. 17 | ## Configure the Processor to Enable S\_AXI\_HP0 18 | ### Open the Block Design and enable the S\_AXI\_HP0 interface 19 | 1. Click **Open Block Design** in the _Flow Navigator_ pane 20 | 1. Double-click on the _Zynq processing system_ instance to open its configuration form. 21 | 1. Select _PS-PL Configuration_ in the Page Navigator window in the left pane, expand _HP Slave AXI Interface_ on the right, and click on the check-box of the **S AXI HP0 Interface** to enable it, and click **OK** to close the Configuration window. 22 | ## Add CDMA and BRAM 23 | ### Instantiate the AXI central DMA controller. 24 | 1. Click the  button and search for **Central** in the catalog. 25 | 1. Double-click the **AXI Central Direct Memory Access** to add an instance to the design. 26 | 1. Double-click on the _axi\_cdma\_0_ instance and uncheck the _Enable Scatter Gather_ option. 27 | 1. Change the _Write/Read Data Width_ to **64** and click **OK**. 28 | 29 | Note the burst size changes from 16 to 8. You can increase this up to 256 to improve the performance. Here we are using smallest number since the application allows small number of words transfer. 30 | 31 | ### Run connection automation 32 | 33 | Connection automation could be run on all unconnected ports simultaneously. For the purposes of this lab, each port will be connected separately so that the changes made by the automation process are easier to follow. 34 | 35 | 1. Click on **Run Connection Automation** and select **processing\_system7\_0/S\_AXI\_HP0** 36 | 1. Check that this port will be connected to the _/axi\_cdma\_0/M\_AXI_ port and click **OK**. 37 |
38 |
39 |
41 | Connection automation 42 |
43 | 1. Verify the CDMA connection through the AXI SmartConnect to the HP0 port 44 |
45 |
46 |
48 | Connecting AXI Central DMA controller to S_AXI_HP0 49 |
50 | Notice that an instance of AXI SmartConnect (axi_smc_1) is added, S_AXI_HP0 of the processing_system7_0 is connected to M00_AXI of the axi_smc_1, S00_AXI of the axi_smc_1 is connected to the m\_axi of the axi_cdma_0 instance. Also, m_axi_aclk of the axi_cdma_0 is connected to the net originating from FCLK_CLK0 of the processing_system7_0. 51 | 52 | 1. Click on **Run Connection Automation** again, and select **/axi\_cdma\_0** (which includes **S\_AXI\_LITE** ). 53 | 54 | Notice that the axi\_cdma\_0/M\_AXI port is no longer available to select. This is because it was connected to the processing system in the previous step. 55 | 56 | 1. Ensure /processing\_system7\_0/_M\_AXI\_GP0_ is selected in the drop-down button and click **OK**. 57 |
58 |
59 |
61 | CDMA connected 62 |
63 | ### Instantiate another BRAM Controller and a BRAM. 64 | 1. Click the  button and search for **BRAM** in the catalog. 65 | 1. Double-click the **AXI BRAM Controller** to add an instance to the design. 66 | 1. Click on **Run Connection Automation** , and select **/axi\_bram\_ctrl\_1/S\_AXI** only. 67 | 1. For the _Master_ connection, _s_elect **axi\_cdma\_0/M\_AXI** from the dropdown box. 68 |
69 |
70 |
72 | BRAM connection automation 73 |
74 | 1. Click **OK** tomake the connection. 75 | 76 | Notice that another axi interface (M01\_AXI) is added to the axi\_smc\_1 instance and is connected to the S\_AXI interface of the axi\_bram\_ctrl\_1 instance. 77 |
78 |
79 |
81 | Connection between the new BRAM controller and the CDMA 82 |
83 | 1. Double-click the _axi\_bram\_ctrl\_1_ instance and change the _Number of BRAM Interface_ to **1**. 84 | 1. Change the _Data Width_ to **64** and click **OK**. 85 | 1. Double-click the _axi\_bram\_ctrl\_0_ instance and also change the _Number of BRAM Interface_ to **1**. Click **OK**. 86 | 1. Using the wire tool, connect the **BRAM\_PORTA** of the _axi\_bram\_ctrl\_1_ instance to the **BRAM\_PORTB** of the Block Memory Generator _axi\_bram\_ctrl\_0\_bram_ instance. 87 |
88 |
89 |
91 | Connect the second BRAM controller 92 |
93 | ### Connect the CDMA interrupt out port to the port of the processor. 94 | 1. Double-click on the _processing\_system7\_0 instance_ to open its configuration form. 95 | 1. Select _Interrupts_ in the Page Navigator window in the left pane, check the _Fabric Interrupts_ box. 96 | 1. Expand _Fabric Interrupts > PL-PS Interrupts Ports_, and click on the check-box of the **IRQ\_F2P**. 97 |
98 |
99 |
101 | Enabling the processor interrupt 102 |
103 | 1. Click **OK**. 104 | 1. Using wiring tool, connect the **cdma\_introut** to the **IRQ\_F2P** port. (Click on the _cdma\_introut_ port and drag to the _IRQ\_F2P_ port) 105 | ### Using the Address Editor tab, set the BRAM controller size to 64KB. Validate the design. 106 | 1. Select the **Address Editor** tab. 107 | 1. Expand the _axi\_cdma\_0> Data_ section, and change the memory size of _axi\_bram\_ctrl\_1_ to **64K**. 108 |
109 |
110 |
112 | Address space 113 |
114 | Figure 9. Address space 115 | 1. The design should look similar to the figure below. 116 |
117 |
118 |
120 | Completed design 121 |
122 | 1. Select the _Diagram_ tab, and click on the  (Validate Design) button to make sure that there are no errors. 123 | ## Generate the Bitstream 124 | 1. Click on the **Generate Bitstream** to run the synthesis, implementation, and bit generation processes. 125 | 1. Click **Save** to save the project, and **Yes** if prompted to run the processes. Click **OK** to launch the runs. 126 | 1. When the bitstream generation process has completed successfully, click **Cancel**. 127 | ## Generate an Application in the SDK 128 | ### Export the implemented design, and start SDK 129 | 1. Export the hardware configuration by clicking **File > Export > Export Hardware…** 130 | 1. Click the box to _Include Bitstream_and click **OK** (Click _Yes_ if prompted to overwrite a previous module) 131 | 1. Launch SDK by clicking **File > Launch SDK** and click **OK** 132 | 1. To clean the workspace, right-click on each open project except_system\_wrapper\_hw\_platform\_2_ and select close project. 133 | ### Create an empty application project, named lab4, and import the provided lab4.c file. 134 | 1. Select **File > New** > **Application Project.** 135 | 1. In the _Project Name_ field, enter **lab4** as the project name. 136 | 1. Leave the default settings to create a new _Board Support Package_ and click **Next.** 137 | 1. Select the **Empty Application** template and click **Finish.** 138 | 139 | The lab4 project will be created in the Project Explorer window of SDK. 140 | 141 | 1. Select **lab4 > src** in the project view, right-click, and select **Import.** 142 | 1. Expand the **General** category and double-click on **File System.** 143 | 1. Browse to the **{sources}\lab4** folder. 144 | 1. Select **lab4.c** and click **Finish.** 145 | ## Test in Hardware 146 | ### Connect and power up the board. Download the bitstream and program the FPGA. 147 | 1. Connect and power up the board. 148 | 1. In SDK, select **Xilinx > Program FPGA.** 149 | 1. Click the **Program** button to program the FPGA. 150 | ### Establish serial communication, and run the lab4 application from the DDR3 memory. 151 | 1. Connect the terminal by selecting the appropriate COM port and setting the Baud Rate to **115200**. 152 | 1. Run the **lab4** application **.** 153 | 154 | Follow the menu in the terminal emulator window and test transfers between various memories. 155 | 156 | 1. Select option 4 in the menu to complete the execution. 157 | 1. Close the SDK and Vivado programs by selecting **File > Exit** in each program. 158 | 1. Turn OFF the power on the board. 159 | 160 | ## Conclusion 161 | 162 | This lab led you through adding a CDMA controller to the PS so that you can perform DMA transfers between various memories. You used the high-performance port so DMA could be done between the BRAM residing in the PL section and DDR3 connected to the PS. You verified the design functionality by creating an application and executing it from the DDR3 memory. 163 | -------------------------------------------------------------------------------- /lab6.md: -------------------------------------------------------------------------------- 1 | # Profiling and Performance Tuning 2 | 3 | ## Objectives 4 | 5 | After completing this lab, you will be able to: 6 | 7 | * Setup the board support package (BSP) for profiling an application 8 | * Set the necessary compiler directive on an application to enable profiling 9 | * Setup the profiling parameters 10 | * Profile an application and analyze the output 11 | 12 | ## Steps 13 | ## Create a Vivado Project 14 | ### Launch Vivado and create an empty project, called lab6, targeting the PYNQ-Z1 or PYNQ-Z2 boards and using the Verilog language. 15 | 1. Open Vivado and create a new project new project call _lab6_ in the **{labs}** directory. 16 | 1. Select the **RTL Project** option in the _Project Type_ form, and click **Next**. 17 | 1. Select **Verilog** as the _Target Language_ in the _Add Sources_ form, and click **Next**. 18 | 1. Click **Next** two times. 19 | 1. In the _Default Part_ form, click on _Boards_ filter and Select **www.digilentinc.com** for the _PYNQ-Z1_ board, **tul.com.tw** for the _PYNQ-Z2_ board in the Vendor field, select _PYNQ-Z1__or pynq-z2_, and click **Next**. 20 | 1. Click **Finish** to create an empty Vivado project. 21 | ### Set the project settings to include provided fir\_top IP 22 | 1. Click **Settings** in the _Flow Navigator_ pane. 23 | 1. Expand **IP** in the left pane of the _Project Settings_ form. 24 | 1. Click Repository and using "minus" button remove entries, if any. 25 | 1. Click on the "plus" button, browse to **{sources}\lab6\** and click **Select**. 26 | 1. Click **OK**. 27 | 28 | The directory will be scanned and it will report one IP was detected. 29 | 30 | 1. Click **OK** twice. 31 | ## Creating the Hardware System Using IP Integrator 32 | ### Create a block design in the Vivado project using IP Integrator to generate the Zynq ARM Cortex-A9 processor based hardware system. 33 | 1. In the Flow Navigator, click **Create Block Design** under IP Integrator. 34 | 1. Name the block **system** and click **OK**. 35 | 1. Click on the  button. 36 | 1. Once the IP Catalog is open, type **zy** into the Search bar, and double click on **ZYNQ7 Processing System** entry to add it to the design. 37 | 1. Click _Run Block Automation_,and click **OK** to accept the default settings. 38 | 1. Double click on the Zynq block to open the _Customization_ window for the Zynq processing system. 39 | 40 | A block diagram of the Zynq should now be open, showing various configurable blocks of the Processing System. 41 | 42 | ### Configure the I/O Peripherals block to only have UART 0 support. 43 | 1. Click on the _MIO Configuration_ panel to open its configuration form. 44 | 1. Expand the _I/O Peripherals_ on the right. 45 | 1. Uncheck _ENET 0_, _USB 0_, and _SD 0_, _GPIO (GPIO MIO)_, leaving _UART 0_ selected. 46 | 1. Click **OK**. 47 | 48 |
49 |
50 |
52 | ZYNQ Processing System configured block 53 |
54 | 55 | ## Add FIR Core to the System 56 | ### Instantiate the provided FIR core twice naming the instances as fir\_left and fir\_right. Validate the design. 57 | 1. Click the  button and search for **fir** in the catalog. 58 | 1. Double-click on the **fir\_top\_v1\_0** to add the IP instance to the system 59 | 1. Select the _fir\_top\_1_ instance and change its name to **fir\_left** in its property form. 60 | 1. Click the  button and search for **fir** in the catalog. 61 | 1. Double-click on the **fir\_top\_v1\_0** to add the IP instance to the system 62 | 1. Select the _fir\_top\_1_ instance and change its name to **fir\_right** in its property form. 63 | 1. Click on **Run Connection Automation** , and select **All Automation** to select _fir\_left_ and _fir\_right_ **.** 64 | 1. Click on _s\_axi\_fir\_io_ for both _fir\_left_ and _fir\_right_ and confirm that they will be automatically connected to the Zynq _M\_AXI\_GP0_ port 65 | 1. Click **OK** toconnect the two blocks to the _M\_AXI\_GP0_ 66 | 67 | The design should look similar to shown below: 68 | 69 |
70 |
71 |
73 | The completed design 74 |
75 | 76 | It is not necessary to connect the _interrupt_ signals of the _fir_ blocks. 77 | 78 | 1. Select the _Diagram_ tab, and click on the  (Validate Design) button to make sure that there are no errors. 79 | 80 | Ignore warnings. 81 | 82 | ## Generate the Bitstream 83 | ### Create the top-level HDL of the embedded system, and generate the bitstream. 84 | 1. In Vivado, select the _Sources_ tab, expand the _Design Sources,_ right-click the _system.bd_ and select **Create HDL Wrapper** and click **OK**. 85 | 1. Click on the **Generate Bitstream** in the _Flow Navigator_ pane to synthesize and implement the design, and generate the bitstream. 86 | 1. Click **Save** to save the design and **Yes** to run the necessary processes. Click **OK** to launch the runs. 87 | 1. When the bitstream generation process has completed click **Cancel.** 88 | ## Export the Design to the SDK 89 | ### Export the design to the SDK, create the software BSP using the standalone operating system and enable the profiling options. 90 | 1. Export the hardware configuration by clicking **File > Export > Export Hardware…** 91 | 1. Tick the box to _Include Bitstream_, and click **OK** 92 | 1. Launch SDK by clicking **File > Launch SDK** and click **OK** 93 | 1. In SDK, select **File** > **New** > **Board Support Package.** 94 | 1. Notice **Standalone\_bsp\_0** in the **Project name** field and click **Finish** with default settings. 95 | 96 | A Board Support Package Settings window will appear. 97 | 98 | 1. Select the **Overview > standalone** entry in the left pane, click on the drop-down arrow of the _enable\_sw\_intrusive\_profiling Value_ field and select **true**. 99 | 100 |
101 |
102 |
104 | Enable profiling in the board support package 105 |
106 | 107 | 1. Select the **Overview > drivers > cpu\_cortexa9** and add **–pg** in the _extra\_compiler\_flags__Value_ field. 108 | 109 |
110 |
111 |
113 | Adding profiling switch 114 |
115 | 116 | 1. Click **OK** to accept the settings and create the BSP. 117 | ## Create the Application 118 | ### Create the _lab6_ application using the provided lab6.c, fir.c, fir.h, fir\_coef.dat, and xfir\_fir\_io.h files. 119 | 1. Select **File** > **New** > **Application Project.** 120 | 1. Enter **lab6** as the project name, select the **Use existing** _standalone\_bsp\_0_ option, and click **Next**. 121 | 1. Select **Empty Application** in the _Available Templates_ pane and click **Finish**. 122 | 1. In the _lab6_ project, right click on the _src_ directory and select **Import.** 123 | 1. Expand the General folder and double-click on **File system,** and browse to the **{sources}\lab6** directory. 124 | 1. Select **fir\_coef.dat, fir.c, fir.h, lab6.c,** and **xfir\_fir\_io.h,** and click **Finish.** 125 | 126 | The program should compile successfully and generate the lab6.elf file. 127 | 128 | 1. Open the _lab6.c_ file and scroll to the main function at the bottom. Notice the following code: 129 | 130 |
131 |
132 |
134 | Source code snippet 135 |
136 | 137 | The function _fir\_software_( ) function is a software implementation of the FIR function. The _filter\_hw\_accel\_input_( ) function offloads the FIR function to the two FIR blocks that have been implemented in the PL. 138 | 139 | ## Run the Application and Profile 140 | ### Place the board into the JTAG boot up mode. Program the PL section and run the application using the user defined SW\_PROFILE symbol. 141 | 1. Place the board in the JTAG boot up mode. 142 | 1. Power ON the board. 143 | 1. Select **Xilinx > Program FPGA** and click on **Program**. 144 | 1. Right click on the _lab6 directory_, and select **C/C++ Build Settings**. 145 | 5. 146 | 1. Under the **ARM v7 gcc compiler** group, select the **Symbols** sub-group **,** click on the  button to open the value entry form, enter **SW\_PROFILE** , and click **OK**. 147 | 148 | This will allow us to profile the software loop of the FIR application. 149 | 150 |
151 |
152 |
154 | Add user-defined symbol 155 |
156 | 157 | 1. Under the **ARM v7 gcc compiler** group, select the **Profiling** sub-group, then check the **Enable Profiling** box, and click **OK**. 158 | 159 |
160 |
161 |
163 | Compiler setting for enabling profiling 164 |
165 | 166 | 1. From the menu bar, Select **Run > Run Configurations…** and double click on _Xilinx C/C++ application (System Debugger)_ to create a new configuration. 167 | 1. Click on the newly created **lab6 Debug** configuration, and select the **Application** tab. 168 | 1. Click on the _Advance Options_ **Edit…** button. 169 | 1. Click on the _Enable Profiling (gprof)_ check box, enter **100000** (100 kHz) in the Sampling Frequency field, enter **0x10000000** in the scratch memory address field, and click **OK**. 170 | 171 |
172 |
173 |
175 | Profiling options 176 |
177 | 178 | 1. Click **Apply** and then click the **Run** button to download the application and execute it. 179 | 180 | The program will run. 181 | 182 | ### Analyze the results. 183 | 1. When execution is completed, the Gmon File Viewer dialog box will appear showing _lab6.elf_ as the corresponding binary file. Click **OK**. 184 | 1. Click on the **Sort samples per function** button () 185 | ). 186 | 1. Click in the **%Time** column to sort in the descending order. 187 | 188 | Note that the fir\_software routine is called 60 times, 22 samples were taken during the profiling, and on an average of 3.333 (PYNQ-Z1) or 3.666 (PYNQ-Z2/PYNQ-Z2)microseconds were spent per call. 189 | 190 |
191 |
192 |
194 | Sorting results 195 |
196 | 197 | 1. Go back to the _Run Configuration_, and change the sampling frequency to **1000000** (1 MHz) and profile the application again. 198 | 1. When execution is completed, click **OK** and the gprof viewer will be updated. 199 | 1. Invoke **gprof** , select the **Sorts samples per function** output, and sort the **%Time** column. 200 | 201 | Notice that the output has better resolution and reports more functions and more samples per function calls. Note that the number of calls to the fir\_software function has not changed but the number of samples taken increased, and the average time spent per call is 5.250 (PYNQ-Z1) or 5.016 (PYNQ-Z2) microseconds in the figure below. 202 | 203 |
204 |
205 |
207 | Profiled results with 1 MHz sampling frequency 208 |
209 | 210 | At this stage, the designer of the system would decide if the FIR function should be ported to hardware. 211 | 212 | ### Profile the application using the hardware FIR filter IP by removing the user defined SW\_PROFILE symbol. 213 | 1. Select the _lab6_ application, right-click, and select **C/C++ Build Settings**. 214 | 1. Under the **ARM v7 gcc compiler** group, select the **Symbols** sub-group **,** select **SW\_PROFILE** , and delete it by clicking on the delete button. 215 | 216 | This will allow us to profile the hardware IP of the FIR application. 217 | 218 | 1. Click **Apply** , and then click **OK** 219 | 1. Select **Run > Run Configurations** and click the **Run** button to profile the application again and click **OK** when profiling completes. 220 | 221 | Notice that the output now shows filter\_hw\_accel\_input function call instead of the fir\_software function call. Note that the average time spent per call is much less as the filtering is done in the hardware instead of the software. 222 | 223 | 1. Close the SDK and Vivado programs by selecting **File > Exit** in each program. 224 | 1. Turn OFF the power on the board. 225 | 226 | ## Conclusion 227 | 228 | This lab led you through enabling the software BSP and the application settings for the profiling. You went through creating the hardware which included the hardware IP and was later profiled in the application. You analyzed the profiled application output. -------------------------------------------------------------------------------- /slides/01_Class_Intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/01_Class_Intro.pdf -------------------------------------------------------------------------------- /slides/11_Embedded_System_Design_Review.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/11_Embedded_System_Design_Review.pdf -------------------------------------------------------------------------------- /slides/11a_Lab1_Intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/11a_Lab1_Intro.pdf -------------------------------------------------------------------------------- /slides/12_Advanced_Zynq_Architecture.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/12_Advanced_Zynq_Architecture.pdf -------------------------------------------------------------------------------- /slides/13_System_Debugging.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/13_System_Debugging.pdf -------------------------------------------------------------------------------- /slides/13a_Lab2_Intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/13a_Lab2_Intro.pdf -------------------------------------------------------------------------------- /slides/14_Memory_Interfacing.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/14_Memory_Interfacing.pdf -------------------------------------------------------------------------------- /slides/14a_Lab3_Intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/14a_Lab3_Intro.pdf -------------------------------------------------------------------------------- /slides/15_Interrupts.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/15_Interrupts.pdf -------------------------------------------------------------------------------- /slides/16_Low_Latency_High_Bandwidth.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/16_Low_Latency_High_Bandwidth.pdf -------------------------------------------------------------------------------- /slides/16a_Lab4_Intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/16a_Lab4_Intro.pdf -------------------------------------------------------------------------------- /slides/17_Configuration_and_Bootloading.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/17_Configuration_and_Bootloading.pdf -------------------------------------------------------------------------------- /slides/17a_Lab5_Intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/17a_Lab5_Intro.pdf -------------------------------------------------------------------------------- /slides/18_Profiling_and_Performance_Improvement.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/18_Profiling_and_Performance_Improvement.pdf -------------------------------------------------------------------------------- /slides/18a_Lab6_Intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/slides/18a_Lab6_Intro.pdf -------------------------------------------------------------------------------- /sources/lab1/lab1.c: -------------------------------------------------------------------------------- 1 | #include "xparameters.h" 2 | #include "xgpio.h" 3 | #ifdef MULTIBOOT 4 | #include "xdevcfg.h" 5 | #endif 6 | 7 | //==================================================== 8 | int main (void) 9 | { 10 | 11 | XGpio sws, leds, btns; 12 | int i, sws_check, btns_check; 13 | 14 | xil_printf("-- Start of the Program --\r\n"); 15 | 16 | // AXI GPIO switches Initialization 17 | XGpio_Initialize(&sws, XPAR_SWITCHES_DEVICE_ID); 18 | XGpio_SetDataDirection(&sws, 1, 0xffffffff); // input 19 | // AXI GPIO leds Initialization 20 | XGpio_Initialize(&leds, XPAR_LEDS_DEVICE_ID); 21 | XGpio_SetDataDirection(&leds, 1, 0); // output 22 | // AXI GPIO buttons Initialization 23 | XGpio_Initialize(&btns, XPAR_BUTTONS_DEVICE_ID); 24 | XGpio_SetDataDirection(&btns, 1, 0xffffffff); // input 25 | 26 | xil_printf("-- Press any of BTN0-BTN3 to see corresponding output on LEDs --\r\n"); 27 | xil_printf("-- Set slide switches to 0x03 to exit the program --\r\n"); 28 | 29 | while (1) 30 | { 31 | btns_check = XGpio_DiscreteRead(&btns, 1); 32 | XGpio_DiscreteWrite(&leds, 1, btns_check); 33 | sws_check = XGpio_DiscreteRead(&sws,1); 34 | if((sws_check & 0x03)==0x03) 35 | break; 36 | for (i=0; i<9999999; i++); // delay loop 37 | } 38 | xil_printf("-- End of Program --\r\n"); 39 | #ifdef MULTIBOOT 40 | // Driver Instantiations 41 | XDcfg XDcfg_0; 42 | u32 MultiBootReg = 0; 43 | #define PS_RST_CTRL_REG (XPS_SYS_CTRL_BASEADDR + 0x200) 44 | #define PS_RST_MASK 0x1 /* PS software reset */ 45 | #define SLCR_UNLOCK_OFFSET 0x08 46 | 47 | // Initialize Device Configuration Interface 48 | XDcfg_Config *Config = XDcfg_LookupConfig(XPAR_XDCFG_0_DEVICE_ID); 49 | XDcfg_CfgInitialize(&XDcfg_0, Config, Config->BaseAddr); 50 | 51 | MultiBootReg = 0; // Once done, boot the master image stored at 0xfc00_0000 52 | Xil_Out32(0xF8000000 + SLCR_UNLOCK_OFFSET, 0xDF0DDF0D); // unlock SLCR 53 | XDcfg_WriteReg(XDcfg_0.Config.BaseAddr, XDCFG_MULTIBOOT_ADDR_OFFSET, MultiBootReg); // write to multiboot reg 54 | // synchronize 55 | __asm__( 56 | "dsb\n\t" 57 | "isb" 58 | ); 59 | Xil_Out32(PS_RST_CTRL_REG, PS_RST_MASK); 60 | #endif 61 | return 0; 62 | } 63 | 64 | -------------------------------------------------------------------------------- /sources/lab2/iladata.ila: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xupgit/Advanced-Embedded-System-Design-Flow-on-Zynq/52c766722897b0635d7df68a9a36e1ba011bd7a9/sources/lab2/iladata.ila -------------------------------------------------------------------------------- /sources/lab2/lab2.c: -------------------------------------------------------------------------------- 1 | #include "xparameters.h" 2 | #include "xgpio.h" 3 | #include "xil_io.h" 4 | 5 | //==================================================== 6 | int main (void) 7 | { 8 | 9 | XGpio sws, leds, btns; 10 | int i, sws_check, btns_check; 11 | 12 | xil_printf("-- Start of the Program --\r\n"); 13 | 14 | // AXI GPIO switches Initialization 15 | XGpio_Initialize(&sws, XPAR_SWITCHES_DEVICE_ID); 16 | XGpio_SetDataDirection(&sws, 1, 0xffffffff); // input 17 | // AXI GPIO leds Initialization 18 | XGpio_Initialize(&leds, XPAR_LEDS_DEVICE_ID); 19 | XGpio_SetDataDirection(&leds, 1, 0); // output 20 | // AXI GPIO buttons Initialization 21 | XGpio_Initialize(&btns, XPAR_BUTTONS_DEVICE_ID); 22 | XGpio_SetDataDirection(&btns, 1, 0xffffffff); // input 23 | 24 | Xil_Out32(XPAR_MATH_IP_0_BASEADDR, 0x12); 25 | Xil_Out32(XPAR_MATH_IP_0_BASEADDR+4, 0x34); 26 | i=Xil_In32(XPAR_MATH_IP_0_BASEADDR); 27 | xil_printf("result=%x\r\n",i); 28 | 29 | while (1) 30 | { 31 | btns_check = XGpio_DiscreteRead(&btns, 1); 32 | XGpio_DiscreteWrite(&leds, 1, btns_check); 33 | sws_check = XGpio_DiscreteRead(&sws,1); 34 | if((sws_check & 0x03)==0x03) 35 | break; 36 | for (i=0; i<9999999; i++); // delay loop 37 | } 38 | xil_printf("-- End of Program --\r\n"); 39 | 40 | return 0; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /sources/lab2/lab2_pynqz1.xdc: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | # LED constraints # 3 | ######################################################## 4 | 5 | set_property IOSTANDARD LVCMOS33 [get_ports {leds[3]}] 6 | set_property IOSTANDARD LVCMOS33 [get_ports {leds[2]}] 7 | set_property IOSTANDARD LVCMOS33 [get_ports {leds[1]}] 8 | set_property IOSTANDARD LVCMOS33 [get_ports {leds[0]}] 9 | 10 | set_property PACKAGE_PIN M14 [get_ports {leds[3]}] 11 | set_property PACKAGE_PIN N16 [get_ports {leds[2]}] 12 | set_property PACKAGE_PIN P14 [get_ports {leds[1]}] 13 | set_property PACKAGE_PIN R14 [get_ports {leds[0]}] 14 | -------------------------------------------------------------------------------- /sources/lab2/lab2_pynqz2.xdc: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | # LED constraints # 3 | ######################################################## 4 | 5 | set_property IOSTANDARD LVCMOS33 [get_ports {leds[3]}] 6 | set_property IOSTANDARD LVCMOS33 [get_ports {leds[2]}] 7 | set_property IOSTANDARD LVCMOS33 [get_ports {leds[1]}] 8 | set_property IOSTANDARD LVCMOS33 [get_ports {leds[0]}] 9 | 10 | set_property PACKAGE_PIN M14 [get_ports {leds[3]}] 11 | set_property PACKAGE_PIN N16 [get_ports {leds[2]}] 12 | set_property PACKAGE_PIN P14 [get_ports {leds[1]}] 13 | set_property PACKAGE_PIN R14 [get_ports {leds[0]}] 14 | -------------------------------------------------------------------------------- /sources/lab2/lab2_user_logic.vhd: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------------- 2 | -- Module Name: lab2_user_logic 3 | -- Description: 8 Bit Adder with vio input capabilities 4 | ---------------------------------------------------------------------------------- 5 | library IEEE; 6 | use IEEE.STD_LOGIC_1164.ALL; 7 | use ieee.std_logic_arith.all; 8 | use ieee.std_logic_unsigned.all; 9 | 10 | -- Uncomment the following library declaration if using 11 | -- arithmetic functions with Signed or Unsigned values 12 | use IEEE.NUMERIC_STD.ALL; 13 | 14 | -- Uncomment the following library declaration if instantiating 15 | -- any Xilinx primitives in this code. 16 | --library UNISIM; 17 | --use UNISIM.VComponents.all; 18 | 19 | entity lab2_user_logic is 20 | Port ( ain : in STD_LOGIC_VECTOR (7 downto 0); 21 | bin : in STD_LOGIC_VECTOR (7 downto 0); 22 | ain_vio : in STD_LOGIC_VECTOR (7 downto 0); 23 | bin_vio : in STD_LOGIC_VECTOR (7 downto 0); 24 | Clk : in STD_LOGIC; 25 | sel : in STD_LOGIC; 26 | Reset_n : in STD_LOGIC; 27 | result : out STD_LOGIC_VECTOR (8 downto 0)); 28 | end lab2_user_logic; 29 | 30 | architecture Behavioral of lab2_user_logic is 31 | 32 | signal ain_i : std_logic_vector (7 downto 0); 33 | signal bin_i : std_logic_vector (7 downto 0); 34 | 35 | begin 36 | 37 | ain_i <= ain_vio WHEN sel='1' ELSE ain; 38 | bin_i <= bin_vio WHEN sel='1' ELSE bin; 39 | 40 | ADD_PROC : process( Clk ) is 41 | begin 42 | 43 | if Clk'event and Clk = '1' then 44 | if Reset_n = '0' then 45 | result <= (others => '0'); 46 | else 47 | result <= ('0' & ain_i) +('0' & bin_i); 48 | end if; 49 | end if; 50 | 51 | end process ADD_PROC; 52 | 53 | end Behavioral; 54 | 55 | -------------------------------------------------------------------------------- /sources/lab2/math_ip/math_ip.data/constrs_1/fileset.xml: -------------------------------------------------------------------------------- 1 | 2 |