![]() |
In this tutorial, you will create a simple AMD soft-processor system for a Spartan-7 FPGA using AMD Vivado™ IP integrator.
This tutorial uses the new AMD MicroBlaze™ V soft-core RISC-V processor.
The MicroBlaze V system includes native AMD IP including:
- MicroBlaze V processor
- AXI block RAM
- Double Data Rate 3 (DDR3) memory
- UARTLite
- AXI GPIO
- MicroBlaze Debug Module (MDM) V
- 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 V processor.
The feature is demonstrated using a software application code developed in the Vitis software platform in a stand-alone application mode.
This lab targets the AMD SP701 FPGA Evaluation Kit.
-
Start the Vivado IDE by clicking the Vivado desktop icon or by typing
vivado
at a command prompt. -
From the Quick Start page, select Create Project.
-
In the New Project dialog box, use the following settings:
a. In the Project Name dialog box, type the project name and location.
b. Make sure that the Create project subdirectory check box is selected. Click Next.
c. In the Project Type dialog box, select RTL project. Ensure that the Do not specify sources at this time check box is cleared. Click Next.
d. In the Add Sources dialog box, set the Target language to either VHDL or Verilog. You can leave the Simulator language selection to Mixed.
e. Click Next.
f. In Add Constraints dialog box, click Next.
g. In the Default Part dialog box, select Boards and choose Spartan-7 SP701 Evaluation Platform. Click Next.
h. Review the project summary in the New Project Summary dialog box and click Finish to create the project.
Because you selected the SP701 board when you created the Vivado IDE project, you see the following message in the Tcl Console:
set_property board_part xilinx.com:sp701:part0:1.1 [current_project]
Although Tcl commands are available for many of the actions performed in the Vivado IDE, they are not explained in this tutorial. Instead, a Tcl script is provided that can be used to recreate this entire project. See the Tcl Console for more information. You can also refer to the Vivado Design Suite Tcl Command Reference Guide (UG835) for information about the write_bd_tcl
commands.
-
From Flow Navigator, under IP integrator, select Create Block Design.
-
Specify the IP subsystem design name. For this step, you can use
mbv_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. -
Click OK in the Create Block Design dialog box, shown in the following figure.
-
In the IP integrator diagram area, right-click and select Add IP.
The IP integrator Catalog opens. Alternatively, you can also select the Add IP icon in the middle of the canvas.
-
Type
mig
in the Search field to find the MIG core, then select Memory Interface Generator (MIG 7 Series), and press Enter.The Designer Assistance link becomes active in the block design banner.
-
Click Run Block Automation.
The Run Block Automation dialog box opens.
-
Click OK. This instantiates the MIG core and connects the I/O interfaces to the I/O interfaces for the DDR memory on the SP701 board.
-
Right-click anywhere in the block design canvas, and select Add IP. The IP catalog opens.
-
In the Search field, type
micr
to find the MicroBlaze V IP, then select MicroBlaze V, and press Enter.
Note: If not displayed by default, the IP Details window can be displayed by clicking CTRL+Q on the keyboard while searching for IP.
There are several ways to use an existing interface in IP integrator. Use the Board window to instantiate some of the interfaces that are present on the SP701 board.
-
Navigate to the Windows>Board.
-
Select the Board window to see the interfaces present on the SP701 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.
-
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.
-
From the Board window, select LED under the General Purpose Input or Output folder, and drag and drop it into the block design canvas.
This instantiates the GPIO IP on the block design and connects it to the on-board LEDs.
-
Next, from the Board window, select FPGA Reset under the Reset folder, and drag and drop it into the block design canvas.
This connects the CPU push button reset to the MIG core IP.
-
Add the AXI block RAM Controller, shown in the following figure, by right-clicking the IP integrator canvas and selecting Add IP.
The block design now should look like the following figure.
-
Click Run Block Automation, as shown below.
The Run Block Automation dialog box opens.
-
On the Run Block Automation dialog box:
a. Leave Preset as the default value, None.
b. Set Local Memory to 64 KB.
c. Leave the Local Memory ECC as the default value, None.
d. Set Cache Configuration to 32 KB.
e. Set Debug Module to Debug Enabled.
f. Leave the Peripheral AXI Port option as the default value, Enabled.
g. Leave the Interrupt Controller option unchecked.
h. Leave The Clock source option set to /mig_7series_0/ui_addn_clk_0 (100 MHz).
-
Click OK.
This generates a basic MicroBlaze V system in the IP integrator diagram area, as shown in the following figure.
Run Connection Automation provides several options that you can select to make connections. This section will walk you through the first connection, and then you will use the same procedure to make the rest of the required connections for this tutorial.
-
Click Run Connection Automation as shown in the following figure.
The Run Connection Automation dialog box opens.
-
Check the All Automation check box in the left pane of the dialog box as shown in the following figure. This selects interfaces to run Connection Automation for.
-
Use the following table to set options in the Run Connection Automation dialog box.
Table 1: Run Connection Automation Options
Connection | More Information | Setting |
---|---|---|
axi_bram_ctrl_0
|
The only option for this automation is to instantiate a new Block Memory Generator as shown under options. | Leave the Blk_Mem_Gen to its default option of Auto. |
axi_bram_ctrl_0
|
The Run Connection Automation dialog box opens and gives you two choices:
|
Leave the Blk_Mem_Gen option to its default value of Auto. |
axi_bram_ctrl_0
|
Two options are presented in this case. The Master field can be set for either cached or non-cached accesses. | The Run Connection Automation dialog box offers to connect this to the /microblaze_riscv_0 (Cached).
Leave it to its default value. In case, cached accesses are not desired
this could be changed to /microblaze_riscv_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 its default value of /microblaze_0 (Periph).
The Clock Connection (for unconnected clks) field is set to its default value of Auto. |
Keep these default settings. |
axi_uartlite_0
|
The Master field is set to its default value of /microblaze_0 (Periph).
The Clock Connection (for unconnected clks) field is set to its default value of Auto. |
Keep these default settings. |
mig_7series_0
|
The Master field is set to microblaze_0 (Cached). Leave it to this value so the accesses to
the DDR3 memory are cached accesses.
The Clock Connection (for unconnected clks) field is set to its default value of Auto. |
Keep these default settings. |
Rst_mig_7_series_0_100M
|
The reset pin of the Processor Sys Rreset IP will be connected to the board reset pin. | Keep the default setting. |
-
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.
Note: The relative placement of your IP might be slightly different.
-
To monitor the AXI transactions taking place between the MicroBlaze and the GPIO, select the interface net connecting M00_AXI interface pin of the microblaze_riscv_0_axi_periph instance and the S_AXI interface pin of the axi_gpio_0 instance.
-
Right-click and select Debug from the context menu.
Note: The Designer Assistance is available as indicated by the Run Connection Automation link in the banner of the block design.
-
Click Run Connection Automation.
-
In the Run Connection Automation dialog box, go with the default setting as shown in the following figure.
-
Click OK.
-
Click the Regenerate Layout button
in the IP integrator toolbar to generate an optimum layout for the block design. The block diagram should look like the following figure.
Note: The relative placement of your IP might be slightly different.
-
Click the Address Editor window.
-
In the Address Editor, do the following:
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. Ensure the range of microblaze_riscv_0/mig_7_series_0/memmap IP in both the Data and the Instruction section are 512 MB, as shown in the following figure.
c. The top of the Address Editor window should show Assigned (11), indicating all 11 interfaces were assigned addresses. If Unassigned shows any interfaces unassigned, click on the Assign All arrow
.
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 V processor.
To use either Memory IP DDR or AXI block RAM, those IP must be in the cacheable area; otherwise, the MicroBlaze V processor cannot read from or write to them.
Validating the design will automatically re-configure the MicroBlaze V processor's cacheable address range.
To run design rule checks on the design:
-
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.
-
Click OK.
-
Save your design by pressing Ctrl+S, or select File > Save Block Design.
-
In the Sources window, select the block design, then right-click it and select Generate Output Products. Alternatively, you can click Generate Block Design in the Flow Navigator.
The Generate Output Products dialog box opens.
-
Click Generate.
The Generate Output Products dialog box informs you that Out-of-context module runs were launched.
-
Click OK.
-
Wait a few minutes for all the Out-of-Context module runs to finish as shown in the Design Runs windows.
-
Under Design Sources, right-click the block design
mbv_subsystem
and click Create HDL Wrapper.In the Create HDL Wrapper dialog box, Let Vivado manage wrapper and auto-update is selected by default.
-
Click OK.
-
In the Flow Navigator, click Generate Bitstream.
The No implementation Results Available dialog box opens.
-
Click Yes.
The Launch Runs dialog box opens.
-
Make the appropriate choices and click OK.
Bitstream generation can take several minutes to complete. Once it finishes, the Bitstream Generation Completed dialog box asks you to select what to do next.
-
Keep the default selection of Open Implemented Design and click OK.
-
Verify that all timing constraints have been met by looking at the Timing - Design Timing Summary window, as shown in the following figure.
Note: The timing summary for your design might be slightly different.
IMPORTANT! For the usb driver to install, you must power on and connect the board to the host PC before launching the Vitis software platform.
Next, open the design and export to the Vitis software platform.
-
From the Vivado File menu, select File > Export > Export Hardware. The Export Hardware Platform dialog box opens.
-
Click Next.
-
Select the Include bitstream option using the radio button in the Output view and click Next.
-
Leave the XSA file name field at its default value and click Next. (The following figure shows Windows-specific settings.)
-
Click Finish. This will export the hardware XSA File in the project directory.
-
To launch the Vitis software platform, select Tools > Launch Vitis IDE. The Eclipse Launcher dialog box opens.
The Vitis software platform launches in a separate window.
-
Select Open Workspace and select an new folder for the desired Workspace location, such as C:\Projects\Vitis_Workspaces\microblaze-system (Windows-specific).
-
Select File > New Component > Platform or under Embedded Development click Create Platform Component.
-
Click Next.
-
In the Platform Creation Flow window, select the Hardware Design option and Click Browse to open the Select Hardware Design (XSA) window. Navigate to the directory where the XSA file was created in Vivado and click Open.
-
Click Next.
-
In the Operating System and Processor window, select the standalone for the operating sytem and microblaze_riscv_0 for the processor.
-
Click Next.
-
Review the Platform Component Creation Summary and click Finish.
-
Select File > New Component > From Examples or under Get Started click Examples.
-
Click Next.
-
In the Platform page, select the previously created platform.
-
Click Next.
-
In the Domain page leave all the fields at their default values and click Next.
-
A new
peripheral_tests
application is created. If thetestperiph.c
file is not already open, select MICROBLAZE-V-SYSTEM/peripheral_tests [Application]/Sources/src/testperiph.c, and double-click to open the source file. Modify the source file by inserting a while statement at approximately line 18. Press Ctrl + S to save the file.a. In line 18, add
while(1)
above the curly brace as shown in the following figure. -
To build the application select peripheral_tests under Flow > Component and click on Build. Click OK on the pop-up window to build the associated platform.
-
Wait for the application to finish compiling.
IMPORTANT! Make sure that you have connected the target board to the host computer and it is turned on.
-
To start the session, click on the Run icon under Flow > Component [peripheral_tests] > Run.
-
The Debug perspective window opens, if the
testperiph.c
file is not already open, select ../src/testperiph.c, and double-click to open the source file.
- Configure your terminal program (e.g., TeraTerm, Putty) to connect to the SP701 Serial Port with the settings shown below.
- Baud rate = 9600
- Data bits = 8
- Stop bits = 1
- Flow control = None
- Parity = None
Connect to the SP701 board using the Vivado Logic Analyzer.
-
In the Vivado IDE session, from the Program and Debug drop-down list of the Vivado Flow Navigator, select Open Hardware Manager.
-
In the Hardware Manager window, click Open target > Open New Target.
The Open New Hardware Target dialog box opens, shown in the following figure.
-
Click Next.
-
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.
-
On the Select Hardware Target page, click Next.
-
Ensure that all the settings are correct on the Open Hardware Target Summary dialog box and click Finish.
Note: You can also use the Auto Connect option to connect to the target hardware.
When the Vivado Hardware Session successfully connects to the SP701 board, you see the information shown in the following figure:
-
Select the Settings - hw_ila_1 tab and keep the Trigger Mode Settings with the default value:
- Set Trigger mode to BASIC_ONLY.
- Under Capture Mode Settings, ensure that Trigger position in window is set to 512.
-
Click on the (+) sign in the Trigger Setup window to add the
slot_0 : microblaze_riscv_0_axi_periph_M00_AXI : AWVALID
signal from the Add Probes window. -
In the Trigger Setup window, for
slot_0 : microblaze_riscv_0_axi_periph_M00_AXI : AWVALID
signal, ensure that the Operator field is set to ==, the Radix field to [B] (Binary) and the Value field to 1 (logical one).This essentially sets up the ILA to trigger when the
awvalid
transitions to a value of 1. -
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 theTRIG_OUT
signal, which signals the processor to stop code execution.
In this tutorial, you:
-
Stitched together a design in the Vivado IP integrator
-
Took the design through implementation and bitstream generation
-
Exported the hardware to Vitis
-
Created and modified application code that runs on a Standalone Operating System
-
Modified the linker script so that the code executes from the DDR3 memory
-
Verified cross-trigger functionality between the MicroBlaze processor executing code and the design logic
The Tcl script lab_riscv_mb.tcl
is included with the design files to perform all the tasks in Vivado. The Vitis software platform operations must be done in the Vitis GUI. You will need to modify the Tcl script to match the desired project path and project name on your machine.
Copyright © 2019–2024 Advanced Micro Devices, Inc.