使用tcl在vivado中编程设备

Programming device in vivado using tcl

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

program_hw_devices [get_hw_devices xc7a100t_0]

然后如果我 运行 puts [get_hw_devices xc7a100t_0] 它输出 xc7a100t_0 这让我认为我应该能够做类似 program_hw_devices xc7a100t_0 的事情。然而,这失败了,我得到以下输出。

ERROR: [Common 17-161] Invalid option value 'xc7a100t_0' specified for 'hw_device'.

我真的不明白这有什么问题。我认为这两个命令是等价的,因为我只是将 get_hw_devices 返回的内容传递给它。我还认为 tcl 中所有内容的类型都只是一个字符串。 [get_hw_devices xc7a100t_0] 的输出是否有一些特殊类型?

查看usage patterns,我们看到推荐的用法是:

program_hw_devices [lindex [get_hw_devices] 0]

鉴于 get_hw_devices 的输出文本是一个“简单”的词(没有空格或 Tcl 元字符),我怀疑设备标记实际上是特殊值,它们具有非平凡的类型他们代表的后端。我们不推荐这种方法,因为它会导致非常奇怪的错误消息(例如您收到的错误消息),但鉴于它是这样,您需要完全按照上述方式使用模式,以便您恰好去除一个级别列出清单。


为了将来参考,link 处的脚本(据说可以正常工作)是:

# 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

current_hw_device [lindex [get_hw_devices] 0]
refresh_hw_device -update_hw_probes false [lindex [get_hw_devices] 0]
set_property PROGRAM.FILE {C:/design.bit} [lindex [get_hw_devices] 0]
set_property PROBES.FILE {C:/design.ltx} [lindex [get_hw_devices] 0]

program_hw_devices [lindex [get_hw_devices] 0]
refresh_hw_device [lindex [get_hw_devices] 0]

我自己会更像这样写:

# 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

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