wordpress 頁面 錨企業(yè)seo案例
目錄
1. 簡介
2. JTAG to AXI Master
2.1 添加 IP Core
2.2 基本TCL命令
2.2.1 復(fù)位 JTAG-to-AXI Master
2.2.2 創(chuàng)建并運行寫入傳輸事務(wù)
2.2.3?創(chuàng)建并運行讀取傳輸事務(wù)
2.2.4 命令列表
2.3 幫助信息
2.4?創(chuàng)建TCL讀寫程序
2.4.1 Read proc
2.4.2 Write proc
2.4.3?創(chuàng)建復(fù)雜過程
3. 示例?
3.1 AXI-GPIO IP Core
3.1.1 寄存器描述
3.1.2 操作示例
3.2 AXI IIC IP Core
3.2.1?AXI IIC 寄存器描述
3.2.2 操作示例
3.3 驅(qū)動 HLS IP
3.3.1 HLS 代碼
3.3.2?寄存器描述
3.3.3 操作示例
4. 總結(jié)
1. 簡介
本文分享?JTAG to AXI Master IP Core 的使用教程。
此 IP 用于 AXI 接口向設(shè)計輸入數(shù)據(jù),或者讀取數(shù)據(jù)。通過 Tcl 控制臺編寫命令來驅(qū)動此 IP,通過 JTAG 即可進(jìn)行操作,而這個 IP 則在 AXI 端口上驅(qū)動 AXI 事務(wù)。由于這個核心沒有自己的地址空間,它對所有從 JTAG 生成的 AXI 事務(wù)都是透明的。
與 Vivado 邏輯分析器一起,此 IP 可以用作 AXI 系統(tǒng)調(diào)試和測試工具。
IP Feature:
- 最大工作頻率為 200MHz
- 協(xié)議支持:
- AXI4
- AXI4-Lite
- 地址寬度:?32 位或者 64 位
- ID 寬度支持最多四位,允許用戶定義 ID 信號
- AXI4-Lite 數(shù)據(jù)寬度為 32 位
- AXI4 數(shù)據(jù)寬度為 32 位或者 64 位
- 支持所有內(nèi)存映射AXI接口事務(wù),包括:
- 突發(fā)類型 - INCR(增量)、FIXED(固定)和WRAP(環(huán)繞)
- 突發(fā)長度:
- 對于INCR和FIXED為1到256
- 對于WRAP為2、4、8和16
- 支持緩存信號
- 硬件調(diào)試運行時 Tcl 控制臺控制同時讀/寫操作
2. JTAG to AXI Master
2.1 添加 IP Core
1). 添加?JTAG to AXI Master v1.2 IP Core:
?
2). 下載 bitstream 后,可以看到該調(diào)試核:?
2.2 基本TCL命令
2.2.1 復(fù)位 JTAG-to-AXI Master
在創(chuàng)建并發(fā)出傳輸事務(wù)之前執(zhí)行:
reset_hw_axi [get_hw_axis hw_axi_1]
2.2.2 創(chuàng)建并運行寫入傳輸事務(wù)
create_hw_axi_txn \write_txn [get_hw_axis hw_axi_1] \-type WRITE \-address 4000_0000 \-len 4 \-data {11111111_22222222_33333333_44444444} \-forcerun_hw_axi [get_hw_axi_txns write_txn]
- write_txn,用戶定義的傳輸事務(wù)名稱
- [get_hw_axis hw_axi_1] ,返回 hw_axi_1 對象
- -address 40000000 是起始地址
- -len 1,會將 AXI 突發(fā)長度設(shè)置為 1 個字
- -data {11111111_22222222_33333333_44444444},“-data”方向為左側(cè) LSB(即,地址 0)和右側(cè) MSB(即,地址 3)
2.2.3?創(chuàng)建并運行讀取傳輸事務(wù)
create_hw_axi_txn \read_txn [get_hw_axis hw_axi_1] \-type READ \-address 4000_0000 \-len 2 \-forcerun_hw_axi [get_hw_axi_txns read_txn]---
INFO: [Labtoolstcl 44-481] READ DATA is: 0000000000000003
- read_txn,用戶定義的傳輸事務(wù)名稱
- [get_hw_axis hw_axi_1] ,返回 hw_axi_1 對象
- -address 4000_0000 是起始地址
- -len 2,會將 AXI 突發(fā)長度設(shè)置為 2 個字
- INFO 為讀取到的數(shù)據(jù)。
2.2.4 命令列表
| Tcl 命令 | 描述
|----------------------|------------------------------------------------------------------
| create_hw_axi_txn | 創(chuàng)建硬件 AXI 傳輸事務(wù)對象。
| delete_hw_axi_txn | 刪除硬件 AXI 傳輸事務(wù)對象。
| get_hw_axi_txns | 獲取硬件 AXI 傳輸事務(wù)對象列表。
| get_hw_axis | 獲取硬件 AXI 對象列表。
| refresh_hw_axi | 刷新硬件 AXI 對象狀態(tài)。
| report_hw_axi_txn | 報告已格式化的硬件 AXI 傳輸事務(wù)數(shù)據(jù)。
| reset_hw_axi | 復(fù)位硬件 AXI 核狀態(tài)。
| run_hw_axi | 在對應(yīng) hw_axi 對象中運行硬件 AXI 讀寫傳輸事務(wù)并更新傳輸事務(wù)狀態(tài)。
2.3 幫助信息
查看幫助信息
create_hw_axi_txn -help
---
Description:
Create hardware AXI transaction objectSyntax:
create_hw_axi_txn [-address <arg>] [-data <arg>] [-size <arg>] -type <arg>[-len <arg>] [-burst <arg>] [-cache <arg>] [-id <arg>][-force] [-quiet] [-verbose] <name> <hw_axi>Returns:
New hardware AXI transaction object.Usage: Name Description-----------------------
2.4?創(chuàng)建TCL讀寫程序
2.4.1 Read proc
proc read {address} {# 移除地址中的 "0x" 前綴(如果存在)和任何下劃線set address [string map {"0x" "" "_" ""} $address]# 創(chuàng)建讀事務(wù)create_hw_axi_txn -quiet -force rd_tx [get_hw_axis hw_axi_1] -address $address -len 1 -type readrun_hw_axi -quiet rd_txreturn 0x[get_property DATA [get_hw_axi_txn rd_tx]]
}
使用說明:
read 0x4000_0000
---
0x00000001
2.4.2 Write proc
proc write {address value} {# 移除地址中的 "0x" 前綴(如果存在)和任何下劃線set address [string map {"0x" "" "_" ""} $address]# 創(chuàng)建寫事務(wù)create_hw_axi_txn -quiet -force wr_tx [get_hw_axis hw_axi_1] -address $address -data $value -len 1 -type writerun_hw_axi -quiet wr_tx
}
使用說明:
write 0x4000_0000 0x0000_0003
錯誤提示:
ERROR: [Labtoolstcl 44-224] Invalid option value 'wr_tx' specified for 'hw_axi_txns'.
原因:write 0x4000_0000 0x0000_00003,第二個參數(shù)多了一位。
2.4.3?創(chuàng)建復(fù)雜過程
創(chuàng)建復(fù)雜過程,調(diào)用 2.4.2 Write proc 中定義的寫過程,實現(xiàn) LED 閃爍。
proc test_gpio {gpio} {while {1} {write $gpio 0x0000_0003after 1000write $gpio 0x0000_0000after 1000}
}test_gpio 0x4000_0000
3. 示例?
3.1 AXI-GPIO IP Core
3.1.1 寄存器描述
AXI GPIO 寄存器描述
| Address Space Offset | Register Name | Access Type | Default Value | Description
|----------------------|---------------|-------------|---------------|------------------------------------------
| 0x0000 | GPIO_DATA | R/W | 0x0 | Channel 1 AXI GPIO Data Register.
| 0x0004 | GPIO_TRI | R/W | 0x0 | Channel 1 AXI GPIO 3-state Control Register.
| 0x0008 | GPIO2_DATA | R/W | 0x0 | Channel 2 AXI GPIO Data Register.
| 0x000C | GPIO2_TRI | R/W | 0x0 | Channel 2 AXI GPIO 3-state Control.
| 0x011C | GIER | R/W | 0x0 | Global Interrupt Enable Register.
| 0x0128 | IP IER | R/W | 0x0 | IP Interrupt Enable Register (IP IER).
| 0x0120 | IP ISR | R/TOW | 0x0 | IP Interrupt Status Register.
?AXI GPIO 三態(tài)寄存器描述
| Bits | Field Name | Access Type | Reset Value | Description
|---------------------|------------|-------------|----------------------|----------------------
| [GPIOx_Width-1:0] | GPIOx_TRI | Read/Write | Default Tri State |0 = output, 1 = input.
3.1.2 操作示例
見?2.2 基本TCL命令。
proc write {address value} {set address [string range $address 2 [expr {[string length $address]-1}]]create_hw_axi_txn -quiet -force wr_tx [get_hw_axis hw_axi_1] -address $address -data $value -len 1 -size 32 -type writerun_hw_axi -quiet wr_tx
}write 0x4000_0004 0x0000_0000 # 設(shè)置 GPIO 為輸出
write 0x4000_0000 0x0000_0003 # 設(shè)置 GPIO 狀態(tài)。
3.2 AXI IIC IP Core
3.2.1?AXI IIC 寄存器描述
| Address Space Offset | Register Name | Description |
|----------------------|-----------------|----------------------------------------------------------|
| 01Ch | GIE | Global Interrupt Enable Register |
| 020h | ISR | Interrupt Status Register |
| 028h | IER | Interrupt Enable Register |
| 040h | SOFTR | Soft Reset Register |
| 100h | CR | Control Register |
| 104h | SR | Status Register |
| 108h | TX_FIFO | Transmit FIFO Register |
| 10Ch | RX_FIFO | Receive FIFO Register |
| 110h | ADR | Slave Address Register |
| 114h | TX_FIFO_OCY | Transmit FIFO Occupancy Register |
| 118h | RX_FIFO_OCY | Receive FIFO Occupancy Register |
| 11Ch | TEN_ADR | Slave Ten Bit Address Register |
| 120h | RX_FIFO_PIRQ | Receive FIFO Programmable Depth Interrupt Register |
| 124h | GPO | General Purpose Output Register |
| 128h | TSUSTA | Timing Parameter Register |
| 12Ch | TSUSTO | Timing Parameter Register |
| 130h | THDSTA | Timing Parameter Register |
| 134h | TSUDAT | Timing Parameter Register |
| 138h | TBUF | Timing Parameter Register |
| 13Ch | THIGH | Timing Parameter Register |
| 140h | TLOW | Timing Parameter Register |
| 144h | THDDAT | Timing Parameter Register |
3.2.2 操作示例
3.3 驅(qū)動 HLS IP
3.3.1 HLS 代碼
功能:使用 ap_ctrl_hs 協(xié)議,控制接口使用 AXI_Llite。
啟動該 HLS IP 后,內(nèi)部代碼執(zhí)行一次,即 led_state 翻轉(zhuǎn),并傳遞給 led 頂層接口。
#include <ap_int.h>void blink_counter(ap_uint<1> *led)
{
#pragma HLS INTERFACE mode=ap_none port=led register
#pragma HLS INTERFACE mode=s_axilite port=returnstatic ap_uint<1> led_state = 0;led_state = ~led_state;*led = led_state;
}
* REGISTER
+-----------+---------+----------+
| Interface | Mode | Bitwidth |
+-----------+---------+----------+
| led | ap_none | 1 |
+-----------+---------+----------+* TOP LEVEL CONTROL
+-----------+------------+-----------+
| Interface | Type | Ports |
+-----------+------------+-----------+
| ap_clk | clock | ap_clk |
| ap_rst_n | reset | ap_rst_n |
| interrupt | interrupt | interrupt |
| ap_ctrl | ap_ctrl_hs | |
+-----------+------------+-----------+
3.3.2?寄存器描述
// ==============================================================
// control
// 0x0 : Control signals
// bit 0 - ap_start (Read/Write/COH)
// bit 1 - ap_done (Read/COR)
// bit 2 - ap_idle (Read)
// bit 3 - ap_ready (Read/COR)
// bit 7 - auto_restart (Read/Write)
// bit 9 - interrupt (Read)
// others - reserved
// 0x4 : Global Interrupt Enable Register
// bit 0 - Global Interrupt Enable (Read/Write)
// others - reserved
// 0x8 : IP Interrupt Enable Register (Read/Write)
// bit 0 - enable ap_done interrupt (Read/Write)
// bit 1 - enable ap_ready interrupt (Read/Write)
// others - reserved
// 0xc : IP Interrupt Status Register (Read/COR)
// bit 0 - ap_done (Read/COR)
// bit 1 - ap_ready (Read/COR)
// others - reserved
// (SC = Self Clear, COR = Clear on Read, TOW = Toggle on Write, COH = Clear on Handshake)
3.3.3 操作示例
1)構(gòu)建 Block Design 原理圖
2)配置 AXI 總線地址
3)燒寫 bitstream 后,即可控制該 HLS IP。
proc write {address value} {set address [string range $address 2 [expr {[string length $address]-1}]]create_hw_axi_txn -quiet -force wr_tx [get_hw_axis hw_axi_1] -address $address -data $value -len 1 -size 32 -type writerun_hw_axi wr_tx
}write 0x0000_0000 0x0000_0001
4. 總結(jié)
- JTAG to AXI Master 功能簡介
- 在 Vivado 中添加該 IP
- 基本 TCL 操作命令
- 三個示例
- 通過?JTAG to AXI 控制 AXI GPIO
- 通過?JTAG to AXI 控制 AXI IIC
- 通過?JTAG to AXI 控制 HLS IP Core
參考列表:
1)UG908
Programming and Debugging (UG908)https://docs.amd.com/r/en-US/ug908-vivado-programming-debugging/Hardware-System-Communication-Using-the-JTAG-to-AXI-Master-Debug-Core2)Xilinx Wiki - JTAG to AXI
Xilinx Wiki - JTAG to AXIhttps://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/64488613/Using+the+JTAG+to+AXI+to+test+Peripherals+in+Zynq+Ultrascale