Ug940 Vivado Tutorial Embedded Design
Ug940 Vivado Tutorial Embedded Design
Revision History
The following table shows the revision history for this document.
Introduction
This tutorial shows how to build a basic Zynq®-7000 SoC processor and a MicroBlaze™
processor design using the Vivado® Integrated Development Environment (IDE).
In this tutorial, you use the Vivado IP Integrator to build a processor design, and then debug the
design with the Xilinx® Software Development Kit (SDK) and the Vivado Integrated Logic
Analyzer.
IMPORTANT! The Vivado IP Integrator is the replacement for Xilinx Platform Studio (XPS) for embedded
processor designs, including designs targeting Zynq-7000 SoC devices and MicroBlaze processors. XPS only
supports designs targeting MicroBlaze processors, not Zynq-7000 SoC devices.
Lab 1 shows how to graphically build a design in the Vivado IP Integrator and use the Designer
Assistance feature to connect the IP to the Zynq-7000 SoC PS.
After you construct the design, you mark nets for debugging the logic. Then you generate the
Hardware Design Language (HDL) for the design as well as for the IP. Finally, you implement the
design and generate a bitstream, then export the hardware description of the design to the
Software Development Kit (SDK). You will use the SDK software to build and debug the design
software, and learn how to connect to the hardware server (hw_server) application that SDK uses
to communicate with the Zynq-7000 SoC processors. Then you perform logic analysis on the
design with a connected board.
Design Files
The following design files are included in the zip file for this guide:
• lab1.tcl
Related Information
Locating Tutorial Design Files
Lab 1: Building a Zynq-7000 SoC Processor Design
In Lab 2, you use the SDK software to build and debug the design software, and learn how to
connect to the hardware server (hw_server) application that SDK uses to communicate with the
Zynq-7000 SoC processors. Then, use the cross-trigger feature of the Zynq-7000 SoC processor
to perform logic analysis on the design on the target hardware.
Design Files
The following design files are included in the zip file for this guide:
• lab2.tcl
Related Information
Locating Tutorial Design Files
Lab 2: Zynq-7000 SoC Cross-Trigger Design
Design Files
The following design files are included in the zip file for this guide:
• lab3.tcl
Related Information
Locating Tutorial Design Files
Lab 3: Programming an Embedded MicroBlaze Processor
Chapter 2
Introduction
In this lab you create a Zynq®-7000 SoC processor based design and instantiate IP in the
processing logic fabric (PL) to complete your design. Then you mark signals to debug in the
Vivado® Logic Analyzer. Finally, you take the design through implementation, generate a
bitstream, and export the hardware to SDK. In SDK you create a Software Application that can
be run on the target hardware. Breakpoints are added to the code to cross-probe between
hardware and software.
If you are not familiar with the Vivado Integrated Development Environment Vivado® (IDE), see
the Vivado Design Suite User Guide: Using the Vivado IDE (UG893).
4. In the Project Name dialog box, type a project name and select a location for the project files.
Ensure that the Create project subdirectory check box is checked, and then click Next.
5. In the Project Type dialog box, select RTL Project, and then click Next.
6. In the Add Sources dialog box, set the Target language to your desired language, Simulator
language to Mixed and then click Next.
7. In the Add Constraints dialog box, click Next.
8. In the Default Part dialog box, do the following:
a. Select Boards.
b. From the Board Rev drop-down list, select All to view all versions of the supported
boards.
c. Choose the version of the ZYNQ-7 ZC702 Evaluation Board that you are using.
d. Click Next.
CAUTION! Multiple versions of boards are supported in Vivado. Ensure that you are targeting the design to the
right hardware.
9. Review the project summary in the New Project Summary dialog box, and then click Finish to
create the project.
3. Click OK.
4. In the block design canvas right-click, and select Add IP.
Alternatively, you can click the Add IP button in the IP Integrator canvas.
The Run Block Automation dialog box opens, stating that the FIXED_IO and DDR interfaces
will be created for the Zynq-7000 SoC IP core. Also, note that the Apply Board Preset check
box is checked. This is because the selected target board is ZC702.
8. Ensure that both Cross Trigger In and Cross Trigger Out are disabled.
9. Click OK.
After running block automation on the Zynq-7000 SoC processor, the IP Integrator diagram
looks as follows:
Your Block Design window will look like the following figure. The relative positions of the IP
might vary.
TIP: You can zoom in and out in the Diagram Panel using the Zoom In ( or Ctrl + =) and Zoom Out ( or Ctrl
+ -) tools.
As you select each interface for which connection automation is to be run, the description
and options available for that interface appear in the right pane.
3. Click the S_AXI interface of the axi_bram_ctrl_0, and ensure that its Clock Connection
(for unconnected clks) field is set to the default value of Auto.
This value selects the default clock, FCLK_CLK0, generated by the PS7 for this interface.
4. For the GPIO interface of the axi_gpio_0 instance, select leds_4bits from the Select Board
part Interface drop down list.
5. For the S_AXI interface of axi_gpio_0 instance, leave the Clock Connection (for
unconnected clks) field to Auto.
6. Click OK.
The IP Integrator subsystem looks like the following figure. The relative positions of the IP
might differ slightly.
7. Click the Address Editor tab and expand the processing_system7_0 hierarchy to show
the memory-map of the IP in the design.
In this case, there are two IP: the AXI GPIO and the AXI BRAM Controller. The IP Integrator
assigns the memory maps for these IP automatically. You can change them if necessary.
8. Change the range of the axi_bram_ctrl_0 to 64K, as shown in the following figure.
10. Click the Regenerate Layout button to regenerate an optimal layout of the block
design.
appears, indicating that the net has been marked for debug. You can also see this in the
Design Hierarchy view, as displayed in the following figure, on the interface that you chose to
mark for debug.
When a net is marked for debug, the Designer Assistance link in the banner of the block
design canvas becomes active.
2. Click Run Connection Automation.
The All Automation is selected by default with the various options for AXI Read/Write signals
set, as shown in the following figure:
3. Click OK.
A System ILA IP is instantiated on the block design which is appropriately configured to
debug the AXI Interface marked for debug. The net marked for debug is connected to this
System ILA IP and an appropriate clock source is connected to the clk pin of the System ILA
IP. The clock source is the same clock domain to which the interface signal belongs.
4. From the toolbar, to run Design-Rules-Check (DRC), click the Validate Design button .
Alternatively, you can do the same from the menu by:
1. In the Sources window, right-click the top-level subsystem design and select Generate
Output Products. This generates the source files for the IP used in the block design and the
relevant constraints file.
You can also click Generate Block Design in the Flow Navigator to generate the output
products.
The Generate Output Products dialog box opens, as shown in the following figure.
6. Select the default option of Let Vivado manage wrapper and auto-update.
7. Click OK.
After the wrapper has been created, the Sources window looks as follows.
2. Click Yes.
The Launch Runs dialog box opens. Here you can select various options such as the Number
of Jobs, the host where the Runs are launched etc.
3. Click OK.
This will launch synthesis, implementation ,and generate the bitstream which could take a
few minutes.
After the bitstream generates, the Bitstream Generation Completed dialog box opens, as
shown in the following figure. Open Implemented Design should be checked by default.
4. Click OK.
5. When the implemented design opens, look at the Design Timing Summary window to ensure
that all timing constraints are met.
1. From the Vivado File menu, select File → Export → Export Hardware.
The Export Hardware dialog box opens.
2. Ensure that the Include Bitstream check box is checked and that the Export to field is set to
the default option of <Local to Project> as shown in the following figure:
3. Click OK.
4. To launch SDK, select File → Launch SDK .
The Launch SDK dialog box opens.
5. Accept the default selections for Exported location and Workspace, and click OK.
3. Click Next.
4. From the Available Templates, select Peripheral Tests as shown in the following figure:
5. Click Finish.
When the program finishes compiling, you see the following in the Console window.
1. Ensure that your hardware is powered on and a Digilent Cable or the USB Platform Cable is
connected to the host PC. Also, ensure that you have a USB cable connected to the UART
port of the ZC702 board.
2. Download the bitstream into the FPGA by selecting Xilinx → Program FPGA.
The Program FPGA dialog box opens.
3. Ensure that the Bitstream field shows the bitstream file that you created in Step 5, and then
click Program.
Note: The DONE LED on the board turns green if the programming is successful. You should also see
an INFO message suggesting that the FPGA was configured successfully in the SDK Log window.
13. In the Debug tab, expand the tree to see the processor core on which the program is running,
as shown in the following figure:
Add a Breakpoint
Next, add a breakpoint after the “if” statement.
TIP: If line numbers are not visible, right-click in the blue bar on the left side of the window and select Show Line
Numbers.
3. Double-click in the blue bar to the left of line 107 to add a breakpoint on that line of source
code, shown in the following figure:
Note: Sometimes the line number varies, so enter the breakpoint where appropriate.
7. First, ensure that the ILA core is active and capturing data. To do this, select the Status tab of
the hw_ila_1 in the Hardware Manager.
Expand some of the Signal Groups by clicking the + sign to see Static data from the System
ILA core in the waveform window as shown in the following figure.
9. Set up a condition that triggers when the application code writes to the GPIO peripheral. To
do this:
a. From the menu select Window → Debug Probes.
b. Select, drag, and drop the slot_0:ps7_0_axi_periph_M00_AXI:AWVALID signal
from the Debug Probes window into the Trigger Setup window.
After setting up the compare value and the trigger position, you can arm the ILA core.
11. In the Waveform window or the Status window, arm the ILA core by clicking the Run Trigger
button .
12. Notice that the Status window of the hw_ila_1 ILA core changes from:
• Idle to Waiting for Trigger.
• The Hardware window shows the Core Status as Waiting for Trigger, as shown in the
following figure.
13. Go back to the SDK and continue to execute code. To do so, click the Resume button on
the SDK toolbar.
Alternatively, you can press F8 to resume code execution.
The code execution stops at the breakpoint you set. By this time, at least one write operation
has been done to the GPIO peripheral. These write operations cause the AWVALID signal to
go from 0 to 1, thereby triggering the ILA core.
Note: The trigger mark occurs at the first occurrence of the AWVALID signal going to a 1, as shown in
the following figure.
14. If you are going on to Lab 2, close your project by selecting File → Close Project.
You can also close the SDK window by selecting File → Exit.
Conclusion
This lab introduced you to creating a Zynq-based design in IP Integrator, working with the
System ILA IP to debug nets of interest, software development in SDK and executing the code on
the Zynq-7000 SoC processor.
This lab also introduced you to the Vivado Logic Analyzer and analyzing the nets that were
marked for debug and cross-probing between hardware and software.
• Created a Vivado project that includes a Zynq-7000 SoC processor design using the IP
Integrator.
• Instantiated IP in the IP Integrator and made the necessary connections using the Designer
Assistance feature.
• Marked and connected nets for debug using the System ILA IP, to analyze them in the Vivado
Integrated Logic Analyzer.
• Synthesized, implemented, and generated the bitstream before exporting the hardware
definition to SDK.
• Created a software application in SDK and ran it on the target hardware, ZC702. By setting
breakpoint in the application code, triggered the ILA in Vivado, thereby, demonstrating the
hardware/software cross-probing ability.
Lab Files
You can use the Tcl file lab1.tcl that is included with this tutorial design files to perform all the
steps in this lab. This Tcl file only covers the Vivado portion of the design creation through
bitstream generation. Subsequent steps from Step 7 and beyond must be performed manually as
the intent is to demonstrate the cross-probing between hardware and software.
To use the Tcl script, launch Vivado and type source lab1.tcl in the Tcl console.
Alternatively, you can also run the script in the batch mode by typing Vivado -mode batch -
source lab1.tcl at the command prompt.
Note: You must modify the project path in thelab1.tcl file to source the Tcl files correctly.
Chapter 3
Introduction
In this lab, you use the cross-trigger functionality between the Zynq®-7000 SoC processor and
the fabric logic. Cross-triggering is a powerful feature that you can use to simultaneously debug
software in the SDK that is running in real time on the target hardware. This tutorial guides you
from design creation in IP integrator, to marking the nets for debug and manipulating the design
to stitch up the cross-trigger functionality.
g. Review the project summary in the New Project Summary dialog box and click Finish to
create the project.
7. In the block design banner, click Run Block Automation as shown in the following figure.
The Run Block Automation dialog box states that the FIXED_IO and the DDR pins on the
ZYNQ7 Processing System 7 IP will be connected to external interface ports. Also, because
you chose the ZC702 board as your target board, the Apply Board Preset checkbox is
checked by default.
8. Enable the Cross Trigger In and Cross Trigger Out functionality by setting those fields to
Enable, then click OK, as shown in the following figure:
This enables the TRIGGER_IN_0 and TRIGGER_OUT_0 interfaces in the ZYNQ7 Processing
System as show in the following figure.
9. Add the AXI GPIO and AXI BRAM Controller to the design by right-clicking anywhere in the
diagram and selecting Add IP.
The diagram area looks like the following figure:
10. Click the Run Connection Automation link at the top of the Diagram window.
The Run Connection Automation dialog box opens.
11. Select the All Automation (7 out of 7 selected) checkbox. This selects connection automation
for all the interfaces in the design. Select each automation to see the available options for
that automation in the right pane.
12. Make each of the following connections using the Run Connection Automation function.
axi_gpio_0 The Run Connection Automation Leave the Clock Connection (for
dialog box states that the S_AXI pin unconnected clks) field set to Auto.
• S_AXI
of the GPIO IP will be connected to
the M_AXI_GP0 pin of the ZYNQ7
Processing System. It also offers a
choice for different clock sources that
might be relevant to the design.
processing_system7_0 The Run Connection Automation Leave the ILA option to its default
dialog box states that the value of Auto for both TRIGGER_IN_0
• TRIGGER_IN_0
TRIGGER_IN_0 and TRIGGER_OUT_0 and TRIGGER_OUT_0 option.
• TRIGGER_OUT_0 pins will be connected to the
respective cross-trigger pins on the
System ILA IP.
When these connections are complete, the IP Integrator design looks like the following
figure:
13. Click the Address Editor tab of the design to ensure that addresses for the memory-mapped
slaves have been assigned properly. Expand Data. Change the range of the AXI BRAM
Controller to 64K, as shown below.
1. Click the Diagram tab again, and select the net connecting the GPIO pin of the AXI GPIO IP
to the LEDs_4Bits port.
2. Right-click in the block diagram area, and select Debug. This marks the net for debug.
Notice that a bug symbol appears on the net to be debugged. You can also see this bug
symbol in the Design Hierarchy window on the selected net.
3. Similarly, select the net connecting the interface pin S_AXI of axi_gpio_0 and the
M00_AXI interface pin of ps7_0_axi_periph.
4. Right-click in the block design and select Debug from the context menu.
Note: When you mark a net for debugging, the Designer Assistance link at the top of the block design
canvas banner becomes active.
7. Click OK.
8. Click the Regenerate Layout button to generate an optimal layout of the design. The
design should look like the following figure:
9. Click the Validate Design button to run Design Rule Checks on the design.
After design validation is complete, the Validate Design dialog box opens to verify that there
are no errors or critical warnings in the design.
10. Click OK.
11. To save the IP Integrator design, select File → Save Block Design.
Alternatively, press Ctrl + S to save the design.
12. In the Sources window, right-click the block design, zynq_processor_system, and select
Generate Output Products.
The Generate Output Products dialog box opens.
16. In the Sources window, right-click zynq_processor_system, and select Create HDL Wrapper.
The Create HDL Wrapper dialog box offers two choices:
• The first choice is to generate a wrapper file that you can edit.
• The second choice is let Vivado generate and manage the wrapper file, meaning it is a
read-only file.
17. Keep the default setting, shown in the following figure, and click OK.
1. From the Vivado File menu, select File → Export → Export Hardware.
The Export Hardware dialog box opens.
2. Ensure that the Include Bitstream check box is checked and that the Export to field is set to
the default option of <Local to Project> as shown in the following figure:
3. Click OK.
4. Select File → Launch SDK .
Make sure that both the Exported location and Workspace fields are set to <Local Project>,
as shown in the following figure:
5. Click OK.
2. Click Next.
3. From the Available Templates, select Peripheral Tests.
4. Click Finish.
5. Wait for the application to compile.
6. Make sure that you have connected the target board to the host computer and it is turned
on.
7. After the application has finished compiling, select Xilinx → Program FPGA to open the
Program FPGA dialog box.
8. In the Program FPGA dialog box, click Program.
9. Select and right-click the peri_test application in the Project Explorer, and select Debug As →
Debug Configurations.
The Debug Configurations dialog box opens.
10. Right-click Xilinx C/C++ application (System Debugger), and select New.
11. In the Create, manage, and run configurations screen, select the Target Setup tab, and select
the Enable Cross triggering check box.
15. Click OK. This sets up the cross trigger condition for Processor to Fabric.
16. In the Cross Trigger Breakpoints dialog box, click Create, as shown in the following figure.
17. In the Create Cross Trigger Breakpoint page, select the options as shown in the following
figure:
18. Click OK. This sets up the cross trigger condition for Fabric to Processor.
19. In the Cross Trigger Breakpoints Dialog box, click OK.
20. In the Debug Configurations dialog box, click Debug, as shown at the bottom of the following
figure.
24. Verify the terminal connection by checking the status at the top of the SDK Terminal tab as
shown in the following figure.
25. If it is not already open, select ../src/testperiph.c, and double click to open the source file.
26. Click the blue bar on the left side of the testperiph.c window as shown in the figure and
select Show Line Numbers.
27. Modify the source file by inserting a while statement at approximately line 97.
28. After the else statement, add while(1) above in front of the curly brace as shown in the
following figure.
29. Add a breakpoint in the code so that the processor stops code execution when the
breakpoint is encountered.
a. To do so, scroll down to the line after the “while” statement starts, and double-click the
left pane, which adds a breakpoint on that line of code, as it appears in the following
figure.
b. Click Ctrl + S to save the file. Alternatively, you can select File → Save.
1. In the Vivado IDE session, from the Program and Debug drop-down list of the Vivado Flow
Navigator, select Open Hardware Manager.
2. In the Hardware Manager window, click Open target → Open New Target.
Note: You can also use the Auto Connect option to connect to the target hardware.
The Open New Hardware Target dialog box opens, shown in the following figure.
3. Click Next.
4. On the Hardware Server Settings page, ensure that the Connect to field is set to Local server
(target is on local machine) as shown in the following figure, and click Next.
6. Ensure that all the settings are correct on the Open Hardware Target Summary dialog box, as
shown in the following figure, and click Finish.
1. Select the ILA - hw_ila_1 tab, and set the Trigger Mode Settings as follows:
• Set Trigger mode to TRIG_IN_ONLY
• Set TRIG_OUT mode to TRIG_IN_ONLY
• Under Capture Mode Settings, ensure Trigger position in window is set to 512.
3. In SDK, in the Debug window, click the Resume button in the SDK toolbar, until the
code execution reaches the breakpoint set on line 107 in the testperiph.c file.
4. As the code hits the breakpoint, the processor sends a trigger to the ILA. The ILA has been
set to trigger when it sees the trigger event from the processor. The waveform window
displays the state of various signals as seen in the following figure.
This demonstrates that when the breakpoint is encountered during code execution, the PS7
triggers the ILA that is set up to trigger. The state of a particular signal when the breakpoint is
encountered can be monitored in this fashion.
1. In SDK, select the Breakpoints tab towards the top right corner of SDK window, right-click it,
and uncheck the testperiph.c [line: 106] checkbox. This removes the breakpoint that you set
up earlier.
Note: Alternatively, you can select the breakpoint in line 107 of the testperiph.c file, right click and
select Disable Breakpoint.
2. In the Debug window, click Resume icon on the SDK toolbar. The code runs continuously
because it has an infinite loop.
You can see the code executing in the Terminal Window in SDK.
3. In Vivado, select the Settings – hw_ila_1 tab. Change the Trigger Mode to
BASIC_OR_TRIG_IN and the TRIG_OUT mode to TRIGGER_OR_TRIG_IN.
4. Click on the + sign in the Trigger Setup window to add the
slot_0:ps7_0_axi_periph_M00_AXI:AWVALID signal from the Add Probes window.
5. In the Basic Trigger Setup window, ensure that the Radix is set to [B] Binary, and change the
Value for the slot_0:ps7_0_axi_periph_M00_AXI:AWVALID signal to 1. This
essentially sets up the ILA to trigger when the awvalid transitions to a value of 1.
6. Click the Run Trigger button to “arm” the ILA. It triggers immediately as the SDK code is
running AXI transactions which causes the awvalid signal to toggle. This causes the
trigger_out of the ILA to toggle which eventually will halt the processor from executing the
code.
This is seen in SDK the in the highlighted area of the debug window.
Conclusion
This lab demonstrated how cross triggering works in a Zynq-7000 SoC processor based design.
You can use cross triggering to co-debug hardware and software in an integrated environment.
Lab Files
This tutorial demonstrates the cross-trigger feature of the Zynq-7000 SoC processor, which you
perform in the GUI environment. Therefore, the only Tcl file provided is lab2.tcl.
The lab2.tcl file helps you run all the steps all the way to exporting hardware for SDK.
The debug portion of the lab must be carried out in the GUI; no Tcl files are provided for that
purpose.
Chapter 4
Introduction
In this tutorial, you create a simple MicroBlaze™ system for a Kintex®-7 FPGA using Vivado® IP
Integrator.
• MicroBlaze processor
• AXI block RAM
• Double Data Rate 3 (DDR3) memory
• UARTLite
• GPIO
• Debug Module (MDM)
• Proc Sys Reset
• Local memory bus (LMB)
Parts of the block design are constructed using the Platform Board Flow feature.
This lab also shows the cross-trigger capability of the MicroBlaze processor.
The feature is demonstrated using a software application code developed in SDK in a stand-alone
application mode.
2. Specify the IP subsystem design name. For this step, you can use mb_subsystem as the
Design name. Leave the Directory field set to its default value of <Local to Project>. Leave
the Specify source set drop-down list set to its default value of Design Sources.
3. Click OK in the Create Block Design dialog box, shown in the following figure:
5. Type mig in the Search field to find the MIG core, then select Memory Interface Generator
(MIG 78 Series), and press Enter.
The Designer Assistance link becomes active in the block design banner.
6. Click Run Block Automation.
8. Right-click anywhere in the block design canvas, and select Add IP.
The IP catalog opens.
9. In the Search field, type micr to find the MicroBlaze IP, then select MicroBlaze, and press
Enter.
Note: The IP Details window can be displayed by clicking CTRL+Q on the keyboard.
1. Select the Board tab to see the interfaces present on the KC705 board.
In the Board window, notice that the DDR3 SDRAM interface is connected as shown by the
circle in the following figure. This is because you used the Block Automation feature in the
previous steps to connect the MIG core to the board interfaces for DDR3 SDRAM memory.
2. From the Board window, select UART under the miscellaneous folder, and drag and drop it
into the block design canvas.
This instantiates the AXI Uartlite IP on the block design.
3. Click OK in the Auto Connect dialog box.
4. Likewise, from the Board window, select LED under the General Purpose Input or Output
folder, and drag and drop it into the block design canvas.
5. Click OK in the Auto Connect dialog box.
This instantiates the GPIO IP on the block design and connects it to the on-board LEDs.
The block design now should look like the following figure.
3. Click OK.
This generates a basic MicroBlaze system in the IP Integrator diagram area, shown in the
following figure.
2. Check the interfaces in the left pane of the dialog box as shown in the following figure:
3. Use the following table to set options in the Run Connection Automation dialog box.
axi_bram_ctrl_0 Two options are presented in this The Run Connection Automation
case. The Master field can be set for dialog box offers to connect this to
• S_AXI
either cached or non-cached the /microblaze_0 (Cached). Leave it
accesses. to its default value. In case, cached
accesses are not desired this could be
changed to /microblaze_0 (Periph).
Leave the Clock Connection (for
unconnected clks) field set to its
default value of Auto.
axi_gpio_0 The Master field is set to / Keep these default settings.
microblaze_0 (Periph).
• S_AXI
The Clock Connection (for
unconnected clks) field is set to its
default value of Auto.
axi_uartlite_0 The Master field is set to its default Keep these default settings.
value of /microblaze_0 (Periph).
• S_AXI
The Clock Connection (for
unconnected clks) field is set to its
default value of Auto.
mdm_1 This will be connected to a new Leave the ILA Connection settings to
System ILA core’s TRIG_OUT pin. its default value of Auto.
• TRIG_IN_0
mdm_1 This will be connected to the System Leave the ILA Connections settings to
ILA core’sTRIG_IN pin. its default value of Auto.
• TRIG_OUT_0
4. After setting the appropriate options, as shown in the table above, click OK.
At this point, your IP integrator diagram area should look like the following figure.
5. Click OK.
The cross-trigger pins of the MDM and the AXI Interface net connecting the
microblaze_0_axi_periph Interconnect and axi_gpio_0 are connected to the System
ILA IP as shown in the following figure.
6. Click the Regenerate Layout button in the IP Integrator toolbar to generate an optimum
layout for the block design. The block diagram looks like the following figure.
a. Expand the microblaze_0 instance by clicking on the Expand All icon in the toolbar to
the top of the Address Editor window.
b. Change the range of mig_7_series_0 IP in both the Data and the Instruction section to
512 MB, as shown in the following figure.
You must also ensure that the memory in which you are going to run and store your
software is within the cacheable address range. This occurs when you enable Instruction
Cache and Data Cache, while running the Block Automation for the MicroBlaze
processor.
To use either Memory IP DDR or AXI block RAM, those IP must be in the cacheable area;
otherwise, the MicroBlaze processor cannot read from or write to them.
Validating the design will automatically re-configure the MicroBlaze processor’s cacheable
address range.
1. Click the Validate Design button on the toolbar, or select Tools → Validate Design.
The Validate Design dialog box informs you that there are no critical warnings or errors in the
design.
2. Click OK.
3. Save your design by pressing Ctrl+S, or select File → Save Block Design.
The Generate Output Products dialog box informs you that Out-of-context module runs were
launched.
3. Click OK.
4. Wait a few minutes for all the Out-of-Context module runs to finish as shown in the Design
Runs windows.
1. From the Vivado File menu, select File → Export → Export Hardware.
The Export Hardware dialog box opens.
2. Ensure that the Include Bitstream check box is checked and that the Export to field is set to
the default option of <Local to Project> as shown in the following figure:
3. Click OK.
4. Select File → Launch SDK .
The Launch SDK dialog box opens as shown in the following figure. Make sure that both the
Exported Location and the Workspace drop-down lists are set to <Local Project>.
5. Click OK.
SDK launches in a separate window.
Project.
3. Click Next.
4. Type a name (such as peri_test) for your project, and choose standalone as the OS
platform, as shown in the following figure.
5. Click Next.
6. Select the Peripheral Tests, shown in the following figure, and click Finish.
Setting these values to mig_7series_0 ensures that the compiled code executes from the
Memory IP.
10. Click Generate.
11. Click Yes to overwrite it in the Linker Already Exists! dialog box.
3. Select and right-click the peri_test application in the Project Explorer, and select Debug As →
Debug Configurations.
The Debug Configurations dialog box opens, as shown in the following figure.
4. Right-click Xilinx C/C++ application (System Debugger), and select New.
5. Click Debug.
The Confirm Perspective Switch dialog box opens, as shown in the following figure:
6. Click Yes to confirm the perspective switch.
The Debug perspective window opens.
7. Set the terminal by selecting the SDK Terminal tab and clicking the button.
8. Use the settings shown in the following figure for the KC705 board and click OK.
9. Verify the terminal connection by checking the status at the top of the SDK Terminal tab, as
shown in the following figure.
10. If the tab is not already open, select ../src/testperiph.c, and double-click to open the source
file.
11. Modify the source file by inserting a while statement at approximately line 41.
a. Click the blue bar on the left side of the testperiph.c window as shown in the figure, and
select Show Line Numbers.
b. In line 41, add while(1) above in front of the curly brace as shown in the following
figure:
12. Add a breakpoint in the code so that the processor stops code execution when the
breakpoint is encountered. To do so, scroll down to line 50 and double-click on the left pane,
which adds a breakpoint on that line of code, as shown in the following figure.
13. Press Ctrl + S to save the file. Alternatively, you can select File → Save.
1. In the Vivado IDE session, from the Program and Debug drop-down list of the Vivado Flow
Navigator, select Open Hardware Manager.
2. In the Hardware Manager window, click Open target → Open New Target.
Note: You can also use the Auto Connect option to connect to the target hardware.
The Open New Hardware Target dialog box opens, shown in the following figure.
3. Click Next.
4. On the Hardware Server Settings page, ensure that the Connect to field is set to Local server
(target is on local machine) as shown in the following figure, and click Next.
1. Select the Settings - hw_ila_1 tab and set the Trigger Mode Settings as follows:
a. Set Trigger mode to TRIG_IN_ONLY.
b. Set TRIG_OUT mode to TRIG_IN_ONLY.
c. Under Capture Mode Settings, ensure that Trigger position in window is set to 512.
3. In SDK, in the Debug window, click the MicroBlaze #0 in the Debug window and click the
Resume button .
The code will execute until the breakpoint set on Line 50 in testperiph.c file is reached.
As the breakpoint is reached, this triggers the ILA, as seen in the following figure:
This demonstrates that when the breakpoint is encountered during code execution, the
MicroBlaze triggers the ILA that is set up to trigger. This way you can monitor the state of the
hardware at a certain point of code execution.
1. Select the Breakpoints tab towards the top right corner of SDK window, and uncheck the
testperiph.c [line: 50] checkbox. This removes the breakpoint that you set up earlier.
Alternatively, you can also click on the breakpoint in the testperiph.c file, and select
Disable Breakpoint.
2. In the Debug window, right-click the MicroBlaze #0 target and select Resume.
The code runs continuously because it has an infinite loop.
You can see the code executing in the Terminal Window in SDK.
3. In Vivado, select the Settings - hw_ila_1 tab. Change the Trigger Mode to
BASIC_OR_TRIG_IN and the TRIG_OUT mode to TRIGGER_OR_TRIG_IN.
4. Click on the (+) sign in the Trigger Setup window to add the
slot_0:microblaze_0_axi_periph_M01:AWVALID signal from the Add Probes
window.
5. In the Basic Trigger Setup window, for
slot_0:microblaze_0_axi_periph_M01:AWVALID signal, ensure that the Radix field
is set to [B] (Binary) and set the Value field to 1.
This essentially sets up the ILA to trigger when the awvalid transitions to a value of 1.
6. Click the Run Trigger button to “arm” the ILA in the Status – hw_ila_1 window.
The ILA immediately triggers as the application software is continuously performing a write
to the GPIO thereby toggling the net_slot_0_axi_awvalid signal, which causes the ILA
to trigger. The ILA in turn, toggles the TRIG_OUT signal, which signals the processor to stop
code execution.
This is seen in SDK in the highlighted area of the debug window.
Conclusion
In this tutorial, you:
Lab Files
The Tcl script lab3.tcl is included with the design files to perform all the tasks in Vivado. The
SDK operations must be done in the SDK GUI. You might need to modify the Tcl script to match
the project path and project name on your machine.
Xilinx Resources
For support resources such as Answers, Documentation, Downloads, and Forums, see Xilinx
Support.
Xilinx Design Hubs provide links to documentation organized by design tasks and other topics,
which you can use to learn key concepts and address frequently asked questions. To access the
Design Hubs:
Note: For more information on DocNav, see the Documentation Navigator page on the Xilinx website.
References
These documents provide supplemental material useful with this guide:
1. Vivado Design Suite User Guide: Release Notes, Installation, and Licensing (UG973)
2. Vivado Design Suite User Guide: Using the Vivado IDE (UG893)
3. Vivado Design Suite User Guide: Designing with IP (UG896)
4. Vivado Design Suite Tcl Command Reference Guide (UG835)
5. Vivado Design Suite User Guide: Design Flows Overview (UG892)
6. Vivado Design Suite User Guide: Logic Simulation (UG900)
7. Vivado Design Suite User Guide: Using Tcl Scripting (UG894)
8. Vivado Design Suite User Guide: Implementation (UG904)
9. Vivado Design Suite User Guide: Using Tcl Scripting (UG894)
10. Zynq-7000 SoC Technical Reference Manual (UG585)
Copyright
© Copyright 2019 Xilinx, Inc. Xilinx, the Xilinx logo, Alveo, Artix, Kintex, Spartan, Versal, Virtex,
Vivado, Zynq, and other designated brands included herein are trademarks of Xilinx in the United
States and other countries. All other trademarks are the property of their respective owners.