使用tcl在vivado中编程设备

使用tcl在vivado中编程设备,tcl,xilinx,vivado,Tcl,Xilinx,Vivado,我正在尝试通过vivado命令行编程我的digilent FPGA。打开硬件服务器后,我可以按如下方式对设备进行编程 program_hw_devices [get_hw_devices xc7a100t_0] 然后,如果我运行put[get_hw_devices xc7a100t_0]它会输出xc7a100t_0,这让我觉得我应该可以做一些类似编程_hw_devices xc7a100t_0的事情。但是这失败了,我得到了以下输出 错误:[Common 17-161]无效选项 为“硬件设备”指

我正在尝试通过vivado命令行编程我的digilent FPGA。打开硬件服务器后,我可以按如下方式对设备进行编程

program_hw_devices [get_hw_devices xc7a100t_0]
然后,如果我运行
put[get_hw_devices xc7a100t_0]
它会输出
xc7a100t_0
,这让我觉得我应该可以做一些类似
编程_hw_devices xc7a100t_0
的事情。但是这失败了,我得到了以下输出

错误:[Common 17-161]无效选项 为“硬件设备”指定的值“xc7a100t\U 0”

我真的不明白这是怎么回事。我认为这两个命令应该是等效的,因为我刚刚传递了get_-hw_设备返回的内容。我还认为tcl中所有的东西都只是一个字符串。
[get_hw_devices xc7a100t_0]
的输出是否有一些特殊类型?

查看,我们发现建议的用法是:

program_hw_devices [lindex [get_hw_devices] 0]
考虑到
get_hw_devices
的输出文本是一个“简单”字(没有空格或Tcl元字符),我怀疑设备标记实际上是特殊值,在其表示的后端挂起了非平凡类型。我们不建议使用这种方法,因为它可能会导致非常奇怪的错误消息(如您收到的错误消息),但鉴于这种情况,您需要完全使用上面描述的模式,以便只剥离一个级别的列表


为便于将来参考,该链接上的脚本(据推测是有效的)是:

我自己会写得更像这样:

# Connect to the Digilent Cable on localhost:3121
connect_hw_server -url localhost:3121
current_hw_target [get_hw_targets */xilinx_tcf/Digilent/12345]
open_hw_target

# Program and Refresh the XC7K325T Device
set Device [lindex [get_hw_devices] 0]
current_hw_device $Device
refresh_hw_device -update_hw_probes false $Device
set_property PROGRAM.FILE "C:/design.bit" $Device
set_property PROBES.FILE "C:/design.ltx" $Device

program_hw_devices $Device
refresh_hw_device $Device
所以我只做一次列表提取,但这纯粹是一种风格;如果一个有效,另一个也应该有效。

看看,我们发现推荐的用法是:

program_hw_devices [lindex [get_hw_devices] 0]
考虑到
get_hw_devices
的输出文本是一个“简单”字(没有空格或Tcl元字符),我怀疑设备标记实际上是特殊值,在其表示的后端挂起了非平凡类型。我们不建议使用这种方法,因为它可能会导致非常奇怪的错误消息(如您收到的错误消息),但鉴于这种情况,您需要完全使用上面描述的模式,以便只剥离一个级别的列表


为便于将来参考,该链接上的脚本(据推测是有效的)是:

我自己会写得更像这样:

# Connect to the Digilent Cable on localhost:3121
connect_hw_server -url localhost:3121
current_hw_target [get_hw_targets */xilinx_tcf/Digilent/12345]
open_hw_target

# Program and Refresh the XC7K325T Device
set Device [lindex [get_hw_devices] 0]
current_hw_device $Device
refresh_hw_device -update_hw_probes false $Device
set_property PROGRAM.FILE "C:/design.bit" $Device
set_property PROBES.FILE "C:/design.ltx" $Device

program_hw_devices $Device
refresh_hw_device $Device
所以我只做一次列表提取,但这纯粹是一种风格;如果一个有效,另一个也应该有效