What is a good “template” Yosys synthesis script?

半城伤御伤魂 提交于 2019-12-10 15:26:25

问题


I want to write my own Yosys synthesis script. What is a good template to start with? The manual and webpage contain various examples, but no "authoritative" hello world example.


回答1:


The synth command runs the recommended script for general-purpose synthesis tasks. See help synth for a complete list of commands called by this meta-command.

Your script should either borrow from synth or simply call synth to get the general-purpose stuff done. Many scripts call synth -run coarse for the coarse-grain part of synthesis and then continue with a custom sequence of commands for fine grains synthesis. See for example synth_xilinx.

For ASIC synthesis to a library in liberty format, use the following script as a starting point:

# read design 
read_verilog mydesign.v

# generic synthesis
synth -top mytop

# mapping to mycells.lib
dfflibmap -liberty mycells.lib
abc -liberty mycells.lib
clean

# write synthesized design
write_verilog synth.v

A less aggressive set of optimizations is often desired for scripts that do formal verification. In this cases the following sequence of commands is usually a good starting point for the "synthesis" portion of a formal verification flow:

hierarchy [-check -top <top-module>]
proc; opt; memory [-nomap]; opt -fast; check -assert



回答2:


Don't forget to put the mycells.lib and mycells.v file in the directory where you invoke yosys. A good example is on yosys's GitHub site under the directory "examples/cmos", where they have placed examples of cmos_cell.lib and cmos_cell.v files.

read_verilog counter.v
read_verilog -lib cmos_cells.v

proc;; memory;; techmap;;

dfflibmap -liberty cmos_cells.lib
abc -liberty cmos_cells.lib;;

write_verilog synth.v

(Also, if you want a more human readable synthesis output you can modify the .lib and .v file to change NAND and NOR gates into AND and OR gates.)



来源:https://stackoverflow.com/questions/31434380/what-is-a-good-template-yosys-synthesis-script

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