Simulation and Debugging Techniques in Vivado IP Integrator
Simulation and Debugging Techniques in Vivado IP Integrator
This Tutorial will demonstrate how to create a custom pulse IP that can be used to reset the
Microblaze via Software in Vivado by utilising the IP packager. This IP will then be simulated using
the VSIM simulator. The IP will be added to a Microblaze design, and exported to SDK. In SDK, a
simple application will be created that will reset the Microblaze via the pulse IP. This whole system
will be again simulated. We shall then add an ILA to the pulse IP and preform a cross trigger
debugging using the SDK application. Finally, this will be run on Hardware.
Requirements:
This tutorial requires at least Vivado 2014.4. For hardware test, a KC705 is needed. However, the
board is only needed for the last two steps.
Note: There is a Zip file that accompanies this tutorial. Please download this first before continuing.
First we need to create a mechanism to reset the Microblaze. Here, we need a reset pulse that we
can control. To achieve this, we can use a simple counter in HDL that when enabled will toggle the
pulse, count to 16 ticks, toggle again. The HDL code is seen below on the right, and the
corresponding wave diagram on the left.
This IP will sit between the mb_reset on the reset IP, and a generated pulse from the GPIO. These
two reset’s, are OR’ed together. This will allow the Microblaze to be reset as normal via the reset IP,
and will allow the user the ability to reset via the software.
Once the HDL is added, select Tools -> Create and Package New IP. Select Package your current
project:
Repeat this for all the reset signals (inp, and outp)
Once you are happy with the settings, select Review and Package -> Package IP
Here, we will be creating a Testbench to test our newly created pulse IP. To add/create the
Testbench right click on Simulation Sources -> Add Sources:
The Testbench sets up the clocks, and the reset, and will simulate a reset on the mb_reset, and an
input pulse.
Once the Testbench is added, run the simulation. The results will look something similar to below:
Now that the pulse IP is created and verified in step 1, and 2. We can now proceed to create the
Microblaze system In Vivado IP Integrator. To create the Microblaze system, follow the steps below:
Create BD (IP Integrator -> Create Block Design), and name it “mb_system”
Add Microblaze from IP Catalog
o Run Block Automation
Increase Local memory from 8KB to 32KB
Double Click on Microblaze, and Enable Trace Bus Interface
Run Connection Automation
o Connect the Clock, and Reset
Add AXI GPIO from IP catalog
o Double Click on AXI GPIO
Under the IP Configuration -> GPIO
Tick All Outputs
GPIO Width = 1
o Run Block Automation -> S_AXI
o Un-tick the GPIO box
Add AXI UART
o Run Block Automation
Add Pulse IP
Once the HW is built in step 3, we can now export to SDK. Firstly, we need to Generate the output
Products, and Generate HDL wrapper:
Note: The print is commented out here, as we shall be simulating this. In the HW test, this will be re-
added
Once the application is built (the SDK will build automatically. If not, go to project -> build all)
Exit SDK
Add the ELF created in step 4 to the Vivado project simulation sources. To Associate the ELF, right
click on the ELF -> Associate ELF files…
Add the mb_sys_reset.elf as the associated ELF for the simulation Microblaze
Once the testbench is created, you need to set this as top module. To do this, right click on the
Testbench -> Set as Top
Run Simulation
The GPIO goes to 1, then back to 0. The application is effectively looping as it is continuously getting
reset. This GPIO set to 1 is creating a pulse on the pulse IP, and it is this that is resetting the
Microblaze.
Here, we shall use the Vivado logic analyser, and the SDK software debugger to perform a cross tool
debugging. We will be debugging the pulse IP to verify that the system is working as expected.
To add a net for debug, open the block design, and mark the outp_reset net. To do this, highlight the
net -> right click -> Mark Debug
Here, we shall be adding the ILA Core. Open the Debug Layout in the drop down in Vivado:
In the Debug window, you will see a list of nets in Unassigned Debug nets folder. These nets
correspond to the various signals that make up the interface connection that you marked for debug
(in our case the outp_reset):
Use the Set up Debug wizard to add the ILA debug core to the design. Here, the unassigned nets will
be assigned and connected to the ILA.
Verify that the Clock Domain is set. This will be set to undefined if not set.
Save the project. This will update the XDC file with the commands to add and configure the ILA.
Now that the debug logic has been added, we can continue to implement the project (Generate
Bitstream)
Once the bitstream is complete, Re-export to SDK. This time tick the “Include Bitstream” box
Configure the FPGA. Xilinx Tools -> Program FPGA -> Program
Highlight the application under Project Explorer and right click -> Debug As -> Debug Configurations.
Double click on Xilinx C/C++ application (System Debugger) to create a debug configuration. Select
Debug to continue. This will open the debug perspective.
Return to Vivado, without exiting the SDK in debug perspective. In the Flow Navigator in Vivado,
under the Program -> Open Hardware Manager -> Open Target -> Open New Target to open the GUI.
Select Next -> Finish to continue.
This procedure will open a logic analyser waveform window and initialise the analyser triggering
mechanisms.
In the Debug Probes window, select the outp_reset and drag and drop this into the Basic Trigger
Setup window. Set the Compare Value to 1. Also, set the Trigger position to be in the middle of the
1024 sample window by setting this to 512:
Finally, arm the ILA core by select the Run Trigger in the hardware window:
Step to
Step Over
Step into
Resume
Use the step over icon until we reach the software_reset function. Once we reach this, use the
step into icon to step into this function:
Once, we are at the line highlighted above, use the step over icon. This will set the GPIO to 1,
and will cause the outp_reset to go to 1. Once this is done, you will see the trigger was hit in Vivado:
We have verified both the IP, and how this IP operated in the Microblaze system in the previous
steps. It is now time to test on Hardware.
We should still have the FPGA configured from the last step. However, if not go to Xilinx Tools ->
Program FPGA -> Program.
Highlight the application under Project Explorer and right click -> Run As -> Run Configurations.
Double click on Xilinx C/C++ application (System Debugger) to create a run configuration. Select Run
to continue.
You will see the print statement “We expect and endless loop…” printed on the console.
This is expected, as we are constantly resetting the Microblaze, which will re-run the app, which will
reset, ect..