我正在尝试通过vivado命令行编程我的digilent FPGA。打开硬件服务器后,我可以按如下方式对设备进行编程......
program_hw_devices [get_hw_devices xc7a100t_0]
然后,如果我运行puts [get_hw_devices xc7a100t_0]
,则会输出xc7a100t_0
,这会让我认为我应该能够执行program_hw_devices xc7a100t_0
之类的操作。然而,这失败了,我得到以下输出。
错误:[通用17-161]无效选项 为'hw_device'指定的值'xc7a100t_0'。
我真的不明白这有什么问题。我认为这两个命令是等价的,因为我刚刚传递了get_hw_devices返回的内容。另外我认为tcl中所有东西的类型只是一个字符串。 [get_hw_devices xc7a100t_0]
的输出是否有某种特殊类型?
答案 0 :(得分:1)
查看usage patterns,我们看到建议的用法是:
program_hw_devices [lindex [get_hw_devices] 0]
鉴于get_hw_devices
的输出文本是一个“简单”单词(没有空格或Tcl元字符),我怀疑设备标记实际上是特殊值,其中有非平凡类型悬挂在后端他们的代表。我们不推荐这种方法,因为它可能会导致非常奇怪的错误消息(例如你得到的错误消息),但鉴于它是如此,你需要使用上面描述的模式,以便你只删除一个级别的list-ness away。
为了将来参考,该链接的脚本(据说可行)是:
# 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
所以我只进行一次列表提取,但那是纯粹的风格;如果一个人工作,另一个人也应该。