在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 3185|回复: 6

[讨论] vivado传参

[复制链接]
发表于 2021-3-8 14:31:36 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
使用vivado工具,如何在启动命令中传入 module名给tcl主脚本使用?
发表于 2021-3-8 17:29:45 | 显示全部楼层
All Tcl scripts have access to three predefined variables.
$argc - number items of arguments passed to a script.
$argv - list of the arguments.
$argv0 - name of the script.
 楼主| 发表于 2021-3-9 09:50:18 | 显示全部楼层


A1985 发表于 2021-3-8 17:29
All Tcl scripts have access to three predefined variables.
$argc - number items of arguments passed  ...


兄弟,还是不懂,能否给个例子?多谢多谢
发表于 2021-3-9 12:17:23 | 显示全部楼层

Syntax:
vivado  [-mode <arg>] [-init] [-source <arg>] [-nojournal] [-appjournal]
        [-journal <arg>] [-nolog] [-applog] [-log <arg>] [-version]
        [-tclargs <arg>] [-tempDir <arg>] [-robot <arg>] [-verbose] [<project>]

Usage:
  Name           Description
  --------------------------
  [-mode]        Invocation mode, allowed values are 'gui', 'tcl', and
                 'batch'
                 Default: gui
  [-init]        Source vivado.tcl file
  [-source]      Source the specified Tcl file
  [-nojournal]   Do not create a journal file
  [-appjournal]  Open journal file in append mode
  [-journal]     Journal file name
                 Default: vivado.jou
  [-nolog]       Do not create a log file
  [-applog]      Open log file in append mode
  [-log]         Log file name
                 Default: vivado.log
  [-version]     Output version information and exit
  [-tclargs]     Arguments passed on to tcl argc argv
  [-tempDir]     Temporary directory name.
  [-robot]       Robot JAR file name.
  [-verbose]     Suspend message limits during command execution
  [<project>]    Load the specified project (.xpr) or design checkpoint
                 (.dcp) file



===》 vivado -source xxx.tcl -tclargs a b c d
 楼主| 发表于 2021-3-9 15:13:45 | 显示全部楼层


A1985 发表于 2021-3-9 12:17
Syntax:
vivado  [-mode ] [-init] [-source ] [-nojournal] [-appjournal]
        [-journal ] [-nolog ...


你举例中的 a b c d分别是什么?
这个选项我try run过很多次,但是都不成功,无法将变量传递到我得tcl脚本中
发表于 2021-3-9 17:34:19 | 显示全部楼层
本帖最后由 A1985 于 2021-3-9 17:36 编辑


hitten 发表于 2021-3-9 15:13
你举例中的 a b c d分别是什么?
这个选项我try run过很多次,但是都不成功,无法将变量传递到我得tcl脚 ...


test.tcl
puts "tcl file name: $argv0"
puts "number tcl args: $argc"

for {set i 0} {$i < $argc} {incr i} {
    puts "argv($i) is [lindex $argv $i]."
}



%vivado -mode tcl -source test.tcl -tclargs 1 2 3 4 5


==>

****** Vivado v2019.2 (64-bit)
  **** SW Build 2708876 on Wed Nov  6 21:39:14 MST 2019
  **** IP Build 2700528 on Thu Nov  7 00:09:20 MST 2019
    ** Copyright 1986-2019 Xilinx, Inc. All Rights Reserved.

source test.tcl
# puts "tcl file name: $argv0"
tcl file name:test.tcl
# puts "number tcl args: $argc"
number tcl args:5
# for {set i 0} {$i < $argc} {incr i} {
#     puts "argv($i) is [lindex $argv $i]."
# }
argv(0) is 1.
argv(1) is 2.
argv(2) is 3.
argv(3) is 4.
argv(4) is 5.
Vivado%


 楼主| 发表于 2021-3-10 09:37:03 | 显示全部楼层


A1985 发表于 2021-3-9 17:34
test.tcl
puts "tcl file name: $argv0"
puts "number tcl args: $argc"


非常感谢兄弟
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-2-2 05:46 , Processed in 0.020980 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表