Jtag To Axi4 debug 读写寄存器的tcl脚本封装
把下列代码保存为.tcl或者.txt文本保存在某个路径下
打开vivado,在tcl concle中输入 “source 文件路径”,将脚本加载至工具中后,
例如读寄存器地址32'h12345678的命令为:"ReadReg 0x12345678",此时便会返回寄存器的值,而不用每次都输入繁琐的一串命令。
写命寄存器则需要输入地址和数据,例如写寄存器地址32‘h12345678的值为0x3,"WriteReg 0x12345678 0x3"即可
proc ReadReg { Addr } { puts "Start reading operation" set address [format "0x%08X" $Addr] set len 1 creat_hw_axi_txn read_txn [get_hw_axis hw_axi_1] -type read \ -address $address -len $len run_hw_axi [get_hw_axi_txns read txn] set read_proc [list [report_hw_axi_txn [get_hw_axi_txns read_txn]]]; set read_status_value [lindex $read_proc 0 1] delete_hw_axi_txn [get_hw_axi_txns read txn] return $read_status_value; } proc WriteReg { Addr data} { set len 1 set address [format "0x%08X" $Addr] set data [format "0x%08X" $data] creat_hw_axi_txn write_txn [get_hw_axis hw_axi_1] -type write \ -address $address -len $len -data $data run_hw_axi [get_hw_axi_txns write txn] delete_hw_axi_txn [get_hw_axi_txns write txn] }