在python中我调用了VCS工具编译文件,见:
【python脚本】当我需要一个完整的rtl list时,还是选择求助vcs吧
当时我是需要借助vcs的力量把文件都编译出来得到文件的filelist,但是我发先如果文件有错的话就会中止的脚本,哪怕我用了try保护都没法阻止:
def wrap_catch_except(f):
def wrapper(*args, **kwargs):
try:
return f(*args, **kwargs)
except Exception, e:
print("error %s" % e)
return wrapper
我发现脚本还是中断了。
直到最后,我绝望的把代码改成了。
原来:
cmd = "vcs -f tb.f -l %s +libext+.sv+.v +v2k -sverilog -ntb_opts uvm-1.2 -timescale=1ns/1ps -unit_timescale=1ns/1ps" % sys_log
os.system(cmd) if re_cmp == True or not os.path.exists(sys_log) else ""
之后:
cmd = "vcs -f tb.f -l %s +libext+.sv+.v +v2k -sverilog -ntb_opts uvm-1.2 -timescale=1ns/1ps -unit_timescale=1ns/1ps > log" % sys_log
os.system(cmd) if re_cmp == True or not os.path.exists(sys_log) else ""
脚本就可以继续执行下去了~
所以只要避免让执行过程在屏幕上打印,就不会影响到脚本的执行?