Can we have variables in a Yosys script?

半城伤御伤魂 提交于 2019-12-23 20:21:25

问题


I'd like to make my Yosys scripts more DRY by factoring out common parameters, such as 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 de-reference variables, is there any way like in TCL (set lib_file /long/path/to/lib/file) or Bash (export lib_file=/long/path/to/lib/file)?


回答1:


You can use TCL. See yosys -h tcl for details. Run TCL scripts with yosys -c <script_file> (instead of yosys -s <script_file> for native Yosys scripts.)

I've now added front-end detection for .tcl files in commit b8d7f57. So starting with b8d7f57 you can also use yosys <script_file> to run a TCL script, if <script_file> ends with .tcl.



来源:https://stackoverflow.com/questions/43062516/can-we-have-variables-in-a-yosys-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!