Loading a design¶
Input files on the command line¶
guesses frontend based on file extension
.v->read -vlog2k.sv->read -sv.vhdand.vhdl->read -vhdl.blifand.eblif->read_blif.json->read_json.il->read_rtlil(direct textual representation of Yosys internal state)
command line also supports
The read command¶
standard method of loading designs
also for defining macros and include directories
uses
verificcommand if available-verificand-noverificoptions to enforce with/without Verificcheck
help readfor more about the options available and the filetypes supportedelaborate designs with
verific -import [options] <top>(or usehierarchy)
fallback to
read_verilogwith-deferoptiondoes not compile design until
hierarchycommand as discussed in Synthesis startermore similar to
verificbehaviour
read -defineet al mapped toverificorverilog_definessimilarly,
read -incdiret al mapped toverificorverilog_defaults
Note
The Verific frontend for Yosys, which provides the verific
command, requires Yosys to be built with Verific. For full functionality,
custom modifications to the Verific source code from YosysHQ are required,
but limited useability can be achieved with some stock Verific builds. Check
Compiling with Verific library for more.
Yosys frontends¶
typically start with
read_built-in support for heredocs
in-line code with
<<EOTcan use any eot marker, but EOT (End-of-Transmission) and EOF (End-of-File) are most common
built-in support for reading multiple files in the same command
executed as multiple successive calls to the frontend
compatible with
-fcommand line option, e.g.yosys -f verilog design.txtwill use theread_verilogfrontend with the input filedesign.txtverificandreadcommands are technically not ‘Frontends’, but their behaviour is kept in sync
Note
‘Frontend’ here means that the command is implemented as a sub-class of
RTLIL::Frontend, as opposed to the usual RTLIL::Pass.
The read_verilog command¶
supports most of Verilog-2005
limited support for SystemVerilog
some non-standard features/extensions for enabling formal verification
please do not rely on
read_verilogfor syntax checkingrecommend using a simulator (for example Icarus Verilog) or linting with another tool (such as verilator) first
read_verilog file1.v
read_verilog -I include_dir -D enable_foo -D WIDTH=12 file2.v
read_verilog -lib cell_library.v
verilog_defaults -add -I include_dir
read_verilog file3.v
read_verilog file4.v
verilog_defaults -clear
verilog_defaults -push
verilog_defaults -add -I include_dir
read_verilog file5.v
read_verilog file6.v
verilog_defaults -pop
Other built-in read_* commands¶
Externally maintained plugins¶
GHDL plugin for VHDL (check
help ghdl)yosys-slang plugin for more comprehensive SystemVerilog support (check
help read_slang)yosys-slang is implemented as a ‘Frontend,’ with all the built-in support that entails
both plugins above are included in OSS CAD Suite