Can we have variables in Yosys script?
I would like to make my Yosys scripts drier by separating common options, for example in the following example:
read_liberty -lib /long/path/to/lib/file
...
dfflibmap -liberty /long/path/to/lib/file
...
abc -liberty /long/path/to/lib/file
I haven't found a way to declare or remove a reference to variables, is there a way like in TCL ( set lib_file /long/path/to/lib/file
) or Bash ( export lib_file=/long/path/to/lib/file
)?
source to share
You can use TCL. For details see yosys -h tcl
. Run TCL scripts with yosys -c <script_file>
(instead of yosys -s <script_file>
for your own Yosys scripts.)
I have now added interface detection for .tcl files in commit b8d7f57. So starting with b8d7f57 you can also use a yosys <script_file>
TCL script to run if <script_file>
ends with .tcl
.
source to share