使用 tcl 在 vi​​vado 中编程设备 [英] Programming device in vivado using tcl

查看:34
本文介绍了使用 tcl 在 vi​​vado 中编程设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

program_hw_devices [get_hw_devices xc7a100t_0]

然后,如果我运行 puts [get_hw_devices xc7a100t_0] 它输出 xc7a100t_0 这让我认为我应该能够做一些像 program_hw_devices xc7a100t_0.然而,这失败了,我得到了以下输出.

<块引用>

错误:[Common 17-161] 选项无效为hw_device"指定的值xc7a100t_0".

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

解决方案

使用模式,我们看到推荐的用法是:

program_hw_devices [lindex [get_hw_devices] 0]

鉴于 get_hw_devices 的输出文本是一个简单"词(没有空格或 Tcl 元字符),我怀疑设备令牌实际上是具有非平凡类型的特殊值他们代表的后端.我们不推荐这种方法,因为它可能会导致非常奇怪的错误消息(例如您收到的错误消息),但鉴于确实如此,您需要完全使用上述模式,以便您只删除一层远离列表.

<小时>

为了将来参考,该链接上的脚本(据说可以工作)是:

<块引用>

# 连接到 localhost:3121 上的 Digilent 电缆connect_hw_server -url 本地主机:3121current_hw_target [get_hw_targets */xilinx_tcf/Digilent/12345]open_hw_target# 编程和刷新 XC7K325T 设备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]

我自己会写得更像这样:

# 连接到 localhost:3121 上的 Digilent 电缆connect_hw_server -url 本地主机:3121current_hw_target [get_hw_targets */xilinx_tcf/Digilent/12345]open_hw_target# 编程和刷新 XC7K325T 设备设置设备 [lindex [get_hw_devices] 0]current_hw_device $Devicerefresh_hw_device -update_hw_probes false $Deviceset_property PROGRAM.FILE "C:/design.bit" $Deviceset_property PROBES.FILE "C:/design.ltx" $Deviceprogram_hw_devices $Devicerefresh_hw_device $Device

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

I am trying out programming my digilent FPGA through the vivado command line. After opening the hardware server I can program my device as follows...

program_hw_devices [get_hw_devices xc7a100t_0]

Then if I run puts [get_hw_devices xc7a100t_0] it outputs xc7a100t_0 which leads me to think that I should be able to just do something like program_hw_devices xc7a100t_0. This however fails and I get the following output.

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

I don't really understand what is wrong with this. I thought the two commands would be equivalent since I just passed it what was returned by get_hw_devices. Also I thought the type of everything in tcl was just a string. Does the output of [get_hw_devices xc7a100t_0] have some special type?

解决方案

Looking at usage patterns, we see that the recommended usage is:

program_hw_devices [lindex [get_hw_devices] 0]

Given the text of the output of get_hw_devices is a "simple" word (no spaces or Tcl metacharacters), I suspect that the device tokens are actually special values that have non-trivial types hanging off the back end of their representation. We don't recommend that approach as it can lead to very weird error messages (such as the one you got), but given that it is so, you need to use exactly the pattern as described above so that you strip exactly one level of list-ness away.


For future reference, the script at that link (which was supposedly working) was:

# 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]

I would have written it more like this myself:

# 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

so that I only do the list extraction once, but that's purely style; if one works, the other should as well.

这篇关于使用 tcl 在 vi​​vado 中编程设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆