问题
I want to conditionally append options when calling a Tcl command. I'm using a Xilinx Tcl command synth_design as indicated in UG835 p.1042 using Tcl version 8.5.
For instance, I want to:
- build a data structure that will append 0 or more of
-verilog_define MACROwhere-verilog_defineis not a string but an option, and - pass that structure to the command in its expanded form.
Where this:
synth_design -top ${top}_top -part ${part} -verilog_define MACRO1 -verilog_define MACRO2
^-------------------------------------------^
Becomes this:
synth_design -top ${top}_top -part ${part} ???
^-^
回答1:
With {*}$makro (expansion)
E.g.:
set makro {-verilog_define MACRO1 -verilog_define MACRO2}
synth_design -top ${top}_top -part ${part} {*}$makro
来源:https://stackoverflow.com/questions/26169533/how-to-call-tcl-command-with-conditional-option