innovus里source tcl script时,如何插入一个结束符,忽略掉后续的行?
专栏:iLoveIC Sept. 10, 2025, 6:06 p.m. 13 阅读
芯片中后端flow里,用return来分段debug tcl script

在debug芯片中后端flow script时,经常需要单行或分段复制到eda shell里看执行效果。如果能够在tcl script里设置断点,就能带来很大的便利。

# exec these cmds
# <-- break here
# omit following cmds

经过请教和尝试,发现tcl的return正是需要的功能。

https://www.tcl-lang.org/man/tcl8.6/TclCmd/return.htmreturn的作用描述如下:

In its simplest usage, the return command is used without options in the body of a procedure to immediately return control to the caller of the procedure. If a result argument is provided, its value becomes the result of the procedure passed back to the caller. If result is not specified then an empty string will be returned to the caller as the result of the procedure.

The return command serves a similar function within script files that are evaluated by the source command. When source evaluates the contents of a file as a script, an invocation of the return command will cause script evaluation to immediately cease, and the value result (or an empty string) will be returned as the result of the source command.

简单来说return有两个作用:
1、用在函数里,遇到return时,立即结束函数执行。
2、用在source的script里,遇到return时,立即结束script剩余代码的执行。

 

感谢阅读,更多文章点击这里:【专栏:iLoveIC】
最新20篇 开设专栏