Main Content

使用IP核心生成工作流程Xilinx Pure FPGA板上的访问DUT寄存器

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™ AXI Manager IP to access the HDL Coder generated DUT registers by enabling the reference design parameter optionInsert JTAG AXI Manager。然后,您可以直接从Matlab®访问DUT寄存器。另外,您可以使用Xilinx JTAG Axi Master通过编写TCL命令使用Vivado®TCL控制台访问DUT寄存器。对于Xilinx JTAG Axi Master,您必须创建自定义参考设计。FPGA设计在XilinxKintex®-7 KC705板上实现。

Requirements

Xilinx Kintex-7 KC705 Development Board

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验证者AXI Manager + HDL Coder IP Core

  • Xilinx JTAG主 + HDL编码器IP Core

  • Microblaze™ + HDL编码器IP核心

  • PCIe Endpoint + HDL Coder IP Core

此示例包括两个参考设计。

  • 默认系统参考设计使用MathWorks®IP和MATLAB命令行界面,以通过启用参考设计参数选项来发行读取命令Insert JTAG AXI Manager。To use this parameter, you must have the HDL Verifier product.

  • AXI主参考设计的Xilinx JTAG使用Vivado IP使用JTAG到AXI Master,并且需要使用Vivado TCL控制台发出读写命令。

The two reference designs differ by only the JTAG manager IP that they use, as this figure shows.

HDL验证者AXI管理器参考设计

In the IP core generation workflow of the HDL Workflow Advisor, in theSet Target Reference Design步骤,选择插入JTAG AXI经理(需要HDL验证者)范围。此选项将AXI Manager IP自动添加到参考设计中,并使用AXI4-SLAVE接口将添加的IP连接到DUT IP。下一节详细介绍了自动插入JTAG AXI Manager IP中的步骤。

执行IP核心工作流程

Follow these steps to execute the IP core workflow for the Default System reference design, which uses JTAG AXI Manager 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.

hdlsetuptoolpath('ToolName',,,,'Xilinx Vivado',,,,'ToolPath',,,,...'c:\ xilinx \ vivado \ 2020.2 \ bin \ vivado.bat');

2.打开通过在MATLA金宝appB中执行此命令来实现LED闪烁的Simulink模型。

open_system('hdlcoder_led_blinking'

3.从hdlcoder_led_blinking/led_counter通过右键单击子系统led_counter子系统和选择HDL Codefollowed byHDL Workflow Advisor

4. In step 1.1, selectTarget workflow作为IP核心生成andTarget platform作为Xilinx Kintex-7 KC705开发委员会。Click运行此任务

5.在步骤1.2中,选择参考设计作为默认系统。在下面参考设计parameters, 选择插入JTAG AXI经理(需要HDL验证者)作为on。Click运行此任务

6.在步骤1.3中,分配blink_frequency,,,,Blink_directionand回过头再读端口到AXI4接口。将LED端口分配给LED通用目的[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生成软件接口模型如该图所示,任务不存在。

确定IP核心报告的地址

The base address for an HDL Coder IP core is defined as0x40000000for the Default System reference design, which uses the AXI Manager IP. You can see address setting in the generated IP core report as shown in this figure.

IP核心报告寄存器地址映射表显示了偏移。

HDL验证者Command Line Interface

如果您具有Xilinx FPGA板的HDL验证器支持软件包金宝app,请选择AXI Manager参考设计,可以使用MATLAB命令行接口访问由HDL Coder产品生成的IP核心。

To write and read from the DDR memory, follow these steps.

1. Create an AXI manager object.

h = aximanager('Xilinx'

2.发出写命令。例如,禁用DUT。

H.WriteMemory('40000004',,,,0)

3.重新启用DUT。

H.WriteMemory('40000004',,,,1)

4. Issue a read command. For example, read the current counter value.

H.ReadMemory('40000108',,,,1)

5.删除对象以释放JTAG资源。如果您不删除对象,则其他JTAG操作(例如编程FPGA)失败。

delete(h)

Xilinx JTAG至AXI主参考设计

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 theaddpath命令。

访问HDL编码器IP核心寄存器使用Xilinx JTAG to AXI Master IP by using the base address that is defined in reference design plugin file.

vivado tcl命令用于AXI读写

此示例使用独立的Vivado TCL控制台进行基本命令来发行读取和写入。您可以使用这些命令打开JTAG设备并设置“启用”和“禁用”写入DUT。您可以将这些命令直接输入到Vivado TCL控制台中,或将其保存到TCL文件中,然后再源。为简单起见,将这些TCL命令复制到文件中open_jtag.tcl

# OpenconnectionJTAG掌握open_hw connect_hw_server open_hw_target refresh_hw_device[lindex [get_hw_devices] 0]
# 创造一些读/写create_hw_axi_txnwr_enable[get_hw_axis hw_axi_1]...-address44a0_0004-data0000_0001-类型writecreate_hw_axi_txnwr_disable[get_hw_axis hw_axi_1]...-address44a0_0004-data0000_0000-类型write

Launch the Vivado Tcl console, sourcing the file you just created.

system('vivado -mode tcl -source open_jtag.tcl&'

使用JTAG Master完成后,使用这些TCL命令关闭连接。

# 关anddisconnectfromJTAG掌握colles_hw_target;disconnect_hw_server;

Summary

您可以使用JTAG AXI Manager与没有嵌入式ARM处理器(例如Kintex-7)的系统中的HDL Coder IP Core寄存器接口。您可以将此IP用作在用于软处理器的手动编码软件之前(例如Microblaze)或一种调整运行系统上调整参数的方式,将此IP用作检验独立HDL编码器IP内核的第一步。