This example shows how to use the HDL Coder™ IP core generation workflow to develop reference designs for Xilinx® parts that do not use an embedded ARM® processor present but that still utilize the HDL Coder generated AXI interface to control the design under test (DUT). This example uses the HDL Verifier™ MATLAB® as AXI Master IP to access the HDL Coder generated DUT registers by enabling the reference design parameter option Insert JTAG MATLAB as AXI Master. You can then access DUT registers from MATLAB directly. Alternatively, you can use the Xilinx JTAG AXI Master to access the DUT registers using Vivado® Tcl console by writing Tcl commands. For the Xilinx JTAG AXI Master, you must create a custom reference design. The FPGA design is implemented on the Xilinx Kintex®-7 KC705 board.
Xilinx Vivado Design Suite, with a supported version listed in
Xilinx Kintex-7 KC705 development board
HDL Coder Support Package for Xilinx FPGA Boards
HDL Verifier Support Package for Xilinx FPGA Boards
This figure shows the Xilinx Kintex-7 KC705 development board.
Designs that can benefit from using the HDL Coder IP core generation workflow without using either an embedded ARM processor or an Embedded Coder™ support package but still leverage the HDL Coder generated AXI4-Lite registers can include one of these IP sets.
HDL Verifier MATLAB as AXI Master + HDL Coder IP Core
Xilinx JTAG Master + HDL Coder IP Core
MicroBlaze™ + HDL Coder IP Core
PCIe Endpoint + HDL Coder IP Core
This example includes two reference designs.
The Default System reference design uses MathWorks® IP and a MATLAB command line interface for issuing read and write commands by enabling the reference design parameter option Insert JTAG MATLAB as AXI Master. To use this parameter, you must have the HDL Verifier product.
The Xilinx JTAG to AXI Master reference design uses Vivado IP for the JTAG to AXI Master and requires using the Vivado Tcl console to issue read and write commands.
The two reference designs differ by only the JTAG Master IP that they use, as this figure shows.
In the IP core generation workflow of the HDL Workflow Advisor, in the Set Target Reference Design step, select the Insert JTAG MATLAB as AXI Master (HDL Verifier required) parameter. This option adds MATLAB as AXI Master IP automatically into the reference design and connects the added IP to the DUT IP using the AXI4-slave interface. The next section details the steps to auto-insert the JTAG MATLAB as AXI Master IP in the reference design.
Execute IP Core Workflow
Follow these steps to execute the IP core workflow for the Default System reference design, which uses JTAG MATLAB as AXI Master IP. Using this reference design, you can generate an HDL IP core that blinks LEDs on the KC705 board. To generate an HDL IP core, follow these steps.
1. Set up the Xilinx Vivado tool path by executing this command in MATLAB. Use your own Xilinx Vivado installation path when executing the command.
2. Open the Simulink model that implements LED blinking by executing this command in MATLAB.
3. Launch HDL Workflow Advisor from the
hdlcoder_led_blinking/led_counter subsystem by right-clicking the
led_counter subsystem and selecting HDL Code followed by HDL Workflow Advisor.
4. In step 1.1, select Target workflow as
IP Core Generation and Target platform as
Xilinx Kintex-7 KC705 development board. Click Run This Task.
5. In step 1.2, select Reference design as
Default System. Under Reference design parameters, select Insert JTAG MATLAB as AXI Master (HDL Verifier required) as
6. In step 1.3, assign
Read_back ports to the AXI4 interface. Assign the LED port to
LEDs General Purpose [0:7].
7. Run the remaining steps in the workflow to generate a bitstream and program the target device.
Unlike the Zynq-based reference design, a Generate Software Interface Model task does not exist, as this figure shows.
Determine Addresses from IP Core Report
The base address for an HDL Coder IP core is defined as
0x40000000 for the Default System reference design, which uses the MATLAB as AXI Master IP. You can see address setting in the generated IP core report as shown in this figure.
The IP core report register address mapping table shows the offsets.
HDL Verifier Command Line Interface
If you have the HDL Verifier support package for Xilinx FPGA boards, select the MATLAB as AXI Master reference design, then you can use MATLAB command line interface to access the IP core that is generated by the HDL Coder product.
To write and read from the DDR memory, follow these steps.
1. Create an AXI master object.
h = aximaster('Xilinx')
2. Issue a write command. For example, disable the DUT.
3. Re-enable the DUT.
4. Issue a read command. For example, read the current counter value.
5. Delete the object to free up the JTAG resource. If you do not delete the object, other JTAG operations, such as programming the FPGA, fail.
Create a custom reference design to use the Xilinx JTAG to AXI Master IP in the reference design, and then add the reference design files to the MATLAB path using the
Access the HDL Coder IP core registers using the Xilinx JTAG to AXI Master IP by using the base address that is defined in reference design plugin file.
Vivado Tcl Commands for AXI Read and Write
This example uses the standalone Vivado Tcl console for basic commands to issue reads and writes. You can use these commands to open the JTAG device and set up an "enable" and "disable" write to the DUT. You can enter these commands directly into the Vivado Tcl console or save them in a Tcl file and source them later. For simplicity, copy these Tcl commands into a file
# Open connection to the JTAG Master open_hw connect_hw_server open_hw_target refresh_hw_device [lindex [get_hw_devices] 0]
# Create some reads/writes create_hw_axi_txn wr_enable [get_hw_axis hw_axi_1] -address 44a0_0004 -data 0000_0001 -type write create_hw_axi_txn wr_disable [get_hw_axis hw_axi_1] -address 44a0_0004 -data 0000_0000 -type write
Launch the Vivado Tcl console, sourcing the file you just created.
system('vivado -mode tcl -source open_jtag.tcl&')
When you are done using the JTAG Master, close the connection by using these Tcl commands.
# Close and disconnect from the JTAG Master close_hw_target; disconnect_hw_server;
You can use a JTAG to AXI Master to interface with HDL Coder IP core registers in systems that do not have an embedded ARM processor, such as the Kintex-7. You can use this IP as a first step to debug standalone HDL Coder IP cores, prior to hand coding software for soft processors, (such as MicroBlaze), or as a way to tune parameters on a running system.