Lab 05
Lab 05
Objectives
After completing this lab, you will be able to:
Add the VIO core in the design
Use VIO to insert stimulus and monitor the response
Mark nets to debug so the AXI transactions can be monitored
Add the ILA core in Vivado
Perform hardware debugging using the hardware analyzer
Perform software debugging using the SDK
Perform cross-triggering between the hardware analyzer and the software debugger
Procedure
This lab is separated into steps that consist of general overview statements providing information on the
subsequent detailed instructions. Follow the (step-by-step) detailed instructions to progress through the lab.
Design Description
In this lab, you will add a custom core that performs a simple 8-bit addition function. The core used was
developed previously using the IP Packager capability of Vivado and is provided as part of the lab source
files. The core has additional ports so that stimuli can be brought in and the response can be monitored.
This way the core can be tested independently without using the PS or software application. The following
block diagram represents the completed design (Figure 1).
1-1-1. Start the Vivado if necessary and open either the lab4 project you created in the previous lab or
the lab4 project in the labsolution directory using the Open Project link in the Getting Started
page.
1-1-2. Select File > Save Project As … to open the Save Project As dialog box. Enter lab5 as the
project name. Make sure that the Create Project Subdirectory option is checked, the project
directory path is c:\xup\sys_design\labs\ and click OK.
This will create the lab5 directory and save the project and associated directory with lab5 name.
1-1-5. Click on the Green Plus button, browse to <2015_2_zynq_sources>\lab5_zed\math_ip for the
ZedBoard or <2015_2_zynq_sources>\lab5_zybo\math_ip for the Zybo and click Select.
2-1-1. Click Open Block Design in the Flow Navigator pane, and select system.bd to open the block
diagram.
2-1-2. Click the Add IP icon and search for math in the catalog.
2-1-3. Double-click the math_ip_v1_0 to add an instance of the core to the design
The custom IP consists of a hierarchical design with the lower-level module performing the
addition. The higher-level module includes the two slave registers.
3-1-3. Click on the PS-PL Cross Trigger interface check box to Enable PL cross trigger signals to PS
and vice-versa.
3-1-4. Expand the PS-PL Cross Trigger interface and select CPU0 DBG REQ for Cross Trigger Input0
under the Input Cross Trigger section, and CPU0 DBG ACK for Cross Trigger Output0 under the
Output Cross Trigger section.
Notice that the TRIGGER_IN_0 and TRIGGER_OUT_0 interfaces are added on the processor
block.
3-2. Add the ILA core in the native mode with the cross trigger capability
enabled and connect it to the LED output port.
3-2-1. Click the Add IP icon and search for ila in the catalog.
3-2-2. Double-click on the ILA (Integrated Logic Analyzer) to add an instance of it. The ila_0 instance
will be added with the AXI slot interface.
The AXI slot interface allows you to monitor any AXI4Lite or AXI4 interface. We will not use it for
this lab.
3-2-3. Double-click on the ila_0 instance and select the Monitor Type as Native.
3-2-4. Click on the check boxes of Trigger Out Port, and Trigger In Port as we want to perform cross-
triggering.
3-2-6. Set the Probe Width of PROBE0 to 8 for the ZedBoard or 4 for the Zybo, and click OK.
3-3. Add the VIO core and connect it to the math_ip ports.
3-3-1. Click the Add IP icon and search for vio in the catalog
3-3-2. Double-click on the VIO (Virtual Input/Output) to add an instance of it. The vio_0 instance will
be added.
3-3-4. Set the Output Probe Count to 3 and the Input Probe Count to 1 in the General Options tab.
3-3-5. Select the PROBE_IN Ports tab and set the PROBE_IN0 width to 9.
3-3-6. Select the PROBE_OUT Ports tab and set PROBE_OUT0 width to 1, PROBE_OUT1 width to 8,
and PROBE_OUT2 width to 8.
3-3-8. Connect the VIO instance’s ports to the math instance ports as follows:
3-3-9. Connect the CLK port of the vio_1 to FCLK_CLK0 port of the processing_system7_0 instance.
3-4. Mark Debug the S_AXI connection between the AXI Interconnect and
math_0 instance. Validate the design.
3-4-1. Select the S_AXI connection between the AXI Interconnect and the math_ip_0 instance.
3-4-2. Right-click and select Mark Debug to monitor the AXI4Lite transactions.
3-4-3. Select Tools > Validate Design to run the design rules checker.
Verify that there are no unmapped addresses shown in the Address Editor tab.
4-1-1. In the sources view, right-click on the block diagram file, system.bd, and select Generate
Output Products… to generate the IP-level HDL and associated files. Click Generate.
4-1-4. Click OK to run the synthesis process (click Save to save the project if prompted).
4-1-5. When the synthesis is completed, select the Open Synthesized Design option and click OK.
4-2-1. The synthesized design will be opened in the Auxiliary pane and the Debug tab will be opened in
the Console pane.
If the Debug tab is not open then select Window > Debug.
Notice that the nets which can be debugged are grouped into Assigned and Unassigned groups.
The assigned net groups include nets associated with the VIO and ILA cores, whereas the
unassigned nets group includes S_AXI related nets.
4-2-2. Right-click on the Unassigned Debug Nets and select the Set up Debug… option.
4-2-4. Click Find Nets to Add… In the dropdown menu, select MARK_DEBUG and click OK.
4-2-6. Right click on the BRESP and RRESP (which are marked as undefined and driven by GND) and
select Remove Nets.
5-1-1. Click on the Generate Bitstream to run the implementation and bit generation processes.
5-1-3. When the bitstream generation process has completed successfully, a box with three options will
appear. Click Cancel.
6-1-1. If it is not already open, click Open Block Design (under IP Integrator in the Flow Navigator)
6-1-3. Make sure that Include Bitstream option is selected and click OK, leaving the target directory set
to local project directory.
Note that system_wrapper.hdf file will be updated in the lab5.sdk directory and
system_wrapper_hw_platform_2 (since system_wrapper_hw_platform_1 folder already was present)
folder will be created when the SDK program opens. The system_wrapper_hw_platform_2 folder will
have the latest design (including led_ip) whereas system_wrapper_hw_platform_1 has the previous
design (lab4).
6-2-1. To tidy up the workspace and save unnecessary building of a project that is not being used, right
click on the lab4, lab4_bsp and the system_wrapper_hw_platform_1 projects from the
previous lab, and click Close Project, as these projects will not be used in this lab. They can be
reopened later if needed.
6-2-3. Enter lab5 as the Project Name, choose system_wrapper_hw_platform_2 as the Target
Hardware since that has the latest hardware, for Board Support Package choose Create New
(lab5_bsp will be displayed).
6-2-4. Click Next, and select Empty Application and click Finish
The lab5 project will be created in the Project Explorer window of the SDK.
6-2-5. Select lab5 > src in the project view, right-click, and select Import.
A snippet of part of the source code is shown in the following figure. It shows that we write
operands to the custom core, read the result, and print it. We will use the write transaction as a
trigger condition in the Vivado Hardware Analyzer.
6-2-9. Right click and select Toggle Breakpoint in the left border on line where xil_printf(“result=%x\r\
n”,i); appears to set a breakpoint.
7-1-2. Select the tab. If it is not visible then select Window > Show view > Terminal.
7-1-5. Click Program making sure that the appropriate hardware platform is being selected (in this case
it would be system_wrapper_hw_platform_2).
7-1-6. Select the lab5 project in Project Explorer, right-click and select Debug As > Debug
Configurations...
7-1-7. Double-click on the (TCF) Xilinx C/C++ application (System Debugger) entry in the left pane to
create the lab5 Debug configuration. Click on the Enable Cross-Triggering option, and click
Debug.
Enabling Cross-Trigger is important if a breakpoint in SDK needs to trigger ILA. You can do this only
when you create Debug Configurations. It is not done when you execute <app_name> > Debug As
Launch on Hardware (GDB/System Debugger).
The application will be downloaded, execute ps7_init, and display a dialog box asking to switch
the perspective to the Debug perspective.
7-1-8. Click Yes if prompted to change the perspective. The program execution starts and suspends at
the entry point.
7-1-9. Click on the Step Over ( ) button to execute the first statement.
7-2-2. Click on Open Hardware Manager from the Program and Debug group of the Flow Navigator
pane to invoke the analyzer.
7-2-3. Click on the Open target link and then click Auto Connect to establish the connection with the
board.
The hardware session will open showing the Debug Probes tab. If the Debug Probes tab isn’t
open, click Window > Debug Probes
The hardware session status window also opens showing that the FPGA is programmed (we did
it in SDK), there are three cores, and the two ila cores with the idle state.
7-2-4. Select either XC7Z010_1 for ZedBoard or XC7Z010_1 for Zybo, and click on the Run Trigger
Immediate button to see the signals in the waveform window.
Two waveform windows will be updated, one for each ila; one ila (hw_ila_1) is of the instantiated
ILA core and another (hw_ila_2) for the MARK DEBUG method.
7-2-5. Select all the signals under the hw_ila_2 probe in the Debug Probes window, right click, and
select Add Probes to Waveform.
7-3. Setup up for the cross-triggering, where a breakpoint in SDK will trigger the
Vivado logic analyzer.
7-3-1. Select the hw_ila_1 tab (if don’t see it then right-click on the hw_ila_1 in the Debug Probes
window and select Open Hardware Dashboard), and
Figure 16. Setting hw_ila_1 settings for the SDK triggering ILA
At this stage the settings of hw_ila_2 would look like as shown in the figure below.
Figure 19. Setting ILA – hw_ila_2 settings for the SDK triggering ILA
7-3-5. Arm both ILAs by selecting either the xc7z020_1 for the ZedBoard or the xc7z010_1 for the Zybo
in the Hardware window and clicking on the Run Trigger button.
Notice that the Idle states changes to Waiting For Trigger for both hw_ila_1 and hw_ila_2.
7-3-6. In SDK, click on the Resume ( ) button to continue executing the program.
Note that the program will execute till the breakpoint and stop. The ILAs also triggered. Zoom in
at the trigger point in the Waveform - hw_ila_2 window and observe various signals. Also
observe that there are activities on the interface after about sample 520 as the processor has
stopped executing.
7-3-7. Look at the left of the trigger position and observe the write address, write data, read address,
and read data signals. You will notice the values corresponding to the statements executed
before the breakpoint was encountered.
Figure 22. The hw_ila_2 waveform window showing pre-trigger activities and the
relationship between the processor’s trigger out and ILA trigger out for ZedBoard.
Figure 22. The hw_ila_2 waveform window showing pre-trigger activities and the
relationship between the processor’s trigger out and ILA trigger out for Zybo.
7-4. In Vivado, select the VIO Core in the Debug Probes window, add the signals
to the VIO_hw_vio_1 window, and set the vio_0_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_0_result port in the Console pane.
7-4-1. In the Debug Probes window, select hw_vio_1, right-click and select Add Probes to VIO Window
to add the signals to the VIO - hw_vio_1 window.
7-4-2. Select vio_0_probe_out0 and change its value to 1 so the math_ip core input can be controlled
via the VIO core.
7-4-3. Click on the Value field of vio_0_probe_out1 and change the value to 55 (in Hex). Similarly, click
on the Value field of vio_0_probe_out2 and change the 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).
7-4-5. Once done, set the vio_0_probe_out0 to 0 to isolate the vio interactions with the math_ip core.
This is not required in this exercise but normally you would do.
7-5. Setup up for the cross-triggering, where a desired condition in ILA stops
the execution of the program in SDK. Setup the hw_ila_1 trigger condition
to either 01010101 (x55) for ZedBoard or 0101 (x5) for Zybo. Set the
hw_ila_1 to BASIC_OR_TRIG_IN as the Trigger mode,
TRIGGER_OR_TRIG_IN as the TRIG_OUT mode. Setup the hw_ila_2 trigger
condition to system_i/ila_0_TRIG_OUT_TRIG being 1. Make sure that the
switches on the ZedBoard are not set at x55 or on the Zybo are not set at
x5. 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.
7-5-1. In the Debug Probes window, select hw_ila_1, right-click and select Add Probes to Basic Trigger
Setup.
7-5-2. Set the trigger condition of the hw_ila_1 to trigger at LED output value equal to 55 (hex) for
ZedBoard or 5 for Zybo.
7-5-5. Right-click on the system_i/ila_0_TRIG_OUT_TRIG under hw_ila_2 in the Debug Probes window
and select Add Probes to Basic Trigger Setup.
7-5-8. Arm both ILAs by selecting either xc7z020_1 on the ZedBoard or xc7z010_1 on the Zybo in the
Hardware window and clicking on the Run Trigger button.
Notice that the Idle states changes to Waiting For Trigger for both hw_ila_1 and hw_ila_2.
7-5-9. Change the slide switches and see the corresponding LED turning ON and OFF.
7-5-10. When the condition (0x55 for ZedBoard or 0x5 for Zybo) is met, the waveform will be displayed in
Vivado Logic Analyzer. In SDK, the program will stop executing at the delay loop after writing to
LED.
Figure 27. ILA_2 waveform showing the relationship between the ILA trigger out and the
processor’s trigger out as well as the interface activities for ZedBoard
Figure 27. ILA_2 waveform showing the relationship between the ILA trigger out and the
processor’s trigger out as well as the interface activities
7-5-12. Click on the Dissconect button ( ) in the SDK to terminate the execution.
7-5-14. In Vivado, close the hardware session by selecting File > Close Hardware Manager. Click OK.
7-5-15. Close Vivado program by selecting File > Exit. Click OK.
Conclusion
In this lab, you added a custom core with extra ports so you can debug the design using the VIO core.
You enabled the processor block for cross triggering and then 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, including cross-triggering, using SDK and the hardware analyzer.
.