File io 使用TCL脚本在多个文件上运行命令

File io 使用TCL脚本在多个文件上运行命令,file-io,tcl,simulation,synopsys-vcs,File Io,Tcl,Simulation,Synopsys Vcs,我正在使用某个工具(Synopsys Design Vision),我正在使用TCL脚本运行该工具 命令是这样的 analyze -library work -format verilog {/user/codes/abcd.v } for { set a 1} {$a < 5001} {incr a} { analyze -library work -format verilog {/user/codes/abcd_$a.v } #other commands . . } 现在,我

我正在使用某个工具(Synopsys Design Vision),我正在使用TCL脚本运行该工具

命令是这样的

analyze -library work -format verilog {/user/codes/abcd.v }
for { set a 1}  {$a < 5001} {incr a} {
analyze -library work -format verilog {/user/codes/abcd_$a.v }
#other commands
.
.
}
现在,我有了一个包含5000个.v扩展名文件的文件夹,这些文件的名称为abcd_1、abcd_2、abcd_3…..abcd_5000。现在,我想使脚本自动化,以便命令可以在每个文件上工作

我试着做这样的事

analyze -library work -format verilog {/user/codes/abcd.v }
for { set a 1}  {$a < 5001} {incr a} {
analyze -library work -format verilog {/user/codes/abcd_$a.v }
#other commands
.
.
}
对于{set a 1}{$a<5001}{incr a}{
分析-库工作-格式verilog{/user/code/abcd_$a.v}
#其他命令
.
.
}
但是,它不起作用,并且会产生错误。我没有那么多使用tcl脚本


请详细说明我哪里出了问题,以及我能做些什么使其正常工作。谢谢。

简而言之,请使用引号而不是大括号,因为大括号可以防止这种情况发生:

for {set a 1}  {$a < 5001} {incr a} {
  analyze -library work -format verilog "/user/codes/abcd_$a.v"
  # ...
}
对于{set a 1}{$a<5001}{incr a}{
分析-库工作-格式化verilog“/用户/代码/abcd\u$a.v”
# ...
}

但是,您可能还希望签出
file
命令来组合文件路径。

Tcl大括号防止变量展开,只需在shell中用单引号括起来即可。请使用双引号。请注意,您的引号样式使得“.v”后面的空格很重要。您的文件是否以“点v空格”结尾?