foreach command in tcl to read a file

I have 6 files in a directory; Av , A.def , Bv , B.def , Cv , C.def .

I want to read the Av and A.def files at once and go to Bv and B.def and so on. I am using the following snippet to carry out the above-said function but it is throwing errors.

foreach i [glob "./*.v"] {
    read_verilog $i.v
    read_def $i.def
}

I would like to set the variable to read just the name A, B, C etc.


你想在这里使用file rootname命令:

foreach file [glob -nocomplain "./*.v"] {
    read_verilog $file
    read_def [file rootname $file].def
}
链接地址: http://www.djcxy.com/p/67746.html

上一篇: 从TCL调用python脚本并自动创建一个文件

下一篇: 在tcl中用foreach命令读取文件