Merge pull request #1927 from YosysHQ/eddie/design_remove_assert
[yosys.git] / manual / command-reference-manual.tex
1 % Generated using the yosys 'help -write-tex-command-reference-manual' command.
2
3 \section{abc -- use ABC for technology mapping}
4 \label{cmd:abc}
5 \begin{lstlisting}[numbers=left,frame=single]
6 abc [options] [selection]
7
8 This pass uses the ABC tool [1] for technology mapping of yosys's internal gate
9 library to a target architecture.
10
11 -exe <command>
12 use the specified command instead of "<yosys-bindir>/yosys-abc" to execute ABC.
13 This can e.g. be used to call a specific version of ABC or a wrapper.
14
15 -script <file>
16 use the specified ABC script file instead of the default script.
17
18 if <file> starts with a plus sign (+), then the rest of the filename
19 string is interpreted as the command string to be passed to ABC. The
20 leading plus sign is removed and all commas (,) in the string are
21 replaced with blanks before the string is passed to ABC.
22
23 if no -script parameter is given, the following scripts are used:
24
25 for -liberty without -constr:
26 strash; ifraig; scorr; dc2; dretime; strash; &get -n; &dch -f;
27 &nf {D}; &put
28
29 for -liberty with -constr:
30 strash; ifraig; scorr; dc2; dretime; strash; &get -n; &dch -f;
31 &nf {D}; &put; buffer; upsize {D}; dnsize {D}; stime -p
32
33 for -lut/-luts (only one LUT size):
34 strash; ifraig; scorr; dc2; dretime; strash; dch -f; if; mfs2;
35 lutpack {S}
36
37 for -lut/-luts (different LUT sizes):
38 strash; ifraig; scorr; dc2; dretime; strash; dch -f; if; mfs2
39
40 for -sop:
41 strash; ifraig; scorr; dc2; dretime; strash; dch -f;
42 cover {I} {P}
43
44 otherwise:
45 strash; ifraig; scorr; dc2; dretime; strash; &get -n; &dch -f;
46 &nf {D}; &put
47
48 -fast
49 use different default scripts that are slightly faster (at the cost
50 of output quality):
51
52 for -liberty without -constr:
53 strash; dretime; map {D}
54
55 for -liberty with -constr:
56 strash; dretime; map {D}; buffer; upsize {D}; dnsize {D};
57 stime -p
58
59 for -lut/-luts:
60 strash; dretime; if
61
62 for -sop:
63 strash; dretime; cover -I {I} -P {P}
64
65 otherwise:
66 strash; dretime; map
67
68 -liberty <file>
69 generate netlists for the specified cell library (using the liberty
70 file format).
71
72 -constr <file>
73 pass this file with timing constraints to ABC. use with -liberty.
74
75 a constr file contains two lines:
76 set_driving_cell <cell_name>
77 set_load <floating_point_number>
78
79 the set_driving_cell statement defines which cell type is assumed to
80 drive the primary inputs and the set_load statement sets the load in
81 femtofarads for each primary output.
82
83 -D <picoseconds>
84 set delay target. the string {D} in the default scripts above is
85 replaced by this option when used, and an empty string otherwise.
86 this also replaces 'dretime' with 'dretime; retime -o {D}' in the
87 default scripts above.
88
89 -I <num>
90 maximum number of SOP inputs.
91 (replaces {I} in the default scripts above)
92
93 -P <num>
94 maximum number of SOP products.
95 (replaces {P} in the default scripts above)
96
97 -S <num>
98 maximum number of LUT inputs shared.
99 (replaces {S} in the default scripts above, default: -S 1)
100
101 -lut <width>
102 generate netlist using luts of (max) the specified width.
103
104 -lut <w1>:<w2>
105 generate netlist using luts of (max) the specified width <w2>. All
106 luts with width <= <w1> have constant cost. for luts larger than <w1>
107 the area cost doubles with each additional input bit. the delay cost
108 is still constant for all lut widths.
109
110 -luts <cost1>,<cost2>,<cost3>,<sizeN>:<cost4-N>,..
111 generate netlist using luts. Use the specified costs for luts with 1,
112 2, 3, .. inputs.
113
114 -sop
115 map to sum-of-product cells and inverters
116
117 -g type1,type2,...
118 Map to the specified list of gate types. Supported gates types are:
119 AND, NAND, OR, NOR, XOR, XNOR, ANDNOT, ORNOT, MUX,
120 NMUX, AOI3, OAI3, AOI4, OAI4.
121 (The NOT gate is always added to this list automatically.)
122
123 The following aliases can be used to reference common sets of gate types:
124 simple: AND OR XOR MUX
125 cmos2: NAND NOR
126 cmos3: NAND NOR AOI3 OAI3
127 cmos4: NAND NOR AOI3 OAI3 AOI4 OAI4
128 cmos: NAND NOR AOI3 OAI3 AOI4 OAI4 NMUX MUX XOR XNOR
129 gates: AND NAND OR NOR XOR XNOR ANDNOT ORNOT
130 aig: AND NAND OR NOR ANDNOT ORNOT
131
132 The alias 'all' represent the full set of all gate types.
133
134 Prefix a gate type with a '-' to remove it from the list. For example
135 the arguments 'AND,OR,XOR' and 'simple,-MUX' are equivalent.
136
137 The default is 'all,-NMUX,-AOI3,-OAI3,-AOI4,-OAI4'.
138
139 -dff
140 also pass $_DFF_?_ and $_DFFE_??_ cells through ABC. modules with many
141 clock domains are automatically partitioned in clock domains and each
142 domain is passed through ABC independently.
143
144 -clk [!]<clock-signal-name>[,[!]<enable-signal-name>]
145 use only the specified clock domain. this is like -dff, but only FF
146 cells that belong to the specified clock domain are used.
147
148 -keepff
149 set the "keep" attribute on flip-flop output wires. (and thus preserve
150 them, for example for equivalence checking.)
151
152 -nocleanup
153 when this option is used, the temporary files created by this pass
154 are not removed. this is useful for debugging.
155
156 -showtmp
157 print the temp dir name in log. usually this is suppressed so that the
158 command output is identical across runs.
159
160 -markgroups
161 set a 'abcgroup' attribute on all objects created by ABC. The value of
162 this attribute is a unique integer for each ABC process started. This
163 is useful for debugging the partitioning of clock domains.
164
165 -dress
166 run the 'dress' command after all other ABC commands. This aims to
167 preserve naming by an equivalence check between the original and post-ABC
168 netlists (experimental).
169
170 When neither -liberty nor -lut is used, the Yosys standard cell library is
171 loaded into ABC before the ABC script is executed.
172
173 Note that this is a logic optimization pass within Yosys that is calling ABC
174 internally. This is not going to "run ABC on your design". It will instead run
175 ABC on logic snippets extracted from your design. You will not get any useful
176 output when passing an ABC script that writes a file. Instead write your full
177 design as BLIF file with write_blif and then load that into ABC externally if
178 you want to use ABC to convert your design into another format.
179
180 [1] http://www.eecs.berkeley.edu/~alanmi/abc/
181 \end{lstlisting}
182
183 \section{abc9 -- use ABC9 for technology mapping}
184 \label{cmd:abc9}
185 \begin{lstlisting}[numbers=left,frame=single]
186 abc9 [options] [selection]
187
188 This script pass performs a sequence of commands to facilitate the use of the ABC
189 tool [1] for technology mapping of the current design to a target FPGA
190 architecture. Only fully-selected modules are supported.
191
192 -run <from_label>:<to_label>
193 only run the commands between the labels (see below). an empty
194 from label is synonymous to 'begin', and empty to label is
195 synonymous to the end of the command list.
196
197 -exe <command>
198 use the specified command instead of "<yosys-bindir>/yosys-abc" to execute ABC.
199 This can e.g. be used to call a specific version of ABC or a wrapper.
200
201 -script <file>
202 use the specified ABC script file instead of the default script.
203
204 if <file> starts with a plus sign (+), then the rest of the filename
205 string is interpreted as the command string to be passed to ABC. The
206 leading plus sign is removed and all commas (,) in the string are
207 replaced with blanks before the string is passed to ABC.
208
209 if no -script parameter is given, the following scripts are used:
210 &scorr; &sweep; &dc2; &dch -f; &ps; &if {C} {W} {D} {R} -v; &mfs
211
212 -fast
213 use different default scripts that are slightly faster (at the cost
214 of output quality):
215 &if {C} {W} {D} {R} -v
216
217 -D <picoseconds>
218 set delay target. the string {D} in the default scripts above is
219 replaced by this option when used, and an empty string otherwise
220 (indicating best possible delay).
221
222 -lut <width>
223 generate netlist using luts of (max) the specified width.
224
225 -lut <w1>:<w2>
226 generate netlist using luts of (max) the specified width <w2>. All
227 luts with width <= <w1> have constant cost. for luts larger than <w1>
228 the area cost doubles with each additional input bit. the delay cost
229 is still constant for all lut widths.
230
231 -lut <file>
232 pass this file with lut library to ABC.
233
234 -luts <cost1>,<cost2>,<cost3>,<sizeN>:<cost4-N>,..
235 generate netlist using luts. Use the specified costs for luts with 1,
236 2, 3, .. inputs.
237
238 -maxlut <width>
239 when auto-generating the lut library, discard all luts equal to or
240 greater than this size (applicable when neither -lut nor -luts is
241 specified).
242
243 -dff
244 also pass $_ABC9_FF_ cells through to ABC. modules with many clock
245 domains are marked as such and automatically partitioned by ABC.
246
247 -nocleanup
248 when this option is used, the temporary files created by this pass
249 are not removed. this is useful for debugging.
250
251 -showtmp
252 print the temp dir name in log. usually this is suppressed so that the
253 command output is identical across runs.
254
255 -box <file>
256 pass this file with box library to ABC.
257
258 Note that this is a logic optimization pass within Yosys that is calling ABC
259 internally. This is not going to "run ABC on your design". It will instead run
260 ABC on logic snippets extracted from your design. You will not get any useful
261 output when passing an ABC script that writes a file. Instead write your full
262 design as an XAIGER file with `write_xaiger' and then load that into ABC
263 externally if you want to use ABC to convert your design into another format.
264
265 [1] http://www.eecs.berkeley.edu/~alanmi/abc/
266
267
268 pre:
269 abc9_ops -check
270 scc -set_attr abc9_scc_id {}
271 abc9_ops -mark_scc -prep_delays -prep_xaiger [-dff] (option for -dff)
272 abc9_ops -prep_lut <maxlut> (skip if -lut or -luts)
273 abc9_ops -prep_box [-dff] (skip if -box)
274 select -set abc9_holes A:abc9_holes
275 flatten -wb @abc9_holes
276 techmap @abc9_holes
277 abc9_ops -prep_dff (only if -dff)
278 opt -purge @abc9_holes
279 aigmap
280 wbflip @abc9_holes
281
282 map:
283 foreach module in selection
284 abc9_ops -write_lut <abc-temp-dir>/input.lut (skip if '-lut' or '-luts')
285 abc9_ops -write_box <abc-temp-dir>/input.box
286 write_xaiger -map <abc-temp-dir>/input.sym <abc-temp-dir>/input.xaig
287 abc9_exe [options] -cwd <abc-temp-dir> [-lut <abc-temp-dir>/input.lut] -box <abc-temp-dir>/input.box
288 read_aiger -xaiger -wideports -module_name <module-name>$abc9 -map <abc-temp-dir>/input.sym <abc-temp-dir>/output.aig
289 abc9_ops -reintegrate
290 \end{lstlisting}
291
292 \section{abc9\_exe -- use ABC9 for technology mapping}
293 \label{cmd:abc9_exe}
294 \begin{lstlisting}[numbers=left,frame=single]
295 abc9_exe [options]
296
297
298 This pass uses the ABC tool [1] for technology mapping of the top module
299 (according to the (* top *) attribute or if only one module is currently selected)
300 to a target FPGA architecture.
301
302 -exe <command>
303 use the specified command instead of "<yosys-bindir>/yosys-abc" to execute ABC.
304 This can e.g. be used to call a specific version of ABC or a wrapper.
305
306 -script <file>
307 use the specified ABC script file instead of the default script.
308
309 if <file> starts with a plus sign (+), then the rest of the filename
310 string is interpreted as the command string to be passed to ABC. The
311 leading plus sign is removed and all commas (,) in the string are
312 replaced with blanks before the string is passed to ABC.
313
314 if no -script parameter is given, the following scripts are used:
315 &scorr; &sweep; &dc2; &dch -f; &ps; &if {C} {W} {D} {R} -v; &mfs
316
317 -fast
318 use different default scripts that are slightly faster (at the cost
319 of output quality):
320 &if {C} {W} {D} {R} -v
321
322 -D <picoseconds>
323 set delay target. the string {D} in the default scripts above is
324 replaced by this option when used, and an empty string otherwise
325 (indicating best possible delay).
326
327 -lut <width>
328 generate netlist using luts of (max) the specified width.
329
330 -lut <w1>:<w2>
331 generate netlist using luts of (max) the specified width <w2>. All
332 luts with width <= <w1> have constant cost. for luts larger than <w1>
333 the area cost doubles with each additional input bit. the delay cost
334 is still constant for all lut widths.
335
336 -lut <file>
337 pass this file with lut library to ABC.
338
339 -luts <cost1>,<cost2>,<cost3>,<sizeN>:<cost4-N>,..
340 generate netlist using luts. Use the specified costs for luts with 1,
341 2, 3, .. inputs.
342
343 -showtmp
344 print the temp dir name in log. usually this is suppressed so that the
345 command output is identical across runs.
346
347 -box <file>
348 pass this file with box library to ABC.
349
350 -cwd <dir>
351 use this as the current working directory, inside which the 'input.xaig'
352 file is expected. temporary files will be created in this directory, and
353 the mapped result will be written to 'output.aig'.
354
355 Note that this is a logic optimization pass within Yosys that is calling ABC
356 internally. This is not going to "run ABC on your design". It will instead run
357 ABC on logic snippets extracted from your design. You will not get any useful
358 output when passing an ABC script that writes a file. Instead write your full
359 design as BLIF file with write_blif and then load that into ABC externally if
360 you want to use ABC to convert your design into another format.
361
362 [1] http://www.eecs.berkeley.edu/~alanmi/abc/
363 \end{lstlisting}
364
365 \section{abc9\_ops -- helper functions for ABC9}
366 \label{cmd:abc9_ops}
367 \begin{lstlisting}[numbers=left,frame=single]
368 abc9_ops [options] [selection]
369
370 This pass contains a set of supporting operations for use during ABC technology
371 mapping, and is expected to be called in conjunction with other operations from
372 the `abc9' script pass. Only fully-selected modules are supported.
373
374 -check
375 check that the design is valid, e.g. (* abc9_box_id *) values are unique,
376 (* abc9_carry *) is only given for one input/output port, etc.
377
378 -prep_delays
379 insert `$__ABC9_DELAY' blackbox cells into the design to account for
380 certain required times.
381
382 -mark_scc
383 for an arbitrarily chosen cell in each unique SCC of each selected module
384 (tagged with an (* abc9_scc_id = <int> *) attribute), temporarily mark all
385 wires driven by this cell's outputs with a (* keep *) attribute in order
386 to break the SCC. this temporary attribute will be removed on -reintegrate.
387
388 -prep_xaiger
389 prepare the design for XAIGER output. this includes computing the
390 topological ordering of ABC9 boxes, as well as preparing the
391 '<module-name>$holes' module that contains the logic behaviour of ABC9
392 whiteboxes.
393
394 -dff
395 consider flop cells (those instantiating modules marked with (* abc9_flop *))
396 during -prep_{delays,xaiger,box}.
397
398 -prep_dff
399 compute the clock domain and initial value of each flop in the design.
400 process the '$holes' module to support clock-enable functionality.
401
402 -prep_lut <maxlut>
403 pre-compute the lut library by analysing all modules marked with
404 (* abc9_lut=<area> *).
405
406 -write_lut <dst>
407 write the pre-computed lut library to <dst>.
408
409 -prep_box
410 pre-compute the box library by analysing all modules marked with
411 (* abc9_box *).
412
413 -write_box <dst>
414 write the pre-computed box library to <dst>.
415
416 -reintegrate
417 for each selected module, re-intergrate the module '<module-name>$abc9'
418 by first recovering ABC9 boxes, and then stitching in the remaining primary
419 inputs and outputs.
420 \end{lstlisting}
421
422 \section{add -- add objects to the design}
423 \label{cmd:add}
424 \begin{lstlisting}[numbers=left,frame=single]
425 add <command> [selection]
426
427 This command adds objects to the design. It operates on all fully selected
428 modules. So e.g. 'add -wire foo' will add a wire foo to all selected modules.
429
430
431 add {-wire|-input|-inout|-output} <name> <width> [selection]
432
433 Add a wire (input, inout, output port) with the given name and width. The
434 command will fail if the object exists already and has different properties
435 than the object to be created.
436
437
438 add -global_input <name> <width> [selection]
439
440 Like 'add -input', but also connect the signal between instances of the
441 selected modules.
442
443
444 add {-assert|-assume|-live|-fair|-cover} <name1> [-if <name2>]
445
446 Add an $assert, $assume, etc. cell connected to a wire named name1, with its
447 enable signal optionally connected to a wire named name2 (default: 1'b1).
448
449
450 add -mod <name[s]>
451
452 Add module[s] with the specified name[s].
453 \end{lstlisting}
454
455 \section{aigmap -- map logic to and-inverter-graph circuit}
456 \label{cmd:aigmap}
457 \begin{lstlisting}[numbers=left,frame=single]
458 aigmap [options] [selection]
459
460 Replace all logic cells with circuits made of only $_AND_ and
461 $_NOT_ cells.
462
463 -nand
464 Enable creation of $_NAND_ cells
465
466 -select
467 Overwrite replaced cells in the current selection with new $_AND_,
468 $_NOT_, and $_NAND_, cells
469 \end{lstlisting}
470
471 \section{alumacc -- extract ALU and MACC cells}
472 \label{cmd:alumacc}
473 \begin{lstlisting}[numbers=left,frame=single]
474 alumacc [selection]
475
476 This pass translates arithmetic operations like $add, $mul, $lt, etc. to $alu
477 and $macc cells.
478 \end{lstlisting}
479
480 \section{anlogic\_eqn -- Anlogic: Calculate equations for luts}
481 \label{cmd:anlogic_eqn}
482 \begin{lstlisting}[numbers=left,frame=single]
483 anlogic_eqn [selection]
484
485 Calculate equations for luts since bitstream generator depends on it.
486 \end{lstlisting}
487
488 \section{anlogic\_fixcarry -- Anlogic: fix carry chain}
489 \label{cmd:anlogic_fixcarry}
490 \begin{lstlisting}[numbers=left,frame=single]
491 anlogic_fixcarry [options] [selection]
492
493 Add Anlogic adders to fix carry chain if needed.
494 \end{lstlisting}
495
496 \section{assertpmux -- adds asserts for parallel muxes}
497 \label{cmd:assertpmux}
498 \begin{lstlisting}[numbers=left,frame=single]
499 assertpmux [options] [selection]
500
501 This command adds asserts to the design that assert that all parallel muxes
502 ($pmux cells) have a maximum of one of their inputs enable at any time.
503
504 -noinit
505 do not enforce the pmux condition during the init state
506
507 -always
508 usually the $pmux condition is only checked when the $pmux output
509 is used by the mux tree it drives. this option will deactivate this
510 additional constraint and check the $pmux condition always.
511 \end{lstlisting}
512
513 \section{async2sync -- convert async FF inputs to sync circuits}
514 \label{cmd:async2sync}
515 \begin{lstlisting}[numbers=left,frame=single]
516 async2sync [options] [selection]
517
518 This command replaces async FF inputs with sync circuits emulating the same
519 behavior for when the async signals are actually synchronized to the clock.
520
521 This pass assumes negative hold time for the async FF inputs. For example when
522 a reset deasserts with the clock edge, then the FF output will still drive the
523 reset value in the next cycle regardless of the data-in value at the time of
524 the clock edge.
525
526 Currently only $adff, $dffsr, and $dlatch cells are supported by this pass.
527 \end{lstlisting}
528
529 \section{attrmap -- renaming attributes}
530 \label{cmd:attrmap}
531 \begin{lstlisting}[numbers=left,frame=single]
532 attrmap [options] [selection]
533
534 This command renames attributes and/or maps key/value pairs to
535 other key/value pairs.
536
537 -tocase <name>
538 Match attribute names case-insensitively and set it to the specified
539 name.
540
541 -rename <old_name> <new_name>
542 Rename attributes as specified
543
544 -map <old_name>=<old_value> <new_name>=<new_value>
545 Map key/value pairs as indicated.
546
547 -imap <old_name>=<old_value> <new_name>=<new_value>
548 Like -map, but use case-insensitive match for <old_value> when
549 it is a string value.
550
551 -remove <name>=<value>
552 Remove attributes matching this pattern.
553
554 -modattr
555 Operate on module attributes instead of attributes on wires and cells.
556
557 For example, mapping Xilinx-style "keep" attributes to Yosys-style:
558
559 attrmap -tocase keep -imap keep="true" keep=1 \
560 -imap keep="false" keep=0 -remove keep=0
561 \end{lstlisting}
562
563 \section{attrmvcp -- move or copy attributes from wires to driving cells}
564 \label{cmd:attrmvcp}
565 \begin{lstlisting}[numbers=left,frame=single]
566 attrmvcp [options] [selection]
567
568 Move or copy attributes on wires to the cells driving them.
569
570 -copy
571 By default, attributes are moved. This will only add
572 the attribute to the cell, without removing it from
573 the wire.
574
575 -purge
576 If no selected cell consumes the attribute, then it is
577 left on the wire by default. This option will cause the
578 attribute to be removed from the wire, even if no selected
579 cell takes it.
580
581 -driven
582 By default, attriburtes are moved to the cell driving the
583 wire. With this option set it will be moved to the cell
584 driven by the wire instead.
585
586 -attr <attrname>
587 Move or copy this attribute. This option can be used
588 multiple times.
589 \end{lstlisting}
590
591 \section{autoname -- automatically assign names to objects}
592 \label{cmd:autoname}
593 \begin{lstlisting}[numbers=left,frame=single]
594 autoname [selection]
595
596 Assign auto-generated public names to objects with private names (the ones
597 with $-prefix).
598 \end{lstlisting}
599
600 \section{blackbox -- convert modules into blackbox modules}
601 \label{cmd:blackbox}
602 \begin{lstlisting}[numbers=left,frame=single]
603 blackbox [options] [selection]
604
605 Convert modules into blackbox modules (remove contents and set the blackbox
606 module attribute).
607 \end{lstlisting}
608
609 \section{bugpoint -- minimize testcases}
610 \label{cmd:bugpoint}
611 \begin{lstlisting}[numbers=left,frame=single]
612 bugpoint [options]
613
614 This command minimizes testcases that crash Yosys. It removes an arbitrary part
615 of the design and recursively invokes Yosys with a given script, repeating these
616 steps while it can find a smaller design that still causes a crash. Once this
617 command finishes, it replaces the current design with the smallest testcase it
618 was able to produce.
619
620 It is possible to specify the kinds of design part that will be removed. If none
621 are specified, all parts of design will be removed.
622
623 -yosys <filename>
624 use this Yosys binary. if not specified, `yosys` is used.
625
626 -script <filename>
627 use this script to crash Yosys. required.
628
629 -grep <string>
630 only consider crashes that place this string in the log file.
631
632 -fast
633 run `proc_clean; clean -purge` after each minimization step. converges
634 faster, but produces larger testcases, and may fail to produce any
635 testcase at all if the crash is related to dangling wires.
636
637 -clean
638 run `proc_clean; clean -purge` before checking testcase and after
639 finishing. produces smaller and more useful testcases, but may fail to
640 produce any testcase at all if the crash is related to dangling wires.
641
642 -modules
643 try to remove modules.
644
645 -ports
646 try to remove module ports.
647
648 -cells
649 try to remove cells.
650
651 -connections
652 try to reconnect ports to 'x.
653
654 -assigns
655 try to remove process assigns from cases.
656
657 -updates
658 try to remove process updates from syncs.
659 \end{lstlisting}
660
661 \section{cd -- a shortcut for 'select -module <name>'}
662 \label{cmd:cd}
663 \begin{lstlisting}[numbers=left,frame=single]
664 cd <modname>
665
666 This is just a shortcut for 'select -module <modname>'.
667
668
669 cd <cellname>
670
671 When no module with the specified name is found, but there is a cell
672 with the specified name in the current module, then this is equivalent
673 to 'cd <celltype>'.
674
675 cd ..
676
677 Remove trailing substrings that start with '.' in current module name until
678 the name of a module in the current design is generated, then switch to that
679 module. Otherwise clear the current selection.
680
681 cd
682
683 This is just a shortcut for 'select -clear'.
684 \end{lstlisting}
685
686 \section{check -- check for obvious problems in the design}
687 \label{cmd:check}
688 \begin{lstlisting}[numbers=left,frame=single]
689 check [options] [selection]
690
691 This pass identifies the following problems in the current design:
692
693 - combinatorial loops
694
695 - two or more conflicting drivers for one wire
696
697 - used wires that do not have a driver
698
699 Options:
700
701 -noinit
702 Also check for wires which have the 'init' attribute set.
703
704 -initdrv
705 Also check for wires that have the 'init' attribute set and are not
706 driven by an FF cell type.
707
708 -mapped
709 Also check for internal cells that have not been mapped to cells of the
710 target architecture.
711
712 -allow-tbuf
713 Modify the -mapped behavior to still allow $_TBUF_ cells.
714
715 -assert
716 Produce a runtime error if any problems are found in the current design.
717 \end{lstlisting}
718
719 \section{chformal -- change formal constraints of the design}
720 \label{cmd:chformal}
721 \begin{lstlisting}[numbers=left,frame=single]
722 chformal [types] [mode] [options] [selection]
723
724 Make changes to the formal constraints of the design. The [types] options
725 the type of constraint to operate on. If none of the following options are given,
726 the command will operate on all constraint types:
727
728 -assert $assert cells, representing assert(...) constraints
729 -assume $assume cells, representing assume(...) constraints
730 -live $live cells, representing assert(s_eventually ...)
731 -fair $fair cells, representing assume(s_eventually ...)
732 -cover $cover cells, representing cover() statements
733
734 Exactly one of the following modes must be specified:
735
736 -remove
737 remove the cells and thus constraints from the design
738
739 -early
740 bypass FFs that only delay the activation of a constraint
741
742 -delay <N>
743 delay activation of the constraint by <N> clock cycles
744
745 -skip <N>
746 ignore activation of the constraint in the first <N> clock cycles
747
748 -assert2assume
749 -assume2assert
750 -live2fair
751 -fair2live
752 change the roles of cells as indicated. these options can be combined
753 \end{lstlisting}
754
755 \section{chparam -- re-evaluate modules with new parameters}
756 \label{cmd:chparam}
757 \begin{lstlisting}[numbers=left,frame=single]
758 chparam [ -set name value ]... [selection]
759
760 Re-evaluate the selected modules with new parameters. String values must be
761 passed in double quotes (").
762
763
764 chparam -list [selection]
765
766 List the available parameters of the selected modules.
767 \end{lstlisting}
768
769 \section{chtype -- change type of cells in the design}
770 \label{cmd:chtype}
771 \begin{lstlisting}[numbers=left,frame=single]
772 chtype [options] [selection]
773
774 Change the types of cells in the design.
775
776 -set <type>
777 set the cell type to the given type
778
779 -map <old_type> <new_type>
780 change cells types that match <old_type> to <new_type>
781 \end{lstlisting}
782
783 \section{clean -- remove unused cells and wires}
784 \label{cmd:clean}
785 \begin{lstlisting}[numbers=left,frame=single]
786 clean [options] [selection]
787
788 This is identical to 'opt_clean', but less verbose.
789
790 When commands are separated using the ';;' token, this command will be executed
791 between the commands.
792
793 When commands are separated using the ';;;' token, this command will be executed
794 in -purge mode between the commands.
795 \end{lstlisting}
796
797 \section{clk2fflogic -- convert clocked FFs to generic \$ff cells}
798 \label{cmd:clk2fflogic}
799 \begin{lstlisting}[numbers=left,frame=single]
800 clk2fflogic [options] [selection]
801
802 This command replaces clocked flip-flops with generic $ff cells that use the
803 implicit global clock. This is useful for formal verification of designs with
804 multiple clocks.
805 \end{lstlisting}
806
807 \section{clkbufmap -- insert global buffers on clock networks}
808 \label{cmd:clkbufmap}
809 \begin{lstlisting}[numbers=left,frame=single]
810 clkbufmap [options] [selection]
811
812 Inserts global buffers between nets connected to clock inputs and their drivers.
813
814 In the absence of any selection, all wires without the 'clkbuf_inhibit'
815 attribute will be considered for global buffer insertion.
816 Alternatively, to consider all wires without the 'buffer_type' attribute set to
817 'none' or 'bufr' one would specify:
818 'w:* a:buffer_type=none a:buffer_type=bufr %u %d'
819 as the selection.
820
821 -buf <celltype> <portname_out>:<portname_in>
822 Specifies the cell type to use for the global buffers
823 and its port names. The first port will be connected to
824 the clock network sinks, and the second will be connected
825 to the actual clock source. This option is required.
826
827 -inpad <celltype> <portname_out>:<portname_in>
828 If specified, a PAD cell of the given type is inserted on
829 clock nets that are also top module's inputs (in addition
830 to the global buffer).
831 \end{lstlisting}
832
833 \section{connect -- create or remove connections}
834 \label{cmd:connect}
835 \begin{lstlisting}[numbers=left,frame=single]
836 connect [-nomap] [-nounset] -set <lhs-expr> <rhs-expr>
837
838 Create a connection. This is equivalent to adding the statement 'assign
839 <lhs-expr> = <rhs-expr>;' to the Verilog input. Per default, all existing
840 drivers for <lhs-expr> are unconnected. This can be overwritten by using
841 the -nounset option.
842
843
844 connect [-nomap] -unset <expr>
845
846 Unconnect all existing drivers for the specified expression.
847
848
849 connect [-nomap] -port <cell> <port> <expr>
850
851 Connect the specified cell port to the specified cell port.
852
853
854 Per default signal alias names are resolved and all signal names are mapped
855 the the signal name of the primary driver. Using the -nomap option deactivates
856 this behavior.
857
858 The connect command operates in one module only. Either only one module must
859 be selected or an active module must be set using the 'cd' command.
860
861 This command does not operate on module with processes.
862 \end{lstlisting}
863
864 \section{connect\_rpc -- connect to RPC frontend}
865 \label{cmd:connect_rpc}
866 \begin{lstlisting}[numbers=left,frame=single]
867 connect_rpc -exec <command> [args...]
868 connect_rpc -path <path>
869
870 Load modules using an out-of-process frontend.
871
872 -exec <command> [args...]
873 run <command> with arguments [args...]. send requests on stdin, read
874 responses from stdout.
875
876 -path <path>
877 connect to Unix domain socket at <path>. (Unix)
878 connect to bidirectional byte-type named pipe at <path>. (Windows)
879
880 A simple JSON-based, newline-delimited protocol is used for communicating with
881 the frontend. Yosys requests data from the frontend by sending exactly 1 line
882 of JSON. Frontend responds with data or error message by replying with exactly
883 1 line of JSON as well.
884
885 -> {"method": "modules"}
886 <- {"modules": ["<module-name>", ...]}
887 <- {"error": "<error-message>"}
888 request for the list of modules that can be derived by this frontend.
889 the 'hierarchy' command will call back into this frontend if a cell
890 with type <module-name> is instantiated in the design.
891
892 -> {"method": "derive", "module": "<module-name">, "parameters": {
893 "<param-name>": {"type": "[unsigned|signed|string|real]",
894 "value": "<param-value>"}, ...}}
895 <- {"frontend": "[ilang|verilog|...]","source": "<source>"}}
896 <- {"error": "<error-message>"}
897 request for the module <module-name> to be derived for a specific set of
898 parameters. <param-name> starts with \ for named parameters, and with $
899 for unnamed parameters, which are numbered starting at 1.<param-value>
900 for integer parameters is always specified as a binary string of unlimited
901 precision. the <source> returned by the frontend is hygienically parsed
902 by a built-in Yosys <frontend>, allowing the RPC frontend to return any
903 convenient representation of the module. the derived module is cached,
904 so the response should be the same whenever the same set of parameters
905 is provided.
906 \end{lstlisting}
907
908 \section{connwrappers -- match width of input-output port pairs}
909 \label{cmd:connwrappers}
910 \begin{lstlisting}[numbers=left,frame=single]
911 connwrappers [options] [selection]
912
913 Wrappers are used in coarse-grain synthesis to wrap cells with smaller ports
914 in wrapper cells with a (larger) constant port size. I.e. the upper bits
915 of the wrapper output are signed/unsigned bit extended. This command uses this
916 knowledge to rewire the inputs of the driven cells to match the output of
917 the driving cell.
918
919 -signed <cell_type> <port_name> <width_param>
920 -unsigned <cell_type> <port_name> <width_param>
921 consider the specified signed/unsigned wrapper output
922
923 -port <cell_type> <port_name> <width_param> <sign_param>
924 use the specified parameter to decide if signed or unsigned
925
926 The options -signed, -unsigned, and -port can be specified multiple times.
927 \end{lstlisting}
928
929 \section{coolrunner2\_fixup -- insert necessary buffer cells for CoolRunner-II architecture}
930 \label{cmd:coolrunner2_fixup}
931 \begin{lstlisting}[numbers=left,frame=single]
932 coolrunner2_fixup [options] [selection]
933
934 Insert necessary buffer cells for CoolRunner-II architecture.
935 \end{lstlisting}
936
937 \section{coolrunner2\_sop -- break \$sop cells into ANDTERM/ORTERM cells}
938 \label{cmd:coolrunner2_sop}
939 \begin{lstlisting}[numbers=left,frame=single]
940 coolrunner2_sop [options] [selection]
941
942 Break $sop cells into ANDTERM/ORTERM cells.
943 \end{lstlisting}
944
945 \section{copy -- copy modules in the design}
946 \label{cmd:copy}
947 \begin{lstlisting}[numbers=left,frame=single]
948 copy old_name new_name
949
950 Copy the specified module. Note that selection patterns are not supported
951 by this command.
952 \end{lstlisting}
953
954 \section{cover -- print code coverage counters}
955 \label{cmd:cover}
956 \begin{lstlisting}[numbers=left,frame=single]
957 cover [options] [pattern]
958
959 Print the code coverage counters collected using the cover() macro in the Yosys
960 C++ code. This is useful to figure out what parts of Yosys are utilized by a
961 test bench.
962
963 -q
964 Do not print output to the normal destination (console and/or log file)
965
966 -o file
967 Write output to this file, truncate if exists.
968
969 -a file
970 Write output to this file, append if exists.
971
972 -d dir
973 Write output to a newly created file in the specified directory.
974
975 When one or more pattern (shell wildcards) are specified, then only counters
976 matching at least one pattern are printed.
977
978
979 It is also possible to instruct Yosys to print the coverage counters on program
980 exit to a file using environment variables:
981
982 YOSYS_COVER_DIR="{dir-name}" yosys {args}
983
984 This will create a file (with an auto-generated name) in this
985 directory and write the coverage counters to it.
986
987 YOSYS_COVER_FILE="{file-name}" yosys {args}
988
989 This will append the coverage counters to the specified file.
990
991
992 Hint: Use the following AWK command to consolidate Yosys coverage files:
993
994 gawk '{ p[$3] = $1; c[$3] += $2; } END { for (i in p)
995 printf "%-60s %10d %s\n", p[i], c[i], i; }' {files} | sort -k3
996
997
998 Coverage counters are only available in Yosys for Linux.
999 \end{lstlisting}
1000
1001 \section{cutpoint -- adds formal cut points to the design}
1002 \label{cmd:cutpoint}
1003 \begin{lstlisting}[numbers=left,frame=single]
1004 cutpoint [options] [selection]
1005
1006 This command adds formal cut points to the design.
1007
1008 -undef
1009 set cupoint nets to undef (x). the default behavior is to create a
1010 $anyseq cell and drive the cutpoint net from that
1011 \end{lstlisting}
1012
1013 \section{debug -- run command with debug log messages enabled}
1014 \label{cmd:debug}
1015 \begin{lstlisting}[numbers=left,frame=single]
1016 debug cmd
1017
1018 Execute the specified command with debug log messages enabled
1019 \end{lstlisting}
1020
1021 \section{delete -- delete objects in the design}
1022 \label{cmd:delete}
1023 \begin{lstlisting}[numbers=left,frame=single]
1024 delete [selection]
1025
1026 Deletes the selected objects. This will also remove entire modules, if the
1027 whole module is selected.
1028
1029
1030 delete {-input|-output|-port} [selection]
1031
1032 Does not delete any object but removes the input and/or output flag on the
1033 selected wires, thus 'deleting' module ports.
1034 \end{lstlisting}
1035
1036 \section{deminout -- demote inout ports to input or output}
1037 \label{cmd:deminout}
1038 \begin{lstlisting}[numbers=left,frame=single]
1039 deminout [options] [selection]
1040
1041 "Demote" inout ports to input or output ports, if possible.
1042 \end{lstlisting}
1043
1044 \section{design -- save, restore and reset current design}
1045 \label{cmd:design}
1046 \begin{lstlisting}[numbers=left,frame=single]
1047 design -reset
1048
1049 Clear the current design.
1050
1051
1052 design -save <name>
1053
1054 Save the current design under the given name.
1055
1056
1057 design -stash <name>
1058
1059 Save the current design under the given name and then clear the current design.
1060
1061
1062 design -push
1063
1064 Push the current design to the stack and then clear the current design.
1065
1066
1067 design -push-copy
1068
1069 Push the current design to the stack without clearing the current design.
1070
1071
1072 design -pop
1073
1074 Reset the current design and pop the last design from the stack.
1075
1076
1077 design -load <name>
1078
1079 Reset the current design and load the design previously saved under the given
1080 name.
1081
1082
1083 design -copy-from <name> [-as <new_mod_name>] <selection>
1084
1085 Copy modules from the specified design into the current one. The selection is
1086 evaluated in the other design.
1087
1088
1089 design -copy-to <name> [-as <new_mod_name>] [selection]
1090
1091 Copy modules from the current design into the specified one.
1092
1093
1094 design -import <name> [-as <new_top_name>] [selection]
1095
1096 Import the specified design into the current design. The source design must
1097 either have a selected top module or the selection must contain exactly one
1098 module that is then used as top module for this command.
1099
1100
1101 design -reset-vlog
1102
1103 The Verilog front-end remembers defined macros and top-level declarations
1104 between calls to 'read_verilog'. This command resets this memory.
1105 \end{lstlisting}
1106
1107 \section{determine\_init -- Determine the init value of cells}
1108 \label{cmd:determine_init}
1109 \begin{lstlisting}[numbers=left,frame=single]
1110 determine_init [selection]
1111
1112 Determine the init value of cells that doesn't allow unknown init value.
1113 \end{lstlisting}
1114
1115 \section{dff2dffe -- transform \$dff cells to \$dffe cells}
1116 \label{cmd:dff2dffe}
1117 \begin{lstlisting}[numbers=left,frame=single]
1118 dff2dffe [options] [selection]
1119
1120 This pass transforms $dff cells driven by a tree of multiplexers with one or
1121 more feedback paths to $dffe cells. It also works on gate-level cells such as
1122 $_DFF_P_, $_DFF_N_ and $_MUX_.
1123
1124 -unmap
1125 operate in the opposite direction: replace $dffe cells with combinations
1126 of $dff and $mux cells. the options below are ignored in unmap mode.
1127
1128 -unmap-mince N
1129 Same as -unmap but only unmap $dffe where the clock enable port
1130 signal is used by less $dffe than the specified number
1131
1132 -direct <internal_gate_type> <external_gate_type>
1133 map directly to external gate type. <internal_gate_type> can
1134 be any internal gate-level FF cell (except $_DFFE_??_). the
1135 <external_gate_type> is the cell type name for a cell with an
1136 identical interface to the <internal_gate_type>, except it
1137 also has an high-active enable port 'E'.
1138 Usually <external_gate_type> is an intermediate cell type
1139 that is then translated to the final type using 'techmap'.
1140
1141 -direct-match <pattern>
1142 like -direct for all DFF cell types matching the expression.
1143 this will use $__DFFE_* as <external_gate_type> matching the
1144 internal gate type $_DFF_*_, and $__DFFSE_* for those matching
1145 $_DFFS_*_, except for $_DFF_[NP]_, which is converted to
1146 $_DFFE_[NP]_.
1147 \end{lstlisting}
1148
1149 \section{dff2dffs -- process sync set/reset with SR over CE priority}
1150 \label{cmd:dff2dffs}
1151 \begin{lstlisting}[numbers=left,frame=single]
1152 dff2dffs [options] [selection]
1153
1154 Merge synchronous set/reset $_MUX_ cells to create $__DFFS_[NP][NP][01], to be run before
1155 dff2dffe for SR over CE priority.
1156
1157 -match-init
1158 Disallow merging synchronous set/reset that has polarity opposite of the
1159 output wire's init attribute (if any).
1160 \end{lstlisting}
1161
1162 \section{dffinit -- set INIT param on FF cells}
1163 \label{cmd:dffinit}
1164 \begin{lstlisting}[numbers=left,frame=single]
1165 dffinit [options] [selection]
1166
1167 This pass sets an FF cell parameter to the the initial value of the net it
1168 drives. (This is primarily used in FPGA flows.)
1169
1170 -ff <cell_name> <output_port> <init_param>
1171 operate on the specified cell type. this option can be used
1172 multiple times.
1173
1174 -highlow
1175 use the string values "high" and "low" to represent a single-bit
1176 initial value of 1 or 0. (multi-bit values are not supported in this
1177 mode.)
1178
1179 -strinit <string for high> <string for low>
1180 use string values in the command line to represent a single-bit
1181 initial value of 1 or 0. (multi-bit values are not supported in this
1182 mode.)
1183
1184 -noreinit
1185 fail if the FF cell has already a defined initial value set in other
1186 passes and the initial value of the net it drives is not equal to
1187 the already defined initial value.
1188 \end{lstlisting}
1189
1190 \section{dfflibmap -- technology mapping of flip-flops}
1191 \label{cmd:dfflibmap}
1192 \begin{lstlisting}[numbers=left,frame=single]
1193 dfflibmap [-prepare] -liberty <file> [selection]
1194
1195 Map internal flip-flop cells to the flip-flop cells in the technology
1196 library specified in the given liberty file.
1197
1198 This pass may add inverters as needed. Therefore it is recommended to
1199 first run this pass and then map the logic paths to the target technology.
1200
1201 When called with -prepare, this command will convert the internal FF cells
1202 to the internal cell types that best match the cells found in the given
1203 liberty file.
1204 \end{lstlisting}
1205
1206 \section{dump -- print parts of the design in ilang format}
1207 \label{cmd:dump}
1208 \begin{lstlisting}[numbers=left,frame=single]
1209 dump [options] [selection]
1210
1211 Write the selected parts of the design to the console or specified file in
1212 ilang format.
1213
1214 -m
1215 also dump the module headers, even if only parts of a single
1216 module is selected
1217
1218 -n
1219 only dump the module headers if the entire module is selected
1220
1221 -o <filename>
1222 write to the specified file.
1223
1224 -a <filename>
1225 like -outfile but append instead of overwrite
1226 \end{lstlisting}
1227
1228 \section{echo -- turning echoing back of commands on and off}
1229 \label{cmd:echo}
1230 \begin{lstlisting}[numbers=left,frame=single]
1231 echo on
1232
1233 Print all commands to log before executing them.
1234
1235
1236 echo off
1237
1238 Do not print all commands to log before executing them. (default)
1239 \end{lstlisting}
1240
1241 \section{ecp5\_ffinit -- ECP5: handle FF init values}
1242 \label{cmd:ecp5_ffinit}
1243 \begin{lstlisting}[numbers=left,frame=single]
1244 ecp5_ffinit [options] [selection]
1245
1246 Remove init values for FF output signals when equal to reset value.
1247 If reset is not used, set the reset value to the init value, otherwise
1248 unmap out the reset (if not an async reset).
1249 \end{lstlisting}
1250
1251 \section{ecp5\_gsr -- ECP5: handle GSR}
1252 \label{cmd:ecp5_gsr}
1253 \begin{lstlisting}[numbers=left,frame=single]
1254 ecp5_gsr [options] [selection]
1255
1256 Trim active low async resets connected to GSR and resolve GSR parameter,
1257 if a GSR or SGSR primitive is used in the design.
1258
1259 If any cell has the GSR parameter set to "AUTO", this will be resolved
1260 to "ENABLED" if a GSR primitive is present and the (* nogsr *) attribute
1261 is not set, otherwise it will be resolved to "DISABLED".
1262 \end{lstlisting}
1263
1264 \section{edgetypes -- list all types of edges in selection}
1265 \label{cmd:edgetypes}
1266 \begin{lstlisting}[numbers=left,frame=single]
1267 edgetypes [options] [selection]
1268
1269 This command lists all unique types of 'edges' found in the selection. An 'edge'
1270 is a 4-tuple of source and sink cell type and port name.
1271 \end{lstlisting}
1272
1273 \section{efinix\_fixcarry -- Efinix: fix carry chain}
1274 \label{cmd:efinix_fixcarry}
1275 \begin{lstlisting}[numbers=left,frame=single]
1276 efinix_fixcarry [options] [selection]
1277
1278 Add Efinix adders to fix carry chain if needed.
1279 \end{lstlisting}
1280
1281 \section{efinix\_gbuf -- Efinix: insert global clock buffers}
1282 \label{cmd:efinix_gbuf}
1283 \begin{lstlisting}[numbers=left,frame=single]
1284 efinix_gbuf [options] [selection]
1285
1286 Add Efinix global clock buffers to top module as needed.
1287 \end{lstlisting}
1288
1289 \section{equiv\_add -- add a \$equiv cell}
1290 \label{cmd:equiv_add}
1291 \begin{lstlisting}[numbers=left,frame=single]
1292 equiv_add [-try] gold_sig gate_sig
1293
1294 This command adds an $equiv cell for the specified signals.
1295
1296
1297 equiv_add [-try] -cell gold_cell gate_cell
1298
1299 This command adds $equiv cells for the ports of the specified cells.
1300 \end{lstlisting}
1301
1302 \section{equiv\_induct -- proving \$equiv cells using temporal induction}
1303 \label{cmd:equiv_induct}
1304 \begin{lstlisting}[numbers=left,frame=single]
1305 equiv_induct [options] [selection]
1306
1307 Uses a version of temporal induction to prove $equiv cells.
1308
1309 Only selected $equiv cells are proven and only selected cells are used to
1310 perform the proof.
1311
1312 -undef
1313 enable modelling of undef states
1314
1315 -seq <N>
1316 the max. number of time steps to be considered (default = 4)
1317
1318 This command is very effective in proving complex sequential circuits, when
1319 the internal state of the circuit quickly propagates to $equiv cells.
1320
1321 However, this command uses a weak definition of 'equivalence': This command
1322 proves that the two circuits will not diverge after they produce equal
1323 outputs (observable points via $equiv) for at least <N> cycles (the <N>
1324 specified via -seq).
1325
1326 Combined with simulation this is very powerful because simulation can give
1327 you confidence that the circuits start out synced for at least <N> cycles
1328 after reset.
1329 \end{lstlisting}
1330
1331 \section{equiv\_make -- prepare a circuit for equivalence checking}
1332 \label{cmd:equiv_make}
1333 \begin{lstlisting}[numbers=left,frame=single]
1334 equiv_make [options] gold_module gate_module equiv_module
1335
1336 This creates a module annotated with $equiv cells from two presumably
1337 equivalent modules. Use commands such as 'equiv_simple' and 'equiv_status'
1338 to work with the created equivalent checking module.
1339
1340 -inames
1341 Also match cells and wires with $... names.
1342
1343 -blacklist <file>
1344 Do not match cells or signals that match the names in the file.
1345
1346 -encfile <file>
1347 Match FSM encodings using the description from the file.
1348 See 'help fsm_recode' for details.
1349
1350 Note: The circuit created by this command is not a miter (with something like
1351 a trigger output), but instead uses $equiv cells to encode the equivalence
1352 checking problem. Use 'miter -equiv' if you want to create a miter circuit.
1353 \end{lstlisting}
1354
1355 \section{equiv\_mark -- mark equivalence checking regions}
1356 \label{cmd:equiv_mark}
1357 \begin{lstlisting}[numbers=left,frame=single]
1358 equiv_mark [options] [selection]
1359
1360 This command marks the regions in an equivalence checking module. Region 0 is
1361 the proven part of the circuit. Regions with higher numbers are connected
1362 unproven subcricuits. The integer attribute 'equiv_region' is set on all
1363 wires and cells.
1364 \end{lstlisting}
1365
1366 \section{equiv\_miter -- extract miter from equiv circuit}
1367 \label{cmd:equiv_miter}
1368 \begin{lstlisting}[numbers=left,frame=single]
1369 equiv_miter [options] miter_module [selection]
1370
1371 This creates a miter module for further analysis of the selected $equiv cells.
1372
1373 -trigger
1374 Create a trigger output
1375
1376 -cmp
1377 Create cmp_* outputs for individual unproven $equiv cells
1378
1379 -assert
1380 Create a $assert cell for each unproven $equiv cell
1381
1382 -undef
1383 Create compare logic that handles undefs correctly
1384 \end{lstlisting}
1385
1386 \section{equiv\_opt -- prove equivalence for optimized circuit}
1387 \label{cmd:equiv_opt}
1388 \begin{lstlisting}[numbers=left,frame=single]
1389 equiv_opt [options] [command]
1390
1391 This command uses temporal induction to check circuit equivalence before and
1392 after an optimization pass.
1393
1394 -run <from_label>:<to_label>
1395 only run the commands between the labels (see below). an empty
1396 from label is synonymous to the start of the command list, and empty to
1397 label is synonymous to the end of the command list.
1398
1399 -map <filename>
1400 expand the modules in this file before proving equivalence. this is
1401 useful for handling architecture-specific primitives.
1402
1403 -blacklist <file>
1404 Do not match cells or signals that match the names in the file
1405 (passed to equiv_make).
1406
1407 -assert
1408 produce an error if the circuits are not equivalent.
1409
1410 -multiclock
1411 run clk2fflogic before equivalence checking.
1412
1413 -async2sync
1414 run async2sync before equivalence checking.
1415
1416 -undef
1417 enable modelling of undef states during equiv_induct.
1418
1419 The following commands are executed by this verification command:
1420
1421 run_pass:
1422 hierarchy -auto-top
1423 design -save preopt
1424 [command]
1425 design -stash postopt
1426
1427 prepare:
1428 design -copy-from preopt -as gold A:top
1429 design -copy-from postopt -as gate A:top
1430
1431 techmap: (only with -map)
1432 techmap -wb -D EQUIV -autoproc -map <filename> ...
1433
1434 prove:
1435 clk2fflogic (only with -multiclock)
1436 async2sync (only with -async2sync)
1437 equiv_make -blacklist <filename> ... gold gate equiv
1438 equiv_induct [-undef] equiv
1439 equiv_status [-assert] equiv
1440
1441 restore:
1442 design -load preopt
1443 \end{lstlisting}
1444
1445 \section{equiv\_purge -- purge equivalence checking module}
1446 \label{cmd:equiv_purge}
1447 \begin{lstlisting}[numbers=left,frame=single]
1448 equiv_purge [options] [selection]
1449
1450 This command removes the proven part of an equivalence checking module, leaving
1451 only the unproven segments in the design. This will also remove and add module
1452 ports as needed.
1453 \end{lstlisting}
1454
1455 \section{equiv\_remove -- remove \$equiv cells}
1456 \label{cmd:equiv_remove}
1457 \begin{lstlisting}[numbers=left,frame=single]
1458 equiv_remove [options] [selection]
1459
1460 This command removes the selected $equiv cells. If neither -gold nor -gate is
1461 used then only proven cells are removed.
1462
1463 -gold
1464 keep gold circuit
1465
1466 -gate
1467 keep gate circuit
1468 \end{lstlisting}
1469
1470 \section{equiv\_simple -- try proving simple \$equiv instances}
1471 \label{cmd:equiv_simple}
1472 \begin{lstlisting}[numbers=left,frame=single]
1473 equiv_simple [options] [selection]
1474
1475 This command tries to prove $equiv cells using a simple direct SAT approach.
1476
1477 -v
1478 verbose output
1479
1480 -undef
1481 enable modelling of undef states
1482
1483 -short
1484 create shorter input cones that stop at shared nodes. This yields
1485 simpler SAT problems but sometimes fails to prove equivalence.
1486
1487 -nogroup
1488 disabling grouping of $equiv cells by output wire
1489
1490 -seq <N>
1491 the max. number of time steps to be considered (default = 1)
1492 \end{lstlisting}
1493
1494 \section{equiv\_status -- print status of equivalent checking module}
1495 \label{cmd:equiv_status}
1496 \begin{lstlisting}[numbers=left,frame=single]
1497 equiv_status [options] [selection]
1498
1499 This command prints status information for all selected $equiv cells.
1500
1501 -assert
1502 produce an error if any unproven $equiv cell is found
1503 \end{lstlisting}
1504
1505 \section{equiv\_struct -- structural equivalence checking}
1506 \label{cmd:equiv_struct}
1507 \begin{lstlisting}[numbers=left,frame=single]
1508 equiv_struct [options] [selection]
1509
1510 This command adds additional $equiv cells based on the assumption that the
1511 gold and gate circuit are structurally equivalent. Note that this can introduce
1512 bad $equiv cells in cases where the netlists are not structurally equivalent,
1513 for example when analyzing circuits with cells with commutative inputs. This
1514 command will also de-duplicate gates.
1515
1516 -fwd
1517 by default this command performans forward sweeps until nothing can
1518 be merged by forwards sweeps, then backward sweeps until forward
1519 sweeps are effective again. with this option set only forward sweeps
1520 are performed.
1521
1522 -fwonly <cell_type>
1523 add the specified cell type to the list of cell types that are only
1524 merged in forward sweeps and never in backward sweeps. $equiv is in
1525 this list automatically.
1526
1527 -icells
1528 by default, the internal RTL and gate cell types are ignored. add
1529 this option to also process those cell types with this command.
1530
1531 -maxiter <N>
1532 maximum number of iterations to run before aborting
1533 \end{lstlisting}
1534
1535 \section{eval -- evaluate the circuit given an input}
1536 \label{cmd:eval}
1537 \begin{lstlisting}[numbers=left,frame=single]
1538 eval [options] [selection]
1539
1540 This command evaluates the value of a signal given the value of all required
1541 inputs.
1542
1543 -set <signal> <value>
1544 set the specified signal to the specified value.
1545
1546 -set-undef
1547 set all unspecified source signals to undef (x)
1548
1549 -table <signal>
1550 create a truth table using the specified input signals
1551
1552 -show <signal>
1553 show the value for the specified signal. if no -show option is passed
1554 then all output ports of the current module are used.
1555 \end{lstlisting}
1556
1557 \section{exec -- execute commands in the operating system shell}
1558 \label{cmd:exec}
1559 \begin{lstlisting}[numbers=left,frame=single]
1560 exec [options] -- [command]
1561
1562 Execute a command in the operating system shell. All supplied arguments are
1563 concatenated and passed as a command to popen(3). Whitespace is not guaranteed
1564 to be preserved, even if quoted. stdin and stderr are not connected, while stdout is
1565 logged unless the "-q" option is specified.
1566
1567
1568 -q
1569 Suppress stdout and stderr from subprocess
1570
1571 -expect-return <int>
1572 Generate an error if popen() does not return specified value.
1573 May only be specified once; the final specified value is controlling
1574 if specified multiple times.
1575
1576 -expect-stdout <regex>
1577 Generate an error if the specified regex does not match any line
1578 in subprocess's stdout. May be specified multiple times.
1579
1580 -not-expect-stdout <regex>
1581 Generate an error if the specified regex matches any line
1582 in subprocess's stdout. May be specified multiple times.
1583
1584
1585 Example: exec -q -expect-return 0 -- echo "bananapie" | grep "nana"
1586 \end{lstlisting}
1587
1588 \section{expose -- convert internal signals to module ports}
1589 \label{cmd:expose}
1590 \begin{lstlisting}[numbers=left,frame=single]
1591 expose [options] [selection]
1592
1593 This command exposes all selected internal signals of a module as additional
1594 outputs.
1595
1596 -dff
1597 only consider wires that are directly driven by register cell.
1598
1599 -cut
1600 when exposing a wire, create an input/output pair and cut the internal
1601 signal path at that wire.
1602
1603 -input
1604 when exposing a wire, create an input port and disconnect the internal
1605 driver.
1606
1607 -shared
1608 only expose those signals that are shared among the selected modules.
1609 this is useful for preparing modules for equivalence checking.
1610
1611 -evert
1612 also turn connections to instances of other modules to additional
1613 inputs and outputs and remove the module instances.
1614
1615 -evert-dff
1616 turn flip-flops to sets of inputs and outputs.
1617
1618 -sep <separator>
1619 when creating new wire/port names, the original object name is suffixed
1620 with this separator (default: '.') and the port name or a type
1621 designator for the exposed signal.
1622 \end{lstlisting}
1623
1624 \section{extract -- find subcircuits and replace them with cells}
1625 \label{cmd:extract}
1626 \begin{lstlisting}[numbers=left,frame=single]
1627 extract -map <map_file> [options] [selection]
1628 extract -mine <out_file> [options] [selection]
1629
1630 This pass looks for subcircuits that are isomorphic to any of the modules
1631 in the given map file and replaces them with instances of this modules. The
1632 map file can be a Verilog source file (*.v) or an ilang file (*.il).
1633
1634 -map <map_file>
1635 use the modules in this file as reference. This option can be used
1636 multiple times.
1637
1638 -map %<design-name>
1639 use the modules in this in-memory design as reference. This option can
1640 be used multiple times.
1641
1642 -verbose
1643 print debug output while analyzing
1644
1645 -constports
1646 also find instances with constant drivers. this may be much
1647 slower than the normal operation.
1648
1649 -nodefaultswaps
1650 normally builtin port swapping rules for internal cells are used per
1651 default. This turns that off, so e.g. 'a^b' does not match 'b^a'
1652 when this option is used.
1653
1654 -compat <needle_type> <haystack_type>
1655 Per default, the cells in the map file (needle) must have the
1656 type as the cells in the active design (haystack). This option
1657 can be used to register additional pairs of types that should
1658 match. This option can be used multiple times.
1659
1660 -swap <needle_type> <port1>,<port2>[,...]
1661 Register a set of swappable ports for a needle cell type.
1662 This option can be used multiple times.
1663
1664 -perm <needle_type> <port1>,<port2>[,...] <portA>,<portB>[,...]
1665 Register a valid permutation of swappable ports for a needle
1666 cell type. This option can be used multiple times.
1667
1668 -cell_attr <attribute_name>
1669 Attributes on cells with the given name must match.
1670
1671 -wire_attr <attribute_name>
1672 Attributes on wires with the given name must match.
1673
1674 -ignore_parameters
1675 Do not use parameters when matching cells.
1676
1677 -ignore_param <cell_type> <parameter_name>
1678 Do not use this parameter when matching cells.
1679
1680 This pass does not operate on modules with unprocessed processes in it.
1681 (I.e. the 'proc' pass should be used first to convert processes to netlists.)
1682
1683 This pass can also be used for mining for frequent subcircuits. In this mode
1684 the following options are to be used instead of the -map option.
1685
1686 -mine <out_file>
1687 mine for frequent subcircuits and write them to the given ilang file
1688
1689 -mine_cells_span <min> <max>
1690 only mine for subcircuits with the specified number of cells
1691 default value: 3 5
1692
1693 -mine_min_freq <num>
1694 only mine for subcircuits with at least the specified number of matches
1695 default value: 10
1696
1697 -mine_limit_matches_per_module <num>
1698 when calculating the number of matches for a subcircuit, don't count
1699 more than the specified number of matches per module
1700
1701 -mine_max_fanout <num>
1702 don't consider internal signals with more than <num> connections
1703
1704 The modules in the map file may have the attribute 'extract_order' set to an
1705 integer value. Then this value is used to determine the order in which the pass
1706 tries to map the modules to the design (ascending, default value is 0).
1707
1708 See 'help techmap' for a pass that does the opposite thing.
1709 \end{lstlisting}
1710
1711 \section{extract\_counter -- Extract GreenPak4 counter cells}
1712 \label{cmd:extract_counter}
1713 \begin{lstlisting}[numbers=left,frame=single]
1714 extract_counter [options] [selection]
1715
1716 This pass converts non-resettable or async resettable down counters to
1717 counter cells. Use a target-specific 'techmap' map file to convert those cells
1718 to the actual target cells.
1719
1720 -maxwidth N
1721 Only extract counters up to N bits wide (default 64)
1722
1723 -minwidth N
1724 Only extract counters at least N bits wide (default 2)
1725
1726 -allow_arst yes|no
1727 Allow counters to have async reset (default yes)
1728
1729 -dir up|down|both
1730 Look for up-counters, down-counters, or both (default down)
1731
1732 -pout X,Y,...
1733 Only allow parallel output from the counter to the listed cell types
1734 (if not specified, parallel outputs are not restricted)
1735 \end{lstlisting}
1736
1737 \section{extract\_fa -- find and extract full/half adders}
1738 \label{cmd:extract_fa}
1739 \begin{lstlisting}[numbers=left,frame=single]
1740 extract_fa [options] [selection]
1741
1742 This pass extracts full/half adders from a gate-level design.
1743
1744 -fa, -ha
1745 Enable cell types (fa=full adder, ha=half adder)
1746 All types are enabled if none of this options is used
1747
1748 -d <int>
1749 Set maximum depth for extracted logic cones (default=20)
1750
1751 -b <int>
1752 Set maximum breadth for extracted logic cones (default=6)
1753
1754 -v
1755 Verbose output
1756 \end{lstlisting}
1757
1758 \section{extract\_reduce -- converts gate chains into \$reduce\_* cells}
1759 \label{cmd:extract_reduce}
1760 \begin{lstlisting}[numbers=left,frame=single]
1761 extract_reduce [options] [selection]
1762
1763 converts gate chains into $reduce_* cells
1764
1765 This command finds chains of $_AND_, $_OR_, and $_XOR_ cells and replaces them
1766 with their corresponding $reduce_* cells. Because this command only operates on
1767 these cell types, it is recommended to map the design to only these cell types
1768 using the `abc -g` command. Note that, in some cases, it may be more effective
1769 to map the design to only $_AND_ cells, run extract_reduce, map the remaining
1770 parts of the design to AND/OR/XOR cells, and run extract_reduce a second time.
1771
1772 -allow-off-chain
1773 Allows matching of cells that have loads outside the chain. These cells
1774 will be replicated and folded into the $reduce_* cell, but the original
1775 cell will remain, driving its original loads.
1776 \end{lstlisting}
1777
1778 \section{extractinv -- extract explicit inverter cells for invertible cell pins}
1779 \label{cmd:extractinv}
1780 \begin{lstlisting}[numbers=left,frame=single]
1781 extractinv [options] [selection]
1782
1783 Searches the design for all cells with invertible pins controlled by a cell
1784 parameter (eg. IS_CLK_INVERTED on many Xilinx cells) and removes the parameter.
1785 If the parameter was set to 1, inserts an explicit inverter cell in front of
1786 the pin instead. Normally used for output to ISE, which does not support the
1787 inversion parameters.
1788
1789 To mark a cell port as invertible, use (* invertible_pin = "param_name" *)
1790 on the wire in the blackbox module. The parameter value should have
1791 the same width as the port, and will be effectively XORed with it.
1792
1793 -inv <celltype> <portname_out>:<portname_in>
1794 Specifies the cell type to use for the inverters and its port names.
1795 This option is required.
1796 \end{lstlisting}
1797
1798 \section{flatten -- flatten design}
1799 \label{cmd:flatten}
1800 \begin{lstlisting}[numbers=left,frame=single]
1801 flatten [options] [selection]
1802
1803 This pass flattens the design by replacing cells by their implementation. This
1804 pass is very similar to the 'techmap' pass. The only difference is that this
1805 pass is using the current design as mapping library.
1806
1807 Cells and/or modules with the 'keep_hierarchy' attribute set will not be
1808 flattened by this command.
1809
1810 -wb
1811 Ignore the 'whitebox' attribute on cell implementations.
1812 \end{lstlisting}
1813
1814 \section{flowmap -- pack LUTs with FlowMap}
1815 \label{cmd:flowmap}
1816 \begin{lstlisting}[numbers=left,frame=single]
1817 flowmap [options] [selection]
1818
1819 This pass uses the FlowMap technology mapping algorithm to pack logic gates
1820 into k-LUTs with optimal depth. It allows mapping any circuit elements that can
1821 be evaluated with the `eval` pass, including cells with multiple output ports
1822 and multi-bit input and output ports.
1823
1824 -maxlut k
1825 perform technology mapping for a k-LUT architecture. if not specified,
1826 defaults to 3.
1827
1828 -minlut n
1829 only produce n-input or larger LUTs. if not specified, defaults to 1.
1830
1831 -cells <cell>[,<cell>,...]
1832 map specified cells. if not specified, maps $_NOT_, $_AND_, $_OR_,
1833 $_XOR_ and $_MUX_, which are the outputs of the `simplemap` pass.
1834
1835 -relax
1836 perform depth relaxation and area minimization.
1837
1838 -r-alpha n, -r-beta n, -r-gamma n
1839 parameters of depth relaxation heuristic potential function.
1840 if not specified, alpha=8, beta=2, gamma=1.
1841
1842 -optarea n
1843 optimize for area by trading off at most n logic levels for fewer LUTs.
1844 n may be zero, to optimize for area without increasing depth.
1845 implies -relax.
1846
1847 -debug
1848 dump intermediate graphs.
1849
1850 -debug-relax
1851 explain decisions performed during depth relaxation.
1852 \end{lstlisting}
1853
1854 \section{fmcombine -- combine two instances of a cell into one}
1855 \label{cmd:fmcombine}
1856 \begin{lstlisting}[numbers=left,frame=single]
1857 fmcombine [options] module_name gold_cell gate_cell
1858
1859 This pass takes two cells, which are instances of the same module, and replaces
1860 them with one instance of a special 'combined' module, that effectively
1861 contains two copies of the original module, plus some formal properties.
1862
1863 This is useful for formal test benches that check what differences in behavior
1864 a slight difference in input causes in a module.
1865
1866 -initeq
1867 Insert assumptions that initially all FFs in both circuits have the
1868 same initial values.
1869
1870 -anyeq
1871 Do not duplicate $anyseq/$anyconst cells.
1872
1873 -fwd
1874 Insert forward hint assumptions into the combined module.
1875
1876 -bwd
1877 Insert backward hint assumptions into the combined module.
1878 (Backward hints are logically equivalend to fordward hits, but
1879 some solvers are faster with bwd hints, or even both -bwd and -fwd.)
1880
1881 -nop
1882 Don't insert hint assumptions into the combined module.
1883 (This should not provide any speedup over the original design, but
1884 strangely sometimes it does.)
1885
1886 If none of -fwd, -bwd, and -nop is given, then -fwd is used as default.
1887 \end{lstlisting}
1888
1889 \section{fminit -- set init values/sequences for formal}
1890 \label{cmd:fminit}
1891 \begin{lstlisting}[numbers=left,frame=single]
1892 fminit [options] <selection>
1893
1894 This pass creates init constraints (for example for reset sequences) in a formal
1895 model.
1896
1897 -seq <signal> <sequence>
1898 Set sequence using comma-separated list of values, use 'z for
1899 unconstrained bits. The last value is used for the remainder of the
1900 trace.
1901
1902 -set <signal> <value>
1903 Add constant value constraint
1904
1905 -posedge <signal>
1906 -negedge <signal>
1907 Set clock for init sequences
1908 \end{lstlisting}
1909
1910 \section{freduce -- perform functional reduction}
1911 \label{cmd:freduce}
1912 \begin{lstlisting}[numbers=left,frame=single]
1913 freduce [options] [selection]
1914
1915 This pass performs functional reduction in the circuit. I.e. if two nodes are
1916 equivalent, they are merged to one node and one of the redundant drivers is
1917 disconnected. A subsequent call to 'clean' will remove the redundant drivers.
1918
1919 -v, -vv
1920 enable verbose or very verbose output
1921
1922 -inv
1923 enable explicit handling of inverted signals
1924
1925 -stop <n>
1926 stop after <n> reduction operations. this is mostly used for
1927 debugging the freduce command itself.
1928
1929 -dump <prefix>
1930 dump the design to <prefix>_<module>_<num>.il after each reduction
1931 operation. this is mostly used for debugging the freduce command.
1932
1933 This pass is undef-aware, i.e. it considers don't-care values for detecting
1934 equivalent nodes.
1935
1936 All selected wires are considered for rewiring. The selected cells cover the
1937 circuit that is analyzed.
1938 \end{lstlisting}
1939
1940 \section{fsm -- extract and optimize finite state machines}
1941 \label{cmd:fsm}
1942 \begin{lstlisting}[numbers=left,frame=single]
1943 fsm [options] [selection]
1944
1945 This pass calls all the other fsm_* passes in a useful order. This performs
1946 FSM extraction and optimization. It also calls opt_clean as needed:
1947
1948 fsm_detect unless got option -nodetect
1949 fsm_extract
1950
1951 fsm_opt
1952 opt_clean
1953 fsm_opt
1954
1955 fsm_expand if got option -expand
1956 opt_clean if got option -expand
1957 fsm_opt if got option -expand
1958
1959 fsm_recode unless got option -norecode
1960
1961 fsm_info
1962
1963 fsm_export if got option -export
1964 fsm_map unless got option -nomap
1965
1966 Options:
1967
1968 -expand, -norecode, -export, -nomap
1969 enable or disable passes as indicated above
1970
1971 -fullexpand
1972 call expand with -full option
1973
1974 -encoding type
1975 -fm_set_fsm_file file
1976 -encfile file
1977 passed through to fsm_recode pass
1978 \end{lstlisting}
1979
1980 \section{fsm\_detect -- finding FSMs in design}
1981 \label{cmd:fsm_detect}
1982 \begin{lstlisting}[numbers=left,frame=single]
1983 fsm_detect [selection]
1984
1985 This pass detects finite state machines by identifying the state signal.
1986 The state signal is then marked by setting the attribute 'fsm_encoding'
1987 on the state signal to "auto".
1988
1989 Existing 'fsm_encoding' attributes are not changed by this pass.
1990
1991 Signals can be protected from being detected by this pass by setting the
1992 'fsm_encoding' attribute to "none".
1993 \end{lstlisting}
1994
1995 \section{fsm\_expand -- expand FSM cells by merging logic into it}
1996 \label{cmd:fsm_expand}
1997 \begin{lstlisting}[numbers=left,frame=single]
1998 fsm_expand [-full] [selection]
1999
2000 The fsm_extract pass is conservative about the cells that belong to a finite
2001 state machine. This pass can be used to merge additional auxiliary gates into
2002 the finite state machine.
2003
2004 By default, fsm_expand is still a bit conservative regarding merging larger
2005 word-wide cells. Call with -full to consider all cells for merging.
2006 \end{lstlisting}
2007
2008 \section{fsm\_export -- exporting FSMs to KISS2 files}
2009 \label{cmd:fsm_export}
2010 \begin{lstlisting}[numbers=left,frame=single]
2011 fsm_export [-noauto] [-o filename] [-origenc] [selection]
2012
2013 This pass creates a KISS2 file for every selected FSM. For FSMs with the
2014 'fsm_export' attribute set, the attribute value is used as filename, otherwise
2015 the module and cell name is used as filename. If the parameter '-o' is given,
2016 the first exported FSM is written to the specified filename. This overwrites
2017 the setting as specified with the 'fsm_export' attribute. All other FSMs are
2018 exported to the default name as mentioned above.
2019
2020 -noauto
2021 only export FSMs that have the 'fsm_export' attribute set
2022
2023 -o filename
2024 filename of the first exported FSM
2025
2026 -origenc
2027 use binary state encoding as state names instead of s0, s1, ...
2028 \end{lstlisting}
2029
2030 \section{fsm\_extract -- extracting FSMs in design}
2031 \label{cmd:fsm_extract}
2032 \begin{lstlisting}[numbers=left,frame=single]
2033 fsm_extract [selection]
2034
2035 This pass operates on all signals marked as FSM state signals using the
2036 'fsm_encoding' attribute. It consumes the logic that creates the state signal
2037 and uses the state signal to generate control signal and replaces it with an
2038 FSM cell.
2039
2040 The generated FSM cell still generates the original state signal with its
2041 original encoding. The 'fsm_opt' pass can be used in combination with the
2042 'opt_clean' pass to eliminate this signal.
2043 \end{lstlisting}
2044
2045 \section{fsm\_info -- print information on finite state machines}
2046 \label{cmd:fsm_info}
2047 \begin{lstlisting}[numbers=left,frame=single]
2048 fsm_info [selection]
2049
2050 This pass dumps all internal information on FSM cells. It can be useful for
2051 analyzing the synthesis process and is called automatically by the 'fsm'
2052 pass so that this information is included in the synthesis log file.
2053 \end{lstlisting}
2054
2055 \section{fsm\_map -- mapping FSMs to basic logic}
2056 \label{cmd:fsm_map}
2057 \begin{lstlisting}[numbers=left,frame=single]
2058 fsm_map [selection]
2059
2060 This pass translates FSM cells to flip-flops and logic.
2061 \end{lstlisting}
2062
2063 \section{fsm\_opt -- optimize finite state machines}
2064 \label{cmd:fsm_opt}
2065 \begin{lstlisting}[numbers=left,frame=single]
2066 fsm_opt [selection]
2067
2068 This pass optimizes FSM cells. It detects which output signals are actually
2069 not used and removes them from the FSM. This pass is usually used in
2070 combination with the 'opt_clean' pass (see also 'help fsm').
2071 \end{lstlisting}
2072
2073 \section{fsm\_recode -- recoding finite state machines}
2074 \label{cmd:fsm_recode}
2075 \begin{lstlisting}[numbers=left,frame=single]
2076 fsm_recode [options] [selection]
2077
2078 This pass reassign the state encodings for FSM cells. At the moment only
2079 one-hot encoding and binary encoding is supported.
2080 -encoding <type>
2081 specify the encoding scheme used for FSMs without the
2082 'fsm_encoding' attribute or with the attribute set to `auto'.
2083
2084 -fm_set_fsm_file <file>
2085 generate a file containing the mapping from old to new FSM encoding
2086 in form of Synopsys Formality set_fsm_* commands.
2087
2088 -encfile <file>
2089 write the mappings from old to new FSM encoding to a file in the
2090 following format:
2091
2092 .fsm <module_name> <state_signal>
2093 .map <old_bitpattern> <new_bitpattern>
2094 \end{lstlisting}
2095
2096 \section{greenpak4\_dffinv -- merge greenpak4 inverters and DFF/latches}
2097 \label{cmd:greenpak4_dffinv}
2098 \begin{lstlisting}[numbers=left,frame=single]
2099 greenpak4_dffinv [options] [selection]
2100
2101 Merge GP_INV cells with GP_DFF* and GP_DLATCH* cells.
2102 \end{lstlisting}
2103
2104 \section{help -- display help messages}
2105 \label{cmd:help}
2106 \begin{lstlisting}[numbers=left,frame=single]
2107 help ................ list all commands
2108 help <command> ...... print help message for given command
2109 help -all ........... print complete command reference
2110
2111 help -cells .......... list all cell types
2112 help <celltype> ..... print help message for given cell type
2113 help <celltype>+ .... print verilog code for given cell type
2114 \end{lstlisting}
2115
2116 \section{hierarchy -- check, expand and clean up design hierarchy}
2117 \label{cmd:hierarchy}
2118 \begin{lstlisting}[numbers=left,frame=single]
2119 hierarchy [-check] [-top <module>]
2120 hierarchy -generate <cell-types> <port-decls>
2121
2122 In parametric designs, a module might exists in several variations with
2123 different parameter values. This pass looks at all modules in the current
2124 design an re-runs the language frontends for the parametric modules as
2125 needed. It also resolves assignments to wired logic data types (wand/wor),
2126 resolves positional module parameters, unroll array instances, and more.
2127
2128 -check
2129 also check the design hierarchy. this generates an error when
2130 an unknown module is used as cell type.
2131
2132 -simcheck
2133 like -check, but also throw an error if blackbox modules are
2134 instantiated, and throw an error if the design has no top module.
2135
2136 -purge_lib
2137 by default the hierarchy command will not remove library (blackbox)
2138 modules. use this option to also remove unused blackbox modules.
2139
2140 -libdir <directory>
2141 search for files named <module_name>.v in the specified directory
2142 for unknown modules and automatically run read_verilog for each
2143 unknown module.
2144
2145 -keep_positionals
2146 per default this pass also converts positional arguments in cells
2147 to arguments using port names. This option disables this behavior.
2148
2149 -keep_portwidths
2150 per default this pass adjusts the port width on cells that are
2151 module instances when the width does not match the module port. This
2152 option disables this behavior.
2153
2154 -nodefaults
2155 do not resolve input port default values
2156
2157 -nokeep_asserts
2158 per default this pass sets the "keep" attribute on all modules
2159 that directly or indirectly contain one or more formal properties.
2160 This option disables this behavior.
2161
2162 -top <module>
2163 use the specified top module to build the design hierarchy. Modules
2164 outside this tree (unused modules) are removed.
2165
2166 when the -top option is used, the 'top' attribute will be set on the
2167 specified top module. otherwise a module with the 'top' attribute set
2168 will implicitly be used as top module, if such a module exists.
2169
2170 -auto-top
2171 automatically determine the top of the design hierarchy and mark it.
2172
2173 -chparam name value
2174 elaborate the top module using this parameter value. Modules on which
2175 this parameter does not exist may cause a warning message to be output.
2176 This option can be specified multiple times to override multiple
2177 parameters. String values must be passed in double quotes (").
2178
2179 In -generate mode this pass generates blackbox modules for the given cell
2180 types (wildcards supported). For this the design is searched for cells that
2181 match the given types and then the given port declarations are used to
2182 determine the direction of the ports. The syntax for a port declaration is:
2183
2184 {i|o|io}[@<num>]:<portname>
2185
2186 Input ports are specified with the 'i' prefix, output ports with the 'o'
2187 prefix and inout ports with the 'io' prefix. The optional <num> specifies
2188 the position of the port in the parameter list (needed when instantiated
2189 using positional arguments). When <num> is not specified, the <portname> can
2190 also contain wildcard characters.
2191
2192 This pass ignores the current selection and always operates on all modules
2193 in the current design.
2194 \end{lstlisting}
2195
2196 \section{hilomap -- technology mapping of constant hi- and/or lo-drivers}
2197 \label{cmd:hilomap}
2198 \begin{lstlisting}[numbers=left,frame=single]
2199 hilomap [options] [selection]
2200
2201 Map constants to 'tielo' and 'tiehi' driver cells.
2202
2203 -hicell <celltype> <portname>
2204 Replace constant hi bits with this cell.
2205
2206 -locell <celltype> <portname>
2207 Replace constant lo bits with this cell.
2208
2209 -singleton
2210 Create only one hi/lo cell and connect all constant bits
2211 to that cell. Per default a separate cell is created for
2212 each constant bit.
2213 \end{lstlisting}
2214
2215 \section{history -- show last interactive commands}
2216 \label{cmd:history}
2217 \begin{lstlisting}[numbers=left,frame=single]
2218 history
2219
2220 This command prints all commands in the shell history buffer. This are
2221 all commands executed in an interactive session, but not the commands
2222 from executed scripts.
2223 \end{lstlisting}
2224
2225 \section{ice40\_braminit -- iCE40: perform SB\_RAM40\_4K initialization from file}
2226 \label{cmd:ice40_braminit}
2227 \begin{lstlisting}[numbers=left,frame=single]
2228 ice40_braminit
2229
2230 This command processes all SB_RAM40_4K blocks with a non-empty INIT_FILE
2231 parameter and converts it into the required INIT_x attributes
2232 \end{lstlisting}
2233
2234 \section{ice40\_dsp -- iCE40: map multipliers}
2235 \label{cmd:ice40_dsp}
2236 \begin{lstlisting}[numbers=left,frame=single]
2237 ice40_dsp [options] [selection]
2238
2239 Map multipliers ($mul/SB_MAC16) and multiply-accumulate ($mul/SB_MAC16 + $add)
2240 cells into iCE40 DSP resources.
2241 Currently, only the 16x16 multiply mode is supported and not the 2 x 8x8 mode.
2242
2243 Pack input registers (A, B, {C,D}; with optional hold), pipeline registers
2244 ({F,J,K,G}, H), output registers (O -- full 32-bits or lower 16-bits only; with
2245 optional hold), and post-adder into into the SB_MAC16 resource.
2246
2247 Multiply-accumulate operations using the post-adder with feedback on the {C,D}
2248 input will be folded into the DSP. In this scenario only, resetting the
2249 the accumulator to an arbitrary value can be inferred to use the {C,D} input.
2250 \end{lstlisting}
2251
2252 \section{ice40\_ffinit -- iCE40: handle FF init values}
2253 \label{cmd:ice40_ffinit}
2254 \begin{lstlisting}[numbers=left,frame=single]
2255 ice40_ffinit [options] [selection]
2256
2257 Remove zero init values for FF output signals. Add inverters to implement
2258 nonzero init values.
2259 \end{lstlisting}
2260
2261 \section{ice40\_ffssr -- iCE40: merge synchronous set/reset into FF cells}
2262 \label{cmd:ice40_ffssr}
2263 \begin{lstlisting}[numbers=left,frame=single]
2264 ice40_ffssr [options] [selection]
2265
2266 Merge synchronous set/reset $_MUX_ cells into iCE40 FFs.
2267 \end{lstlisting}
2268
2269 \section{ice40\_opt -- iCE40: perform simple optimizations}
2270 \label{cmd:ice40_opt}
2271 \begin{lstlisting}[numbers=left,frame=single]
2272 ice40_opt [options] [selection]
2273
2274 This command executes the following script:
2275
2276 do
2277 <ice40 specific optimizations>
2278 opt_expr -mux_undef -undriven [-full]
2279 opt_merge
2280 opt_rmdff
2281 opt_clean
2282 while <changed design>
2283 \end{lstlisting}
2284
2285 \section{ice40\_wrapcarry -- iCE40: wrap carries}
2286 \label{cmd:ice40_wrapcarry}
2287 \begin{lstlisting}[numbers=left,frame=single]
2288 ice40_wrapcarry [selection]
2289
2290 Wrap manually instantiated SB_CARRY cells, along with their associated SB_LUT4s,
2291 into an internal $__ICE40_CARRY_WRAPPER cell for preservation across technology
2292 mapping.
2293
2294 Attributes on both cells will have their names prefixed with 'SB_CARRY.' or
2295 'SB_LUT4.' and attached to the wrapping cell.
2296 A (* keep *) attribute on either cell will be logically OR-ed together.
2297
2298 -unwrap
2299 unwrap $__ICE40_CARRY_WRAPPER cells back into SB_CARRYs and SB_LUT4s,
2300 including restoring their attributes.
2301 \end{lstlisting}
2302
2303 \section{insbuf -- insert buffer cells for connected wires}
2304 \label{cmd:insbuf}
2305 \begin{lstlisting}[numbers=left,frame=single]
2306 insbuf [options] [selection]
2307
2308 Insert buffer cells into the design for directly connected wires.
2309
2310 -buf <celltype> <in-portname> <out-portname>
2311 Use the given cell type instead of $_BUF_. (Notice that the next
2312 call to "clean" will remove all $_BUF_ in the design.)
2313 \end{lstlisting}
2314
2315 \section{iopadmap -- technology mapping of i/o pads (or buffers)}
2316 \label{cmd:iopadmap}
2317 \begin{lstlisting}[numbers=left,frame=single]
2318 iopadmap [options] [selection]
2319
2320 Map module inputs/outputs to PAD cells from a library. This pass
2321 can only map to very simple PAD cells. Use 'techmap' to further map
2322 the resulting cells to more sophisticated PAD cells.
2323
2324 -inpad <celltype> <portname>[:<portname>]
2325 Map module input ports to the given cell type with the
2326 given output port name. if a 2nd portname is given, the
2327 signal is passed through the pad call, using the 2nd
2328 portname as the port facing the module port.
2329
2330 -outpad <celltype> <portname>[:<portname>]
2331 -inoutpad <celltype> <portname>[:<portname>]
2332 Similar to -inpad, but for output and inout ports.
2333
2334 -toutpad <celltype> <portname>:<portname>[:<portname>]
2335 Merges $_TBUF_ cells into the output pad cell. This takes precedence
2336 over the other -outpad cell. The first portname is the enable input
2337 of the tristate driver.
2338
2339 -tinoutpad <celltype> <portname>:<portname>:<portname>[:<portname>]
2340 Merges $_TBUF_ cells into the inout pad cell. This takes precedence
2341 over the other -inoutpad cell. The first portname is the enable input
2342 of the tristate driver and the 2nd portname is the internal output
2343 buffering the external signal.
2344
2345 -ignore <celltype> <portname>[:<portname>]*
2346 Skips mapping inputs/outputs that are already connected to given
2347 ports of the given cell. Can be used multiple times. This is in
2348 addition to the cells specified as mapping targets.
2349
2350 -widthparam <param_name>
2351 Use the specified parameter name to set the port width.
2352
2353 -nameparam <param_name>
2354 Use the specified parameter to set the port name.
2355
2356 -bits
2357 create individual bit-wide buffers even for ports that
2358 are wider. (the default behavior is to create word-wide
2359 buffers using -widthparam to set the word size on the cell.)
2360
2361 Tristate PADS (-toutpad, -tinoutpad) always operate in -bits mode.
2362 \end{lstlisting}
2363
2364 \section{json -- write design in JSON format}
2365 \label{cmd:json}
2366 \begin{lstlisting}[numbers=left,frame=single]
2367 json [options] [selection]
2368
2369 Write a JSON netlist of all selected objects.
2370
2371 -o <filename>
2372 write to the specified file.
2373
2374 -aig
2375 also include AIG models for the different gate types
2376
2377 -compat-int
2378 emit 32-bit or smaller fully-defined parameter values directly
2379 as JSON numbers (for compatibility with old parsers)
2380
2381 See 'help write_json' for a description of the JSON format used.
2382 \end{lstlisting}
2383
2384 \section{log -- print text and log files}
2385 \label{cmd:log}
2386 \begin{lstlisting}[numbers=left,frame=single]
2387 log string
2388
2389 Print the given string to the screen and/or the log file. This is useful for TCL
2390 scripts, because the TCL command "puts" only goes to stdout but not to
2391 logfiles.
2392
2393 -stdout
2394 Print the output to stdout too. This is useful when all Yosys is executed
2395 with a script and the -q (quiet operation) argument to notify the user.
2396
2397 -stderr
2398 Print the output to stderr too.
2399
2400 -nolog
2401 Don't use the internal log() command. Use either -stdout or -stderr,
2402 otherwise no output will be generated at all.
2403
2404 -n
2405 do not append a newline
2406 \end{lstlisting}
2407
2408 \section{logger -- set logger properties}
2409 \label{cmd:logger}
2410 \begin{lstlisting}[numbers=left,frame=single]
2411 logger [options]
2412
2413 This command sets global logger properties, also available using command line
2414 options.
2415
2416 -[no]time
2417 enable/disable display of timestamp in log output.
2418
2419 -[no]stderr
2420 enable/disable logging errors to stderr.
2421
2422 -warn regex
2423 print a warning for all log messages matching the regex.
2424
2425 -nowarn regex
2426 if a warning message matches the regex, it is printed as regular
2427 message instead.
2428
2429 -werror regex
2430 if a warning message matches the regex, it is printed as error
2431 message instead and the tool terminates with a nonzero return code.
2432
2433 -[no]debug
2434 globally enable/disable debug log messages.
2435
2436 -experimental <feature>
2437 do not print warnings for the specified experimental feature
2438
2439 -expect <type> <regex> <expected_count>
2440 expect log,warning or error to appear. In case of error return code is 0.
2441
2442 -expect-no-warnings
2443 gives error in case there is at least one warning that is not expected.
2444 \end{lstlisting}
2445
2446 \section{ls -- list modules or objects in modules}
2447 \label{cmd:ls}
2448 \begin{lstlisting}[numbers=left,frame=single]
2449 ls [selection]
2450
2451 When no active module is selected, this prints a list of modules.
2452
2453 When an active module is selected, this prints a list of objects in the module.
2454 \end{lstlisting}
2455
2456 \section{ltp -- print longest topological path}
2457 \label{cmd:ltp}
2458 \begin{lstlisting}[numbers=left,frame=single]
2459 ltp [options] [selection]
2460
2461 This command prints the longest topological path in the design. (Only considers
2462 paths within a single module, so the design must be flattened.)
2463
2464 -noff
2465 automatically exclude FF cell types
2466 \end{lstlisting}
2467
2468 \section{lut2mux -- convert \$lut to \$\_MUX\_}
2469 \label{cmd:lut2mux}
2470 \begin{lstlisting}[numbers=left,frame=single]
2471 lut2mux [options] [selection]
2472
2473 This pass converts $lut cells to $_MUX_ gates.
2474 \end{lstlisting}
2475
2476 \section{maccmap -- mapping macc cells}
2477 \label{cmd:maccmap}
2478 \begin{lstlisting}[numbers=left,frame=single]
2479 maccmap [-unmap] [selection]
2480
2481 This pass maps $macc cells to yosys $fa and $alu cells. When the -unmap option
2482 is used then the $macc cell is mapped to $add, $sub, etc. cells instead.
2483 \end{lstlisting}
2484
2485 \section{memory -- translate memories to basic cells}
2486 \label{cmd:memory}
2487 \begin{lstlisting}[numbers=left,frame=single]
2488 memory [-nomap] [-nordff] [-memx] [-bram <bram_rules>] [selection]
2489
2490 This pass calls all the other memory_* passes in a useful order:
2491
2492 opt_mem
2493 memory_dff [-nordff] (-memx implies -nordff)
2494 opt_clean
2495 memory_share
2496 opt_clean
2497 memory_memx (when called with -memx)
2498 memory_collect
2499 memory_bram -rules <bram_rules> (when called with -bram)
2500 memory_map (skipped if called with -nomap)
2501
2502 This converts memories to word-wide DFFs and address decoders
2503 or multiport memory blocks if called with the -nomap option.
2504 \end{lstlisting}
2505
2506 \section{memory\_bram -- map memories to block rams}
2507 \label{cmd:memory_bram}
2508 \begin{lstlisting}[numbers=left,frame=single]
2509 memory_bram -rules <rule_file> [selection]
2510
2511 This pass converts the multi-port $mem memory cells into block ram instances.
2512 The given rules file describes the available resources and how they should be
2513 used.
2514
2515 The rules file contains configuration options, a set of block ram description
2516 and a sequence of match rules.
2517
2518 The option 'attr_icase' configures how attribute values are matched. The value 0
2519 means case-sensitive, 1 means case-insensitive.
2520
2521 A block ram description looks like this:
2522
2523 bram RAMB1024X32 # name of BRAM cell
2524 init 1 # set to '1' if BRAM can be initialized
2525 abits 10 # number of address bits
2526 dbits 32 # number of data bits
2527 groups 2 # number of port groups
2528 ports 1 1 # number of ports in each group
2529 wrmode 1 0 # set to '1' if this groups is write ports
2530 enable 4 1 # number of enable bits
2531 transp 0 2 # transparent (for read ports)
2532 clocks 1 2 # clock configuration
2533 clkpol 2 2 # clock polarity configuration
2534 endbram
2535
2536 For the option 'transp' the value 0 means non-transparent, 1 means transparent
2537 and a value greater than 1 means configurable. All groups with the same
2538 value greater than 1 share the same configuration bit.
2539
2540 For the option 'clocks' the value 0 means non-clocked, and a value greater
2541 than 0 means clocked. All groups with the same value share the same clock
2542 signal.
2543
2544 For the option 'clkpol' the value 0 means negative edge, 1 means positive edge
2545 and a value greater than 1 means configurable. All groups with the same value
2546 greater than 1 share the same configuration bit.
2547
2548 Using the same bram name in different bram blocks will create different variants
2549 of the bram. Verilog configuration parameters for the bram are created as needed.
2550
2551 It is also possible to create variants by repeating statements in the bram block
2552 and appending '@<label>' to the individual statements.
2553
2554 A match rule looks like this:
2555
2556 match RAMB1024X32
2557 max waste 16384 # only use this bram if <= 16k ram bits are unused
2558 min efficiency 80 # only use this bram if efficiency is at least 80%
2559 endmatch
2560
2561 It is possible to match against the following values with min/max rules:
2562
2563 words ........ number of words in memory in design
2564 abits ........ number of address bits on memory in design
2565 dbits ........ number of data bits on memory in design
2566 wports ....... number of write ports on memory in design
2567 rports ....... number of read ports on memory in design
2568 ports ........ number of ports on memory in design
2569 bits ......... number of bits in memory in design
2570 dups .......... number of duplications for more read ports
2571
2572 awaste ....... number of unused address slots for this match
2573 dwaste ....... number of unused data bits for this match
2574 bwaste ....... number of unused bram bits for this match
2575 waste ........ total number of unused bram bits (bwaste*dups)
2576 efficiency ... total percentage of used and non-duplicated bits
2577
2578 acells ....... number of cells in 'address-direction'
2579 dcells ....... number of cells in 'data-direction'
2580 cells ........ total number of cells (acells*dcells*dups)
2581
2582 A match containing the command 'attribute' followed by a list of space
2583 separated 'name[=string_value]' values requires that the memory contains any
2584 one of the given attribute name and string values (where specified), or name
2585 and integer 1 value (if no string_value given, since Verilog will interpret
2586 '(* attr *)' as '(* attr=1 *)').
2587 A name prefixed with '!' indicates that the attribute must not exist.
2588
2589 The interface for the created bram instances is derived from the bram
2590 description. Use 'techmap' to convert the created bram instances into
2591 instances of the actual bram cells of your target architecture.
2592
2593 A match containing the command 'or_next_if_better' is only used if it
2594 has a higher efficiency than the next match (and the one after that if
2595 the next also has 'or_next_if_better' set, and so forth).
2596
2597 A match containing the command 'make_transp' will add external circuitry
2598 to simulate 'transparent read', if necessary.
2599
2600 A match containing the command 'make_outreg' will add external flip-flops
2601 to implement synchronous read ports, if necessary.
2602
2603 A match containing the command 'shuffle_enable A' will re-organize
2604 the data bits to accommodate the enable pattern of port A.
2605 \end{lstlisting}
2606
2607 \section{memory\_collect -- creating multi-port memory cells}
2608 \label{cmd:memory_collect}
2609 \begin{lstlisting}[numbers=left,frame=single]
2610 memory_collect [selection]
2611
2612 This pass collects memories and memory ports and creates generic multiport
2613 memory cells.
2614 \end{lstlisting}
2615
2616 \section{memory\_dff -- merge input/output DFFs into memories}
2617 \label{cmd:memory_dff}
2618 \begin{lstlisting}[numbers=left,frame=single]
2619 memory_dff [options] [selection]
2620
2621 This pass detects DFFs at memory ports and merges them into the memory port.
2622 I.e. it consumes an asynchronous memory port and the flip-flops at its
2623 interface and yields a synchronous memory port.
2624
2625 -nordfff
2626 do not merge registers on read ports
2627 \end{lstlisting}
2628
2629 \section{memory\_map -- translate multiport memories to basic cells}
2630 \label{cmd:memory_map}
2631 \begin{lstlisting}[numbers=left,frame=single]
2632 memory_map [options] [selection]
2633
2634 This pass converts multiport memory cells as generated by the memory_collect
2635 pass to word-wide DFFs and address decoders.
2636
2637 -attr !<name>
2638 do not map memories that have attribute <name> set.
2639
2640 -attr <name>[=<value>]
2641 for memories that have attribute <name> set, only map them if its value
2642 is a string <value> (if specified), or an integer 1 (otherwise). if this
2643 option is specified multiple times, map the memory if the attribute is
2644 to any of the values.
2645
2646 -iattr
2647 for -attr, ignore case of <value>.
2648 \end{lstlisting}
2649
2650 \section{memory\_memx -- emulate vlog sim behavior for mem ports}
2651 \label{cmd:memory_memx}
2652 \begin{lstlisting}[numbers=left,frame=single]
2653 memory_memx [selection]
2654
2655 This pass adds additional circuitry that emulates the Verilog simulation
2656 behavior for out-of-bounds memory reads and writes.
2657 \end{lstlisting}
2658
2659 \section{memory\_nordff -- extract read port FFs from memories}
2660 \label{cmd:memory_nordff}
2661 \begin{lstlisting}[numbers=left,frame=single]
2662 memory_nordff [options] [selection]
2663
2664 This pass extracts FFs from memory read ports. This results in a netlist
2665 similar to what one would get from calling memory_dff with -nordff.
2666 \end{lstlisting}
2667
2668 \section{memory\_share -- consolidate memory ports}
2669 \label{cmd:memory_share}
2670 \begin{lstlisting}[numbers=left,frame=single]
2671 memory_share [selection]
2672
2673 This pass merges share-able memory ports into single memory ports.
2674
2675 The following methods are used to consolidate the number of memory ports:
2676
2677 - When write ports are connected to async read ports accessing the same
2678 address, then this feedback path is converted to a write port with
2679 byte/part enable signals.
2680
2681 - When multiple write ports access the same address then this is converted
2682 to a single write port with a more complex data and/or enable logic path.
2683
2684 - When multiple write ports are never accessed at the same time (a SAT
2685 solver is used to determine this), then the ports are merged into a single
2686 write port.
2687
2688 Note that in addition to the algorithms implemented in this pass, the $memrd
2689 and $memwr cells are also subject to generic resource sharing passes (and other
2690 optimizations) such as "share" and "opt_merge".
2691 \end{lstlisting}
2692
2693 \section{memory\_unpack -- unpack multi-port memory cells}
2694 \label{cmd:memory_unpack}
2695 \begin{lstlisting}[numbers=left,frame=single]
2696 memory_unpack [selection]
2697
2698 This pass converts the multi-port $mem memory cells into individual $memrd and
2699 $memwr cells. It is the counterpart to the memory_collect pass.
2700 \end{lstlisting}
2701
2702 \section{miter -- automatically create a miter circuit}
2703 \label{cmd:miter}
2704 \begin{lstlisting}[numbers=left,frame=single]
2705 miter -equiv [options] gold_name gate_name miter_name
2706
2707 Creates a miter circuit for equivalence checking. The gold- and gate- modules
2708 must have the same interfaces. The miter circuit will have all inputs of the
2709 two source modules, prefixed with 'in_'. The miter circuit has a 'trigger'
2710 output that goes high if an output mismatch between the two source modules is
2711 detected.
2712
2713 -ignore_gold_x
2714 a undef (x) bit in the gold module output will match any value in
2715 the gate module output.
2716
2717 -make_outputs
2718 also route the gold- and gate-outputs to 'gold_*' and 'gate_*' outputs
2719 on the miter circuit.
2720
2721 -make_outcmp
2722 also create a cmp_* output for each gold/gate output pair.
2723
2724 -make_assert
2725 also create an 'assert' cell that checks if trigger is always low.
2726
2727 -flatten
2728 call 'flatten -wb; opt_expr -keepdc -undriven;;' on the miter circuit.
2729
2730
2731 miter -assert [options] module [miter_name]
2732
2733 Creates a miter circuit for property checking. All input ports are kept,
2734 output ports are discarded. An additional output 'trigger' is created that
2735 goes high when an assert is violated. Without a miter_name, the existing
2736 module is modified.
2737
2738 -make_outputs
2739 keep module output ports.
2740
2741 -flatten
2742 call 'flatten -wb; opt_expr -keepdc -undriven;;' on the miter circuit.
2743 \end{lstlisting}
2744
2745 \section{mutate -- generate or apply design mutations}
2746 \label{cmd:mutate}
2747 \begin{lstlisting}[numbers=left,frame=single]
2748 mutate -list N [options] [selection]
2749
2750 Create a list of N mutations using an even sampling.
2751
2752 -o filename
2753 Write list to this file instead of console output
2754
2755 -s filename
2756 Write a list of all src tags found in the design to the specified file
2757
2758 -seed N
2759 RNG seed for selecting mutations
2760
2761 -none
2762 Include a "none" mutation in the output
2763
2764 -ctrl name width value
2765 Add -ctrl options to the output. Use 'value' for first mutation, then
2766 simply count up from there.
2767
2768 -mode name
2769 -module name
2770 -cell name
2771 -port name
2772 -portbit int
2773 -ctrlbit int
2774 -wire name
2775 -wirebit int
2776 -src string
2777 Filter list of mutation candidates to those matching
2778 the given parameters.
2779
2780 -cfg option int
2781 Set a configuration option. Options available:
2782 weight_pq_w weight_pq_b weight_pq_c weight_pq_s
2783 weight_pq_mw weight_pq_mb weight_pq_mc weight_pq_ms
2784 weight_cover pick_cover_prcnt
2785
2786
2787 mutate -mode MODE [options]
2788
2789 Apply the given mutation.
2790
2791 -ctrl name width value
2792 Add a control signal with the given name and width. The mutation is
2793 activated if the control signal equals the given value.
2794
2795 -module name
2796 -cell name
2797 -port name
2798 -portbit int
2799 -ctrlbit int
2800 Mutation parameters, as generated by 'mutate -list N'.
2801
2802 -wire name
2803 -wirebit int
2804 -src string
2805 Ignored. (They are generated by -list for documentation purposes.)
2806 \end{lstlisting}
2807
2808 \section{muxcover -- cover trees of MUX cells with wider MUXes}
2809 \label{cmd:muxcover}
2810 \begin{lstlisting}[numbers=left,frame=single]
2811 muxcover [options] [selection]
2812
2813 Cover trees of $_MUX_ cells with $_MUX{4,8,16}_ cells
2814
2815 -mux4[=cost], -mux8[=cost], -mux16[=cost]
2816 Cover $_MUX_ trees using the specified types of MUXes (with optional
2817 integer costs). If none of these options are given, the effect is the
2818 same as if all of them are.
2819 Default costs: $_MUX4_ = 220, $_MUX8_ = 460,
2820 $_MUX16_ = 940
2821
2822 -mux2=cost
2823 Use the specified cost for $_MUX_ cells when making covering decisions.
2824 Default cost: $_MUX_ = 100
2825
2826 -dmux=cost
2827 Use the specified cost for $_MUX_ cells used in decoders.
2828 Default cost: 90
2829
2830 -nodecode
2831 Do not insert decoder logic. This reduces the number of possible
2832 substitutions, but guarantees that the resulting circuit is not
2833 less efficient than the original circuit.
2834
2835 -nopartial
2836 Do not consider mappings that use $_MUX<N>_ to select from less
2837 than <N> different signals.
2838 \end{lstlisting}
2839
2840 \section{muxpack -- \$mux/\$pmux cascades to \$pmux}
2841 \label{cmd:muxpack}
2842 \begin{lstlisting}[numbers=left,frame=single]
2843 muxpack [selection]
2844
2845 This pass converts cascaded chains of $pmux cells (e.g. those create from case
2846 constructs) and $mux cells (e.g. those created by if-else constructs) into
2847 $pmux cells.
2848
2849 This optimisation is conservative --- it will only pack $mux or $pmux cells
2850 whose select lines are driven by '$eq' cells with other such cells if it can be
2851 certain that their select inputs are mutually exclusive.
2852 \end{lstlisting}
2853
2854 \section{nlutmap -- map to LUTs of different sizes}
2855 \label{cmd:nlutmap}
2856 \begin{lstlisting}[numbers=left,frame=single]
2857 nlutmap [options] [selection]
2858
2859 This pass uses successive calls to 'abc' to map to an architecture. That
2860 provides a small number of differently sized LUTs.
2861
2862 -luts N_1,N_2,N_3,...
2863 The number of LUTs with 1, 2, 3, ... inputs that are
2864 available in the target architecture.
2865
2866 -assert
2867 Create an error if not all logic can be mapped
2868
2869 Excess logic that does not fit into the specified LUTs is mapped back
2870 to generic logic gates ($_AND_, etc.).
2871 \end{lstlisting}
2872
2873 \section{onehot -- optimize \$eq cells for onehot signals}
2874 \label{cmd:onehot}
2875 \begin{lstlisting}[numbers=left,frame=single]
2876 onehot [options] [selection]
2877
2878 This pass optimizes $eq cells that compare one-hot signals against constants
2879
2880 -v, -vv
2881 verbose output
2882 \end{lstlisting}
2883
2884 \section{opt -- perform simple optimizations}
2885 \label{cmd:opt}
2886 \begin{lstlisting}[numbers=left,frame=single]
2887 opt [options] [selection]
2888
2889 This pass calls all the other opt_* passes in a useful order. This performs
2890 a series of trivial optimizations and cleanups. This pass executes the other
2891 passes in the following order:
2892
2893 opt_expr [-mux_undef] [-mux_bool] [-undriven] [-clkinv] [-fine] [-full] [-keepdc]
2894 opt_merge [-share_all] -nomux
2895
2896 do
2897 opt_muxtree
2898 opt_reduce [-fine] [-full]
2899 opt_merge [-share_all]
2900 opt_share (-full only)
2901 opt_rmdff [-keepdc] [-sat]
2902 opt_clean [-purge]
2903 opt_expr [-mux_undef] [-mux_bool] [-undriven] [-clkinv] [-fine] [-full] [-keepdc]
2904 while <changed design>
2905
2906 When called with -fast the following script is used instead:
2907
2908 do
2909 opt_expr [-mux_undef] [-mux_bool] [-undriven] [-clkinv] [-fine] [-full] [-keepdc]
2910 opt_merge [-share_all]
2911 opt_rmdff [-keepdc] [-sat]
2912 opt_clean [-purge]
2913 while <changed design in opt_rmdff>
2914
2915 Note: Options in square brackets (such as [-keepdc]) are passed through to
2916 the opt_* commands when given to 'opt'.
2917 \end{lstlisting}
2918
2919 \section{opt\_clean -- remove unused cells and wires}
2920 \label{cmd:opt_clean}
2921 \begin{lstlisting}[numbers=left,frame=single]
2922 opt_clean [options] [selection]
2923
2924 This pass identifies wires and cells that are unused and removes them. Other
2925 passes often remove cells but leave the wires in the design or reconnect the
2926 wires but leave the old cells in the design. This pass can be used to clean up
2927 after the passes that do the actual work.
2928
2929 This pass only operates on completely selected modules without processes.
2930
2931 -purge
2932 also remove internal nets if they have a public name
2933 \end{lstlisting}
2934
2935 \section{opt\_demorgan -- Optimize reductions with DeMorgan equivalents}
2936 \label{cmd:opt_demorgan}
2937 \begin{lstlisting}[numbers=left,frame=single]
2938 opt_demorgan [selection]
2939
2940 This pass pushes inverters through $reduce_* cells if this will reduce the
2941 overall gate count of the circuit
2942 \end{lstlisting}
2943
2944 \section{opt\_expr -- perform const folding and simple expression rewriting}
2945 \label{cmd:opt_expr}
2946 \begin{lstlisting}[numbers=left,frame=single]
2947 opt_expr [options] [selection]
2948
2949 This pass performs const folding on internal cell types with constant inputs.
2950 It also performs some simple expression rewriting.
2951
2952 -mux_undef
2953 remove 'undef' inputs from $mux, $pmux and $_MUX_ cells
2954
2955 -mux_bool
2956 replace $mux cells with inverters or buffers when possible
2957
2958 -undriven
2959 replace undriven nets with undef (x) constants
2960
2961 -clkinv
2962 optimize clock inverters by changing FF types
2963
2964 -fine
2965 perform fine-grain optimizations
2966
2967 -full
2968 alias for -mux_undef -mux_bool -undriven -fine
2969
2970 -keepdc
2971 some optimizations change the behavior of the circuit with respect to
2972 don't-care bits. for example in 'a+0' a single x-bit in 'a' will cause
2973 all result bits to be set to x. this behavior changes when 'a+0' is
2974 replaced by 'a'. the -keepdc option disables all such optimizations.
2975 \end{lstlisting}
2976
2977 \section{opt\_lut -- optimize LUT cells}
2978 \label{cmd:opt_lut}
2979 \begin{lstlisting}[numbers=left,frame=single]
2980 opt_lut [options] [selection]
2981
2982 This pass combines cascaded $lut cells with unused inputs.
2983
2984 -dlogic <type>:<cell-port>=<LUT-input>[:<cell-port>=<LUT-input>...]
2985 preserve connections to dedicated logic cell <type> that has ports
2986 <cell-port> connected to LUT inputs <LUT-input>. this includes
2987 the case where both LUT and dedicated logic input are connected to
2988 the same constant.
2989
2990 -limit N
2991 only perform the first N combines, then stop. useful for debugging.
2992 \end{lstlisting}
2993
2994 \section{opt\_lut\_ins -- discard unused LUT inputs}
2995 \label{cmd:opt_lut_ins}
2996 \begin{lstlisting}[numbers=left,frame=single]
2997 opt_lut_ins [options] [selection]
2998
2999 This pass removes unused inputs from LUT cells (that is, inputs that can not
3000 influence the output signal given this LUT's value). While such LUTs cannot
3001 be directly emitted by ABC, they can be a result of various post-ABC
3002 transformations, such as mapping wide LUTs (not all sub-LUTs will use the
3003 full set of inputs) or optimizations such as xilinx_dffopt.
3004
3005 -tech <technology>
3006 Instead of generic $lut cells, operate on LUT cells specific
3007 to the given technology. Valid values are: xilinx, ecp5, gowin.
3008 \end{lstlisting}
3009
3010 \section{opt\_mem -- optimize memories}
3011 \label{cmd:opt_mem}
3012 \begin{lstlisting}[numbers=left,frame=single]
3013 opt_mem [options] [selection]
3014
3015 This pass performs various optimizations on memories in the design.
3016 \end{lstlisting}
3017
3018 \section{opt\_merge -- consolidate identical cells}
3019 \label{cmd:opt_merge}
3020 \begin{lstlisting}[numbers=left,frame=single]
3021 opt_merge [options] [selection]
3022
3023 This pass identifies cells with identical type and input signals. Such cells
3024 are then merged to one cell.
3025
3026 -nomux
3027 Do not merge MUX cells.
3028
3029 -share_all
3030 Operate on all cell types, not just built-in types.
3031 \end{lstlisting}
3032
3033 \section{opt\_muxtree -- eliminate dead trees in multiplexer trees}
3034 \label{cmd:opt_muxtree}
3035 \begin{lstlisting}[numbers=left,frame=single]
3036 opt_muxtree [selection]
3037
3038 This pass analyzes the control signals for the multiplexer trees in the design
3039 and identifies inputs that can never be active. It then removes this dead
3040 branches from the multiplexer trees.
3041
3042 This pass only operates on completely selected modules without processes.
3043 \end{lstlisting}
3044
3045 \section{opt\_reduce -- simplify large MUXes and AND/OR gates}
3046 \label{cmd:opt_reduce}
3047 \begin{lstlisting}[numbers=left,frame=single]
3048 opt_reduce [options] [selection]
3049
3050 This pass performs two interlinked optimizations:
3051
3052 1. it consolidates trees of large AND gates or OR gates and eliminates
3053 duplicated inputs.
3054
3055 2. it identifies duplicated inputs to MUXes and replaces them with a single
3056 input with the original control signals OR'ed together.
3057
3058 -fine
3059 perform fine-grain optimizations
3060
3061 -full
3062 alias for -fine
3063 \end{lstlisting}
3064
3065 \section{opt\_rmdff -- remove DFFs with constant inputs}
3066 \label{cmd:opt_rmdff}
3067 \begin{lstlisting}[numbers=left,frame=single]
3068 opt_rmdff [-keepdc] [-sat] [selection]
3069
3070 This pass identifies flip-flops with constant inputs and replaces them with
3071 a constant driver.
3072
3073 -sat
3074 additionally invoke SAT solver to detect and remove flip-flops (with
3075 non-constant inputs) that can also be replaced with a constant driver
3076 \end{lstlisting}
3077
3078 \section{opt\_share -- merge mutually exclusive cells of the same type that share an input signal}
3079 \label{cmd:opt_share}
3080 \begin{lstlisting}[numbers=left,frame=single]
3081 opt_share [selection]
3082
3083 This pass identifies mutually exclusive cells of the same type that:
3084 (a) share an input signal,
3085 (b) drive the same $mux, $_MUX_, or $pmux multiplexing cell,
3086
3087 allowing the cell to be merged and the multiplexer to be moved from
3088 multiplexing its output to multiplexing the non-shared input signals.
3089 \end{lstlisting}
3090
3091 \section{paramap -- renaming cell parameters}
3092 \label{cmd:paramap}
3093 \begin{lstlisting}[numbers=left,frame=single]
3094 paramap [options] [selection]
3095
3096 This command renames cell parameters and/or maps key/value pairs to
3097 other key/value pairs.
3098
3099 -tocase <name>
3100 Match attribute names case-insensitively and set it to the specified
3101 name.
3102
3103 -rename <old_name> <new_name>
3104 Rename attributes as specified
3105
3106 -map <old_name>=<old_value> <new_name>=<new_value>
3107 Map key/value pairs as indicated.
3108
3109 -imap <old_name>=<old_value> <new_name>=<new_value>
3110 Like -map, but use case-insensitive match for <old_value> when
3111 it is a string value.
3112
3113 -remove <name>=<value>
3114 Remove attributes matching this pattern.
3115
3116 For example, mapping Diamond-style ECP5 "init" attributes to Yosys-style:
3117
3118 paramap -tocase INIT t:LUT4
3119 \end{lstlisting}
3120
3121 \section{peepopt -- collection of peephole optimizers}
3122 \label{cmd:peepopt}
3123 \begin{lstlisting}[numbers=left,frame=single]
3124 peepopt [options] [selection]
3125
3126 This pass applies a collection of peephole optimizers to the current design.
3127 \end{lstlisting}
3128
3129 \section{plugin -- load and list loaded plugins}
3130 \label{cmd:plugin}
3131 \begin{lstlisting}[numbers=left,frame=single]
3132 plugin [options]
3133
3134 Load and list loaded plugins.
3135
3136 -i <plugin_filename>
3137 Load (install) the specified plugin.
3138
3139 -a <alias_name>
3140 Register the specified alias name for the loaded plugin
3141
3142 -l
3143 List loaded plugins
3144 \end{lstlisting}
3145
3146 \section{pmux2shiftx -- transform \$pmux cells to \$shiftx cells}
3147 \label{cmd:pmux2shiftx}
3148 \begin{lstlisting}[numbers=left,frame=single]
3149 pmux2shiftx [options] [selection]
3150
3151 This pass transforms $pmux cells to $shiftx cells.
3152
3153 -v, -vv
3154 verbose output
3155
3156 -min_density <percentage>
3157 specifies the minimum density for the shifter
3158 default: 50
3159
3160 -min_choices <int>
3161 specified the minimum number of choices for a control signal
3162 default: 3
3163
3164 -onehot ignore|pmux|shiftx
3165 select strategy for one-hot encoded control signals
3166 default: pmux
3167
3168 -norange
3169 disable $sub inference for "range decoders"
3170 \end{lstlisting}
3171
3172 \section{pmuxtree -- transform \$pmux cells to trees of \$mux cells}
3173 \label{cmd:pmuxtree}
3174 \begin{lstlisting}[numbers=left,frame=single]
3175 pmuxtree [selection]
3176
3177 This pass transforms $pmux cells to trees of $mux cells.
3178 \end{lstlisting}
3179
3180 \section{portlist -- list (top-level) ports}
3181 \label{cmd:portlist}
3182 \begin{lstlisting}[numbers=left,frame=single]
3183 portlist [options] [selection]
3184
3185 This command lists all module ports found in the selected modules.
3186
3187 If no selection is provided then it lists the ports on the top module.
3188
3189 -m
3190 print verilog blackbox module definitions instead of port lists
3191 \end{lstlisting}
3192
3193 \section{prep -- generic synthesis script}
3194 \label{cmd:prep}
3195 \begin{lstlisting}[numbers=left,frame=single]
3196 prep [options]
3197
3198 This command runs a conservative RTL synthesis. A typical application for this
3199 is the preparation stage of a verification flow. This command does not operate
3200 on partly selected designs.
3201
3202 -top <module>
3203 use the specified module as top module (default='top')
3204
3205 -auto-top
3206 automatically determine the top of the design hierarchy
3207
3208 -flatten
3209 flatten the design before synthesis. this will pass '-auto-top' to
3210 'hierarchy' if no top module is specified.
3211
3212 -ifx
3213 passed to 'proc'. uses verilog simulation behavior for verilog if/case
3214 undef handling. this also prevents 'wreduce' from being run.
3215
3216 -memx
3217 simulate verilog simulation behavior for out-of-bounds memory accesses
3218 using the 'memory_memx' pass.
3219
3220 -nomem
3221 do not run any of the memory_* passes
3222
3223 -rdff
3224 do not pass -nordff to 'memory_dff'. This enables merging of FFs into
3225 memory read ports.
3226
3227 -nokeepdc
3228 do not call opt_* with -keepdc
3229
3230 -run <from_label>[:<to_label>]
3231 only run the commands between the labels (see below). an empty
3232 from label is synonymous to 'begin', and empty to label is
3233 synonymous to the end of the command list.
3234
3235
3236 The following commands are executed by this synthesis command:
3237
3238 begin:
3239 hierarchy -check [-top <top> | -auto-top]
3240
3241 coarse:
3242 proc [-ifx]
3243 flatten (if -flatten)
3244 opt_expr -keepdc
3245 opt_clean
3246 check
3247 opt -keepdc
3248 wreduce -keepdc [-memx]
3249 memory_dff [-nordff]
3250 memory_memx (if -memx)
3251 opt_clean
3252 memory_collect
3253 opt -keepdc -fast
3254
3255 check:
3256 stat
3257 check
3258 \end{lstlisting}
3259
3260 \section{proc -- translate processes to netlists}
3261 \label{cmd:proc}
3262 \begin{lstlisting}[numbers=left,frame=single]
3263 proc [options] [selection]
3264
3265 This pass calls all the other proc_* passes in the most common order.
3266
3267 proc_clean
3268 proc_rmdead
3269 proc_prune
3270 proc_init
3271 proc_arst
3272 proc_mux
3273 proc_dlatch
3274 proc_dff
3275 proc_clean
3276
3277 This replaces the processes in the design with multiplexers,
3278 flip-flops and latches.
3279
3280 The following options are supported:
3281
3282 -global_arst [!]<netname>
3283 This option is passed through to proc_arst.
3284
3285 -ifx
3286 This option is passed through to proc_mux. proc_rmdead is not
3287 executed in -ifx mode.
3288 \end{lstlisting}
3289
3290 \section{proc\_arst -- detect asynchronous resets}
3291 \label{cmd:proc_arst}
3292 \begin{lstlisting}[numbers=left,frame=single]
3293 proc_arst [-global_arst [!]<netname>] [selection]
3294
3295 This pass identifies asynchronous resets in the processes and converts them
3296 to a different internal representation that is suitable for generating
3297 flip-flop cells with asynchronous resets.
3298
3299 -global_arst [!]<netname>
3300 In modules that have a net with the given name, use this net as async
3301 reset for registers that have been assign initial values in their
3302 declaration ('reg foobar = constant_value;'). Use the '!' modifier for
3303 active low reset signals. Note: the frontend stores the default value
3304 in the 'init' attribute on the net.
3305 \end{lstlisting}
3306
3307 \section{proc\_clean -- remove empty parts of processes}
3308 \label{cmd:proc_clean}
3309 \begin{lstlisting}[numbers=left,frame=single]
3310 proc_clean [options] [selection]
3311
3312 -quiet
3313 do not print any messages.
3314
3315 This pass removes empty parts of processes and ultimately removes a process
3316 if it contains only empty structures.
3317 \end{lstlisting}
3318
3319 \section{proc\_dff -- extract flip-flops from processes}
3320 \label{cmd:proc_dff}
3321 \begin{lstlisting}[numbers=left,frame=single]
3322 proc_dff [selection]
3323
3324 This pass identifies flip-flops in the processes and converts them to
3325 d-type flip-flop cells.
3326 \end{lstlisting}
3327
3328 \section{proc\_dlatch -- extract latches from processes}
3329 \label{cmd:proc_dlatch}
3330 \begin{lstlisting}[numbers=left,frame=single]
3331 proc_dlatch [selection]
3332
3333 This pass identifies latches in the processes and converts them to
3334 d-type latches.
3335 \end{lstlisting}
3336
3337 \section{proc\_init -- convert initial block to init attributes}
3338 \label{cmd:proc_init}
3339 \begin{lstlisting}[numbers=left,frame=single]
3340 proc_init [selection]
3341
3342 This pass extracts the 'init' actions from processes (generated from Verilog
3343 'initial' blocks) and sets the initial value to the 'init' attribute on the
3344 respective wire.
3345 \end{lstlisting}
3346
3347 \section{proc\_mux -- convert decision trees to multiplexers}
3348 \label{cmd:proc_mux}
3349 \begin{lstlisting}[numbers=left,frame=single]
3350 proc_mux [options] [selection]
3351
3352 This pass converts the decision trees in processes (originating from if-else
3353 and case statements) to trees of multiplexer cells.
3354
3355 -ifx
3356 Use Verilog simulation behavior with respect to undef values in
3357 'case' expressions and 'if' conditions.
3358 \end{lstlisting}
3359
3360 \section{proc\_prune -- remove redundant assignments}
3361 \label{cmd:proc_prune}
3362 \begin{lstlisting}[numbers=left,frame=single]
3363 proc_prune [selection]
3364
3365 This pass identifies assignments in processes that are always overwritten by
3366 a later assignment to the same signal and removes them.
3367 \end{lstlisting}
3368
3369 \section{proc\_rmdead -- eliminate dead trees in decision trees}
3370 \label{cmd:proc_rmdead}
3371 \begin{lstlisting}[numbers=left,frame=single]
3372 proc_rmdead [selection]
3373
3374 This pass identifies unreachable branches in decision trees and removes them.
3375 \end{lstlisting}
3376
3377 \section{qwp -- quadratic wirelength placer}
3378 \label{cmd:qwp}
3379 \begin{lstlisting}[numbers=left,frame=single]
3380 qwp [options] [selection]
3381
3382 This command runs quadratic wirelength placement on the selected modules and
3383 annotates the cells in the design with 'qwp_position' attributes.
3384
3385 -ltr
3386 Add left-to-right constraints: constrain all inputs on the left border
3387 outputs to the right border.
3388
3389 -alpha
3390 Add constraints for inputs/outputs to be placed in alphanumerical
3391 order along the y-axis (top-to-bottom).
3392
3393 -grid N
3394 Number of grid divisions in x- and y-direction. (default=16)
3395
3396 -dump <html_file_name>
3397 Dump a protocol of the placement algorithm to the html file.
3398
3399 -v
3400 Verbose solver output for profiling or debugging
3401
3402 Note: This implementation of a quadratic wirelength placer uses exact
3403 dense matrix operations. It is only a toy-placer for small circuits.
3404 \end{lstlisting}
3405
3406 \section{read -- load HDL designs}
3407 \label{cmd:read}
3408 \begin{lstlisting}[numbers=left,frame=single]
3409 read {-vlog95|-vlog2k|-sv2005|-sv2009|-sv2012|-sv|-formal} <verilog-file>..
3410
3411 Load the specified Verilog/SystemVerilog files. (Full SystemVerilog support
3412 is only available via Verific.)
3413
3414 Additional -D<macro>[=<value>] options may be added after the option indicating
3415 the language version (and before file names) to set additional verilog defines.
3416
3417
3418 read {-vhdl87|-vhdl93|-vhdl2k|-vhdl2008|-vhdl} <vhdl-file>..
3419
3420 Load the specified VHDL files. (Requires Verific.)
3421
3422
3423 read -define <macro>[=<value>]..
3424
3425 Set global Verilog/SystemVerilog defines.
3426
3427
3428 read -undef <macro>..
3429
3430 Unset global Verilog/SystemVerilog defines.
3431
3432
3433 read -incdir <directory>
3434
3435 Add directory to global Verilog/SystemVerilog include directories.
3436
3437
3438 read -verific
3439 read -noverific
3440
3441 Subsequent calls to 'read' will either use or not use Verific. Calling 'read'
3442 with -verific will result in an error on Yosys binaries that are built without
3443 Verific support. The default is to use Verific if it is available.
3444 \end{lstlisting}
3445
3446 \section{read\_aiger -- read AIGER file}
3447 \label{cmd:read_aiger}
3448 \begin{lstlisting}[numbers=left,frame=single]
3449 read_aiger [options] [filename]
3450
3451 Load module from an AIGER file into the current design.
3452
3453 -module_name <module_name>
3454 name of module to be created (default: <filename>)
3455
3456 -clk_name <wire_name>
3457 if specified, AIGER latches to be transformed into $_DFF_P_ cells
3458 clocked by wire of this name. otherwise, $_FF_ cells will be used
3459
3460 -map <filename>
3461 read file with port and latch symbols
3462
3463 -wideports
3464 merge ports that match the pattern 'name[int]' into a single
3465 multi-bit port 'name'
3466
3467 -xaiger
3468 read XAIGER extensions
3469 \end{lstlisting}
3470
3471 \section{read\_blif -- read BLIF file}
3472 \label{cmd:read_blif}
3473 \begin{lstlisting}[numbers=left,frame=single]
3474 read_blif [options] [filename]
3475
3476 Load modules from a BLIF file into the current design.
3477
3478 -sop
3479 Create $sop cells instead of $lut cells
3480
3481 -wideports
3482 Merge ports that match the pattern 'name[int]' into a single
3483 multi-bit port 'name'.
3484 \end{lstlisting}
3485
3486 \section{read\_ilang -- read modules from ilang file}
3487 \label{cmd:read_ilang}
3488 \begin{lstlisting}[numbers=left,frame=single]
3489 read_ilang [filename]
3490
3491 Load modules from an ilang file to the current design. (ilang is a text
3492 representation of a design in yosys's internal format.)
3493
3494 -nooverwrite
3495 ignore re-definitions of modules. (the default behavior is to
3496 create an error message if the existing module is not a blackbox
3497 module, and overwrite the existing module if it is a blackbox module.)
3498
3499 -overwrite
3500 overwrite existing modules with the same name
3501
3502 -lib
3503 only create empty blackbox modules
3504 \end{lstlisting}
3505
3506 \section{read\_json -- read JSON file}
3507 \label{cmd:read_json}
3508 \begin{lstlisting}[numbers=left,frame=single]
3509 read_json [filename]
3510
3511 Load modules from a JSON file into the current design See "help write_json"
3512 for a description of the file format.
3513 \end{lstlisting}
3514
3515 \section{read\_liberty -- read cells from liberty file}
3516 \label{cmd:read_liberty}
3517 \begin{lstlisting}[numbers=left,frame=single]
3518 read_liberty [filename]
3519
3520 Read cells from liberty file as modules into current design.
3521
3522 -lib
3523 only create empty blackbox modules
3524
3525 -nooverwrite
3526 ignore re-definitions of modules. (the default behavior is to
3527 create an error message if the existing module is not a blackbox
3528 module, and overwrite the existing module if it is a blackbox module.)
3529
3530 -overwrite
3531 overwrite existing modules with the same name
3532
3533 -ignore_miss_func
3534 ignore cells with missing function specification of outputs
3535
3536 -ignore_miss_dir
3537 ignore cells with a missing or invalid direction
3538 specification on a pin
3539
3540 -ignore_miss_data_latch
3541 ignore latches with missing data and/or enable pins
3542
3543 -setattr <attribute_name>
3544 set the specified attribute (to the value 1) on all loaded modules
3545 \end{lstlisting}
3546
3547 \section{read\_verilog -- read modules from Verilog file}
3548 \label{cmd:read_verilog}
3549 \begin{lstlisting}[numbers=left,frame=single]
3550 read_verilog [options] [filename]
3551
3552 Load modules from a Verilog file to the current design. A large subset of
3553 Verilog-2005 is supported.
3554
3555 -sv
3556 enable support for SystemVerilog features. (only a small subset
3557 of SystemVerilog is supported)
3558
3559 -formal
3560 enable support for SystemVerilog assertions and some Yosys extensions
3561 replace the implicit -D SYNTHESIS with -D FORMAL
3562
3563 -noassert
3564 ignore assert() statements
3565
3566 -noassume
3567 ignore assume() statements
3568
3569 -norestrict
3570 ignore restrict() statements
3571
3572 -assume-asserts
3573 treat all assert() statements like assume() statements
3574
3575 -assert-assumes
3576 treat all assume() statements like assert() statements
3577
3578 -debug
3579 alias for -dump_ast1 -dump_ast2 -dump_vlog1 -dump_vlog2 -yydebug
3580
3581 -dump_ast1
3582 dump abstract syntax tree (before simplification)
3583
3584 -dump_ast2
3585 dump abstract syntax tree (after simplification)
3586
3587 -no_dump_ptr
3588 do not include hex memory addresses in dump (easier to diff dumps)
3589
3590 -dump_vlog1
3591 dump ast as Verilog code (before simplification)
3592
3593 -dump_vlog2
3594 dump ast as Verilog code (after simplification)
3595
3596 -dump_rtlil
3597 dump generated RTLIL netlist
3598
3599 -yydebug
3600 enable parser debug output
3601
3602 -nolatches
3603 usually latches are synthesized into logic loops
3604 this option prohibits this and sets the output to 'x'
3605 in what would be the latches hold condition
3606
3607 this behavior can also be achieved by setting the
3608 'nolatches' attribute on the respective module or
3609 always block.
3610
3611 -nomem2reg
3612 under certain conditions memories are converted to registers
3613 early during simplification to ensure correct handling of
3614 complex corner cases. this option disables this behavior.
3615
3616 this can also be achieved by setting the 'nomem2reg'
3617 attribute on the respective module or register.
3618
3619 This is potentially dangerous. Usually the front-end has good
3620 reasons for converting an array to a list of registers.
3621 Prohibiting this step will likely result in incorrect synthesis
3622 results.
3623
3624 -mem2reg
3625 always convert memories to registers. this can also be
3626 achieved by setting the 'mem2reg' attribute on the respective
3627 module or register.
3628
3629 -nomeminit
3630 do not infer $meminit cells and instead convert initialized
3631 memories to registers directly in the front-end.
3632
3633 -ppdump
3634 dump Verilog code after pre-processor
3635
3636 -nopp
3637 do not run the pre-processor
3638
3639 -nodpi
3640 disable DPI-C support
3641
3642 -noblackbox
3643 do not automatically add a (* blackbox *) attribute to an
3644 empty module.
3645
3646 -lib
3647 only create empty blackbox modules. This implies -DBLACKBOX.
3648 modules with the (* whitebox *) attribute will be preserved.
3649 (* lib_whitebox *) will be treated like (* whitebox *).
3650
3651 -nowb
3652 delete (* whitebox *) and (* lib_whitebox *) attributes from
3653 all modules.
3654
3655 -specify
3656 parse and import specify blocks
3657
3658 -noopt
3659 don't perform basic optimizations (such as const folding) in the
3660 high-level front-end.
3661
3662 -icells
3663 interpret cell types starting with '$' as internal cell types
3664
3665 -pwires
3666 add a wire for each module parameter
3667
3668 -nooverwrite
3669 ignore re-definitions of modules. (the default behavior is to
3670 create an error message if the existing module is not a black box
3671 module, and overwrite the existing module otherwise.)
3672
3673 -overwrite
3674 overwrite existing modules with the same name
3675
3676 -defer
3677 only read the abstract syntax tree and defer actual compilation
3678 to a later 'hierarchy' command. Useful in cases where the default
3679 parameters of modules yield invalid or not synthesizable code.
3680
3681 -noautowire
3682 make the default of `default_nettype be "none" instead of "wire".
3683
3684 -setattr <attribute_name>
3685 set the specified attribute (to the value 1) on all loaded modules
3686
3687 -Dname[=definition]
3688 define the preprocessor symbol 'name' and set its optional value
3689 'definition'
3690
3691 -Idir
3692 add 'dir' to the directories which are used when searching include
3693 files
3694
3695 The command 'verilog_defaults' can be used to register default options for
3696 subsequent calls to 'read_verilog'.
3697
3698 Note that the Verilog frontend does a pretty good job of processing valid
3699 verilog input, but has not very good error reporting. It generally is
3700 recommended to use a simulator (for example Icarus Verilog) for checking
3701 the syntax of the code, rather than to rely on read_verilog for that.
3702
3703 Depending on if read_verilog is run in -formal mode, either the macro
3704 SYNTHESIS or FORMAL is defined automatically. In addition, read_verilog
3705 always defines the macro YOSYS.
3706
3707 See the Yosys README file for a list of non-standard Verilog features
3708 supported by the Yosys Verilog front-end.
3709 \end{lstlisting}
3710
3711 \section{rename -- rename object in the design}
3712 \label{cmd:rename}
3713 \begin{lstlisting}[numbers=left,frame=single]
3714 rename old_name new_name
3715
3716 Rename the specified object. Note that selection patterns are not supported
3717 by this command.
3718
3719
3720
3721 rename -output old_name new_name
3722
3723 Like above, but also make the wire an output. This will fail if the object is
3724 not a wire.
3725
3726
3727 rename -src [selection]
3728
3729 Assign names auto-generated from the src attribute to all selected wires and
3730 cells with private names.
3731
3732
3733 rename -wire [selection]
3734
3735 Assign auto-generated names based on the wires they drive to all selected
3736 cells with private names. Ignores cells driving privatly named wires.
3737
3738
3739 rename -enumerate [-pattern <pattern>] [selection]
3740
3741 Assign short auto-generated names to all selected wires and cells with private
3742 names. The -pattern option can be used to set the pattern for the new names.
3743 The character % in the pattern is replaced with a integer number. The default
3744 pattern is '_%_'.
3745
3746
3747 rename -hide [selection]
3748
3749 Assign private names (the ones with $-prefix) to all selected wires and cells
3750 with public names. This ignores all selected ports.
3751
3752
3753 rename -top new_name
3754
3755 Rename top module.
3756 \end{lstlisting}
3757
3758 \section{rmports -- remove module ports with no connections}
3759 \label{cmd:rmports}
3760 \begin{lstlisting}[numbers=left,frame=single]
3761 rmports [selection]
3762
3763 This pass identifies ports in the selected modules which are not used or
3764 driven and removes them.
3765 \end{lstlisting}
3766
3767 \section{sat -- solve a SAT problem in the circuit}
3768 \label{cmd:sat}
3769 \begin{lstlisting}[numbers=left,frame=single]
3770 sat [options] [selection]
3771
3772 This command solves a SAT problem defined over the currently selected circuit
3773 and additional constraints passed as parameters.
3774
3775 -all
3776 show all solutions to the problem (this can grow exponentially, use
3777 -max <N> instead to get <N> solutions)
3778
3779 -max <N>
3780 like -all, but limit number of solutions to <N>
3781
3782 -enable_undef
3783 enable modeling of undef value (aka 'x-bits')
3784 this option is implied by -set-def, -set-undef et. cetera
3785
3786 -max_undef
3787 maximize the number of undef bits in solutions, giving a better
3788 picture of which input bits are actually vital to the solution.
3789
3790 -set <signal> <value>
3791 set the specified signal to the specified value.
3792
3793 -set-def <signal>
3794 add a constraint that all bits of the given signal must be defined
3795
3796 -set-any-undef <signal>
3797 add a constraint that at least one bit of the given signal is undefined
3798
3799 -set-all-undef <signal>
3800 add a constraint that all bits of the given signal are undefined
3801
3802 -set-def-inputs
3803 add -set-def constraints for all module inputs
3804
3805 -show <signal>
3806 show the model for the specified signal. if no -show option is
3807 passed then a set of signals to be shown is automatically selected.
3808
3809 -show-inputs, -show-outputs, -show-ports
3810 add all module (input/output) ports to the list of shown signals
3811
3812 -show-regs, -show-public, -show-all
3813 show all registers, show signals with 'public' names, show all signals
3814
3815 -ignore_div_by_zero
3816 ignore all solutions that involve a division by zero
3817
3818 -ignore_unknown_cells
3819 ignore all cells that can not be matched to a SAT model
3820
3821 The following options can be used to set up a sequential problem:
3822
3823 -seq <N>
3824 set up a sequential problem with <N> time steps. The steps will
3825 be numbered from 1 to N.
3826
3827 note: for large <N> it can be significantly faster to use
3828 -tempinduct-baseonly -maxsteps <N> instead of -seq <N>.
3829
3830 -set-at <N> <signal> <value>
3831 -unset-at <N> <signal>
3832 set or unset the specified signal to the specified value in the
3833 given timestep. this has priority over a -set for the same signal.
3834
3835 -set-assumes
3836 set all assumptions provided via $assume cells
3837
3838 -set-def-at <N> <signal>
3839 -set-any-undef-at <N> <signal>
3840 -set-all-undef-at <N> <signal>
3841 add undef constraints in the given timestep.
3842
3843 -set-init <signal> <value>
3844 set the initial value for the register driving the signal to the value
3845
3846 -set-init-undef
3847 set all initial states (not set using -set-init) to undef
3848
3849 -set-init-def
3850 do not force a value for the initial state but do not allow undef
3851
3852 -set-init-zero
3853 set all initial states (not set using -set-init) to zero
3854
3855 -dump_vcd <vcd-file-name>
3856 dump SAT model (counter example in proof) to VCD file
3857
3858 -dump_json <json-file-name>
3859 dump SAT model (counter example in proof) to a WaveJSON file.
3860
3861 -dump_cnf <cnf-file-name>
3862 dump CNF of SAT problem (in DIMACS format). in temporal induction
3863 proofs this is the CNF of the first induction step.
3864
3865 The following additional options can be used to set up a proof. If also -seq
3866 is passed, a temporal induction proof is performed.
3867
3868 -tempinduct
3869 Perform a temporal induction proof. In a temporal induction proof it is
3870 proven that the condition holds forever after the number of time steps
3871 specified using -seq.
3872
3873 -tempinduct-def
3874 Perform a temporal induction proof. Assume an initial state with all
3875 registers set to defined values for the induction step.
3876
3877 -tempinduct-baseonly
3878 Run only the basecase half of temporal induction (requires -maxsteps)
3879
3880 -tempinduct-inductonly
3881 Run only the induction half of temporal induction
3882
3883 -tempinduct-skip <N>
3884 Skip the first <N> steps of the induction proof.
3885
3886 note: this will assume that the base case holds for <N> steps.
3887 this must be proven independently with "-tempinduct-baseonly
3888 -maxsteps <N>". Use -initsteps if you just want to set a
3889 minimal induction length.
3890
3891 -prove <signal> <value>
3892 Attempt to proof that <signal> is always <value>.
3893
3894 -prove-x <signal> <value>
3895 Like -prove, but an undef (x) bit in the lhs matches any value on
3896 the right hand side. Useful for equivalence checking.
3897
3898 -prove-asserts
3899 Prove that all asserts in the design hold.
3900
3901 -prove-skip <N>
3902 Do not enforce the prove-condition for the first <N> time steps.
3903
3904 -maxsteps <N>
3905 Set a maximum length for the induction.
3906
3907 -initsteps <N>
3908 Set initial length for the induction.
3909 This will speed up the search of the right induction length
3910 for deep induction proofs.
3911
3912 -stepsize <N>
3913 Increase the size of the induction proof in steps of <N>.
3914 This will speed up the search of the right induction length
3915 for deep induction proofs.
3916
3917 -timeout <N>
3918 Maximum number of seconds a single SAT instance may take.
3919
3920 -verify
3921 Return an error and stop the synthesis script if the proof fails.
3922
3923 -verify-no-timeout
3924 Like -verify but do not return an error for timeouts.
3925
3926 -falsify
3927 Return an error and stop the synthesis script if the proof succeeds.
3928
3929 -falsify-no-timeout
3930 Like -falsify but do not return an error for timeouts.
3931 \end{lstlisting}
3932
3933 \section{scatter -- add additional intermediate nets}
3934 \label{cmd:scatter}
3935 \begin{lstlisting}[numbers=left,frame=single]
3936 scatter [selection]
3937
3938 This command adds additional intermediate nets on all cell ports. This is used
3939 for testing the correct use of the SigMap helper in passes. If you don't know
3940 what this means: don't worry -- you only need this pass when testing your own
3941 extensions to Yosys.
3942
3943 Use the opt_clean command to get rid of the additional nets.
3944 \end{lstlisting}
3945
3946 \section{scc -- detect strongly connected components (logic loops)}
3947 \label{cmd:scc}
3948 \begin{lstlisting}[numbers=left,frame=single]
3949 scc [options] [selection]
3950
3951 This command identifies strongly connected components (aka logic loops) in the
3952 design.
3953
3954 -expect <num>
3955 expect to find exactly <num> SSCs. A different number of SSCs will
3956 produce an error.
3957
3958 -max_depth <num>
3959 limit to loops not longer than the specified number of cells. This
3960 can e.g. be useful in identifying small local loops in a module that
3961 implements one large SCC.
3962
3963 -nofeedback
3964 do not count cells that have their output fed back into one of their
3965 inputs as single-cell scc.
3966
3967 -all_cell_types
3968 Usually this command only considers internal non-memory cells. With
3969 this option set, all cells are considered. For unknown cells all ports
3970 are assumed to be bidirectional 'inout' ports.
3971
3972 -set_attr <name> <value>
3973 set the specified attribute on all cells that are part of a logic
3974 loop. the special token {} in the value is replaced with a unique
3975 identifier for the logic loop.
3976
3977 -select
3978 replace the current selection with a selection of all cells and wires
3979 that are part of a found logic loop
3980 \end{lstlisting}
3981
3982 \section{scratchpad -- get/set values in the scratchpad}
3983 \label{cmd:scratchpad}
3984 \begin{lstlisting}[numbers=left,frame=single]
3985 scratchpad [options]
3986
3987 This pass allows to read and modify values from the scratchpad of the current
3988 design. Options:
3989
3990 -get <identifier>
3991 print the value saved in the scratchpad under the given identifier.
3992
3993 -set <identifier> <value>
3994 save the given value in the scratchpad under the given identifier.
3995
3996 -unset <identifier>
3997 remove the entry for the given identifier from the scratchpad.
3998
3999 -copy <identifier_from> <identifier_to>
4000 copy the value of the first identifier to the second identifier.
4001
4002 -assert <identifier> <value>
4003 assert that the entry for the given identifier is set to the given value.
4004
4005 -assert-set <identifier>
4006 assert that the entry for the given identifier exists.
4007
4008 -assert-unset <identifier>
4009 assert that the entry for the given identifier does not exist.
4010
4011 The identifier may not contain whitespace. By convention, it is usually prefixed
4012 by the name of the pass that uses it, e.g. 'opt.did_something'. If the value
4013 contains whitespace, it must be enclosed in double quotes.
4014 \end{lstlisting}
4015
4016 \section{script -- execute commands from file or wire}
4017 \label{cmd:script}
4018 \begin{lstlisting}[numbers=left,frame=single]
4019 script <filename> [<from_label>:<to_label>]
4020 script -scriptwire [selection]
4021
4022 This command executes the yosys commands in the specified file (default
4023 behaviour), or commands embedded in the constant text value connected to the
4024 selected wires.
4025
4026 In the default (file) case, the 2nd argument can be used to only execute the
4027 section of the file between the specified labels. An empty from label is
4028 synonymous with the beginning of the file and an empty to label is synonymous
4029 with the end of the file.
4030
4031 If only one label is specified (without ':') then only the block
4032 marked with that label (until the next label) is executed.
4033
4034 In "-scriptwire" mode, the commands on the selected wire(s) will be executed
4035 in the scope of (and thus, relative to) the wires' owning module(s). This
4036 '-module' mode can be exited by using the 'cd' command.
4037 \end{lstlisting}
4038
4039 \section{select -- modify and view the list of selected objects}
4040 \label{cmd:select}
4041 \begin{lstlisting}[numbers=left,frame=single]
4042 select [ -add | -del | -set <name> ] {-read <filename> | <selection>}
4043 select [ <assert_option> ] {-read <filename> | <selection>}
4044 select [ -list | -write <filename> | -count | -clear ]
4045 select -module <modname>
4046
4047 Most commands use the list of currently selected objects to determine which part
4048 of the design to operate on. This command can be used to modify and view this
4049 list of selected objects.
4050
4051 Note that many commands support an optional [selection] argument that can be
4052 used to override the global selection for the command. The syntax of this
4053 optional argument is identical to the syntax of the <selection> argument
4054 described here.
4055
4056 -add, -del
4057 add or remove the given objects to the current selection.
4058 without this options the current selection is replaced.
4059
4060 -set <name>
4061 do not modify the current selection. instead save the new selection
4062 under the given name (see @<name> below). to save the current selection,
4063 use "select -set <name> %"
4064
4065 -assert-none
4066 do not modify the current selection. instead assert that the given
4067 selection is empty. i.e. produce an error if any object matching the
4068 selection is found.
4069
4070 -assert-any
4071 do not modify the current selection. instead assert that the given
4072 selection is non-empty. i.e. produce an error if no object matching
4073 the selection is found.
4074
4075 -assert-count N
4076 do not modify the current selection. instead assert that the given
4077 selection contains exactly N objects.
4078
4079 -assert-max N
4080 do not modify the current selection. instead assert that the given
4081 selection contains less than or exactly N objects.
4082
4083 -assert-min N
4084 do not modify the current selection. instead assert that the given
4085 selection contains at least N objects.
4086
4087 -list
4088 list all objects in the current selection
4089
4090 -write <filename>
4091 like -list but write the output to the specified file
4092
4093 -read <filename>
4094 read the specified file (written by -write)
4095
4096 -count
4097 count all objects in the current selection
4098
4099 -clear
4100 clear the current selection. this effectively selects the whole
4101 design. it also resets the selected module (see -module). use the
4102 command 'select *' to select everything but stay in the current module.
4103
4104 -none
4105 create an empty selection. the current module is unchanged.
4106
4107 -module <modname>
4108 limit the current scope to the specified module.
4109 the difference between this and simply selecting the module
4110 is that all object names are interpreted relative to this
4111 module after this command until the selection is cleared again.
4112
4113 When this command is called without an argument, the current selection
4114 is displayed in a compact form (i.e. only the module name when a whole module
4115 is selected).
4116
4117 The <selection> argument itself is a series of commands for a simple stack
4118 machine. Each element on the stack represents a set of selected objects.
4119 After this commands have been executed, the union of all remaining sets
4120 on the stack is computed and used as selection for the command.
4121
4122 Pushing (selecting) object when not in -module mode:
4123
4124 <mod_pattern>
4125 select the specified module(s)
4126
4127 <mod_pattern>/<obj_pattern>
4128 select the specified object(s) from the module(s)
4129
4130 Pushing (selecting) object when in -module mode:
4131
4132 <obj_pattern>
4133 select the specified object(s) from the current module
4134
4135 A <mod_pattern> can be a module name, wildcard expression (*, ?, [..])
4136 matching module names, or one of the following:
4137
4138 A:<pattern>, A:<pattern>=<pattern>
4139 all modules with an attribute matching the given pattern
4140 in addition to = also <, <=, >=, and > are supported
4141
4142 N:<pattern>
4143 all modules with a name matching the given pattern
4144 (i.e. 'N:' is optional as it is the default matching rule)
4145
4146 An <obj_pattern> can be an object name, wildcard expression, or one of
4147 the following:
4148
4149 w:<pattern>
4150 all wires with a name matching the given wildcard pattern
4151
4152 i:<pattern>, o:<pattern>, x:<pattern>
4153 all inputs (i:), outputs (o:) or any ports (x:) with matching names
4154
4155 s:<size>, s:<min>:<max>
4156 all wires with a matching width
4157
4158 m:<pattern>
4159 all memories with a name matching the given pattern
4160
4161 c:<pattern>
4162 all cells with a name matching the given pattern
4163
4164 t:<pattern>
4165 all cells with a type matching the given pattern
4166
4167 p:<pattern>
4168 all processes with a name matching the given pattern
4169
4170 a:<pattern>
4171 all objects with an attribute name matching the given pattern
4172
4173 a:<pattern>=<pattern>
4174 all objects with a matching attribute name-value-pair.
4175 in addition to = also <, <=, >=, and > are supported
4176
4177 r:<pattern>, r:<pattern>=<pattern>
4178 cells with matching parameters. also with <, <=, >= and >.
4179
4180 n:<pattern>
4181 all objects with a name matching the given pattern
4182 (i.e. 'n:' is optional as it is the default matching rule)
4183
4184 @<name>
4185 push the selection saved prior with 'select -set <name> ...'
4186
4187 The following actions can be performed on the top sets on the stack:
4188
4189 %
4190 push a copy of the current selection to the stack
4191
4192 %%
4193 replace the stack with a union of all elements on it
4194
4195 %n
4196 replace top set with its invert
4197
4198 %u
4199 replace the two top sets on the stack with their union
4200
4201 %i
4202 replace the two top sets on the stack with their intersection
4203
4204 %d
4205 pop the top set from the stack and subtract it from the new top
4206
4207 %D
4208 like %d but swap the roles of two top sets on the stack
4209
4210 %c
4211 create a copy of the top set from the stack and push it
4212
4213 %x[<num1>|*][.<num2>][:<rule>[:<rule>..]]
4214 expand top set <num1> num times according to the specified rules.
4215 (i.e. select all cells connected to selected wires and select all
4216 wires connected to selected cells) The rules specify which cell
4217 ports to use for this. the syntax for a rule is a '-' for exclusion
4218 and a '+' for inclusion, followed by an optional comma separated
4219 list of cell types followed by an optional comma separated list of
4220 cell ports in square brackets. a rule can also be just a cell or wire
4221 name that limits the expansion (is included but does not go beyond).
4222 select at most <num2> objects. a warning message is printed when this
4223 limit is reached. When '*' is used instead of <num1> then the process
4224 is repeated until no further object are selected.
4225
4226 %ci[<num1>|*][.<num2>][:<rule>[:<rule>..]]
4227 %co[<num1>|*][.<num2>][:<rule>[:<rule>..]]
4228 similar to %x, but only select input (%ci) or output cones (%co)
4229
4230 %xe[...] %cie[...] %coe
4231 like %x, %ci, and %co but only consider combinatorial cells
4232
4233 %a
4234 expand top set by selecting all wires that are (at least in part)
4235 aliases for selected wires.
4236
4237 %s
4238 expand top set by adding all modules that implement cells in selected
4239 modules
4240
4241 %m
4242 expand top set by selecting all modules that contain selected objects
4243
4244 %M
4245 select modules that implement selected cells
4246
4247 %C
4248 select cells that implement selected modules
4249
4250 %R[<num>]
4251 select <num> random objects from top selection (default 1)
4252
4253 Example: the following command selects all wires that are connected to a
4254 'GATE' input of a 'SWITCH' cell:
4255
4256 select */t:SWITCH %x:+[GATE] */t:SWITCH %d
4257 \end{lstlisting}
4258
4259 \section{setattr -- set/unset attributes on objects}
4260 \label{cmd:setattr}
4261 \begin{lstlisting}[numbers=left,frame=single]
4262 setattr [ -mod ] [ -set name value | -unset name ]... [selection]
4263
4264 Set/unset the given attributes on the selected objects. String values must be
4265 passed in double quotes (").
4266
4267 When called with -mod, this command will set and unset attributes on modules
4268 instead of objects within modules.
4269 \end{lstlisting}
4270
4271 \section{setparam -- set/unset parameters on objects}
4272 \label{cmd:setparam}
4273 \begin{lstlisting}[numbers=left,frame=single]
4274 setparam [ -type cell_type ] [ -set name value | -unset name ]... [selection]
4275
4276 Set/unset the given parameters on the selected cells. String values must be
4277 passed in double quotes (").
4278
4279 The -type option can be used to change the cell type of the selected cells.
4280 \end{lstlisting}
4281
4282 \section{setundef -- replace undef values with defined constants}
4283 \label{cmd:setundef}
4284 \begin{lstlisting}[numbers=left,frame=single]
4285 setundef [options] [selection]
4286
4287 This command replaces undef (x) constants with defined (0/1) constants.
4288
4289 -undriven
4290 also set undriven nets to constant values
4291
4292 -expose
4293 also expose undriven nets as inputs (use with -undriven)
4294
4295 -zero
4296 replace with bits cleared (0)
4297
4298 -one
4299 replace with bits set (1)
4300
4301 -undef
4302 replace with undef (x) bits, may be used with -undriven
4303
4304 -anyseq
4305 replace with $anyseq drivers (for formal)
4306
4307 -anyconst
4308 replace with $anyconst drivers (for formal)
4309
4310 -random <seed>
4311 replace with random bits using the specified integer as seed
4312 value for the random number generator.
4313
4314 -init
4315 also create/update init values for flip-flops
4316
4317 -params
4318 replace undef in cell parameters
4319 \end{lstlisting}
4320
4321 \section{sf2\_iobs -- SF2: insert IO buffers}
4322 \label{cmd:sf2_iobs}
4323 \begin{lstlisting}[numbers=left,frame=single]
4324 sf2_iobs [options] [selection]
4325
4326 Add SF2 I/O buffers and global buffers to top module as needed.
4327
4328 -clkbuf
4329 Insert PAD->global_net clock buffers
4330 \end{lstlisting}
4331
4332 \section{share -- perform sat-based resource sharing}
4333 \label{cmd:share}
4334 \begin{lstlisting}[numbers=left,frame=single]
4335 share [options] [selection]
4336
4337 This pass merges shareable resources into a single resource. A SAT solver
4338 is used to determine if two resources are share-able.
4339
4340 -force
4341 Per default the selection of cells that is considered for sharing is
4342 narrowed using a list of cell types. With this option all selected
4343 cells are considered for resource sharing.
4344
4345 IMPORTANT NOTE: If the -all option is used then no cells with internal
4346 state must be selected!
4347
4348 -aggressive
4349 Per default some heuristics are used to reduce the number of cells
4350 considered for resource sharing to only large resources. This options
4351 turns this heuristics off, resulting in much more cells being considered
4352 for resource sharing.
4353
4354 -fast
4355 Only consider the simple part of the control logic in SAT solving, resulting
4356 in much easier SAT problems at the cost of maybe missing some opportunities
4357 for resource sharing.
4358
4359 -limit N
4360 Only perform the first N merges, then stop. This is useful for debugging.
4361 \end{lstlisting}
4362
4363 \section{shell -- enter interactive command mode}
4364 \label{cmd:shell}
4365 \begin{lstlisting}[numbers=left,frame=single]
4366 shell
4367
4368 This command enters the interactive command mode. This can be useful
4369 in a script to interrupt the script at a certain point and allow for
4370 interactive inspection or manual synthesis of the design at this point.
4371
4372 The command prompt of the interactive shell indicates the current
4373 selection (see 'help select'):
4374
4375 yosys>
4376 the entire design is selected
4377
4378 yosys*>
4379 only part of the design is selected
4380
4381 yosys [modname]>
4382 the entire module 'modname' is selected using 'select -module modname'
4383
4384 yosys [modname]*>
4385 only part of current module 'modname' is selected
4386
4387 When in interactive shell, some errors (e.g. invalid command arguments)
4388 do not terminate yosys but return to the command prompt.
4389
4390 This command is the default action if nothing else has been specified
4391 on the command line.
4392
4393 Press Ctrl-D or type 'exit' to leave the interactive shell.
4394 \end{lstlisting}
4395
4396 \section{show -- generate schematics using graphviz}
4397 \label{cmd:show}
4398 \begin{lstlisting}[numbers=left,frame=single]
4399 show [options] [selection]
4400
4401 Create a graphviz DOT file for the selected part of the design and compile it
4402 to a graphics file (usually SVG or PostScript).
4403
4404 -viewer <viewer>
4405 Run the specified command with the graphics file as parameter.
4406 On Windows, this pauses yosys until the viewer exits.
4407
4408 -format <format>
4409 Generate a graphics file in the specified format. Use 'dot' to just
4410 generate a .dot file, or other <format> strings such as 'svg' or 'ps'
4411 to generate files in other formats (this calls the 'dot' command).
4412
4413 -lib <verilog_or_ilang_file>
4414 Use the specified library file for determining whether cell ports are
4415 inputs or outputs. This option can be used multiple times to specify
4416 more than one library.
4417
4418 note: in most cases it is better to load the library before calling
4419 show with 'read_verilog -lib <filename>'. it is also possible to
4420 load liberty files with 'read_liberty -lib <filename>'.
4421
4422 -prefix <prefix>
4423 generate <prefix>.* instead of ~/.yosys_show.*
4424
4425 -color <color> <object>
4426 assign the specified color to the specified object. The object can be
4427 a single selection wildcard expressions or a saved set of objects in
4428 the @<name> syntax (see "help select" for details).
4429
4430 -label <text> <object>
4431 assign the specified label text to the specified object. The object can
4432 be a single selection wildcard expressions or a saved set of objects in
4433 the @<name> syntax (see "help select" for details).
4434
4435 -colors <seed>
4436 Randomly assign colors to the wires. The integer argument is the seed
4437 for the random number generator. Change the seed value if the colored
4438 graph still is ambiguous. A seed of zero deactivates the coloring.
4439
4440 -colorattr <attribute_name>
4441 Use the specified attribute to assign colors. A unique color is
4442 assigned to each unique value of this attribute.
4443
4444 -width
4445 annotate buses with a label indicating the width of the bus.
4446
4447 -signed
4448 mark ports (A, B) that are declared as signed (using the [AB]_SIGNED
4449 cell parameter) with an asterisk next to the port name.
4450
4451 -stretch
4452 stretch the graph so all inputs are on the left side and all outputs
4453 (including inout ports) are on the right side.
4454
4455 -pause
4456 wait for the use to press enter to before returning
4457
4458 -enum
4459 enumerate objects with internal ($-prefixed) names
4460
4461 -long
4462 do not abbreviate objects with internal ($-prefixed) names
4463
4464 -notitle
4465 do not add the module name as graph title to the dot file
4466
4467 -nobg
4468 don't run viewer in the background, IE wait for the viewer tool to
4469 exit before returning
4470
4471 When no <format> is specified, 'dot' is used. When no <format> and <viewer> is
4472 specified, 'xdot' is used to display the schematic (POSIX systems only).
4473
4474 The generated output files are '~/.yosys_show.dot' and '~/.yosys_show.<format>',
4475 unless another prefix is specified using -prefix <prefix>.
4476
4477 Yosys on Windows and YosysJS use different defaults: The output is written
4478 to 'show.dot' in the current directory and new viewer is launched each time
4479 the 'show' command is executed.
4480 \end{lstlisting}
4481
4482 \section{shregmap -- map shift registers}
4483 \label{cmd:shregmap}
4484 \begin{lstlisting}[numbers=left,frame=single]
4485 shregmap [options] [selection]
4486
4487 This pass converts chains of $_DFF_[NP]_ gates to target specific shift register
4488 primitives. The generated shift register will be of type $__SHREG_DFF_[NP]_ and
4489 will use the same interface as the original $_DFF_*_ cells. The cell parameter
4490 'DEPTH' will contain the depth of the shift register. Use a target-specific
4491 'techmap' map file to convert those cells to the actual target cells.
4492
4493 -minlen N
4494 minimum length of shift register (default = 2)
4495 (this is the length after -keep_before and -keep_after)
4496
4497 -maxlen N
4498 maximum length of shift register (default = no limit)
4499 larger chains will be mapped to multiple shift register instances
4500
4501 -keep_before N
4502 number of DFFs to keep before the shift register (default = 0)
4503
4504 -keep_after N
4505 number of DFFs to keep after the shift register (default = 0)
4506
4507 -clkpol pos|neg|any
4508 limit match to only positive or negative edge clocks. (default = any)
4509
4510 -enpol pos|neg|none|any_or_none|any
4511 limit match to FFs with the specified enable polarity. (default = none)
4512
4513 -match <cell_type>[:<d_port_name>:<q_port_name>]
4514 match the specified cells instead of $_DFF_N_ and $_DFF_P_. If
4515 ':<d_port_name>:<q_port_name>' is omitted then 'D' and 'Q' is used
4516 by default. E.g. the option '-clkpol pos' is just an alias for
4517 '-match $_DFF_P_', which is an alias for '-match $_DFF_P_:D:Q'.
4518
4519 -params
4520 instead of encoding the clock and enable polarity in the cell name by
4521 deriving from the original cell name, simply name all generated cells
4522 $__SHREG_ and use CLKPOL and ENPOL parameters. An ENPOL value of 2 is
4523 used to denote cells without enable input. The ENPOL parameter is
4524 omitted when '-enpol none' (or no -enpol option) is passed.
4525
4526 -zinit
4527 assume the shift register is automatically zero-initialized, so it
4528 becomes legal to merge zero initialized FFs into the shift register.
4529
4530 -init
4531 map initialized registers to the shift reg, add an INIT parameter to
4532 generated cells with the initialization value. (first bit to shift out
4533 in LSB position)
4534
4535 -tech greenpak4
4536 map to greenpak4 shift registers.
4537 \end{lstlisting}
4538
4539 \section{sim -- simulate the circuit}
4540 \label{cmd:sim}
4541 \begin{lstlisting}[numbers=left,frame=single]
4542 sim [options] [top-level]
4543
4544 This command simulates the circuit using the given top-level module.
4545
4546 -vcd <filename>
4547 write the simulation results to the given VCD file
4548
4549 -clock <portname>
4550 name of top-level clock input
4551
4552 -clockn <portname>
4553 name of top-level clock input (inverse polarity)
4554
4555 -reset <portname>
4556 name of top-level reset input (active high)
4557
4558 -resetn <portname>
4559 name of top-level inverted reset input (active low)
4560
4561 -rstlen <integer>
4562 number of cycles reset should stay active (default: 1)
4563
4564 -zinit
4565 zero-initialize all uninitialized regs and memories
4566
4567 -n <integer>
4568 number of cycles to simulate (default: 20)
4569
4570 -a
4571 include all nets in VCD output, not just those with public names
4572
4573 -w
4574 writeback mode: use final simulation state as new init state
4575
4576 -d
4577 enable debug output
4578 \end{lstlisting}
4579
4580 \section{simplemap -- mapping simple coarse-grain cells}
4581 \label{cmd:simplemap}
4582 \begin{lstlisting}[numbers=left,frame=single]
4583 simplemap [selection]
4584
4585 This pass maps a small selection of simple coarse-grain cells to yosys gate
4586 primitives. The following internal cell types are mapped by this pass:
4587
4588 $not, $pos, $and, $or, $xor, $xnor
4589 $reduce_and, $reduce_or, $reduce_xor, $reduce_xnor, $reduce_bool
4590 $logic_not, $logic_and, $logic_or, $mux, $tribuf
4591 $sr, $ff, $dff, $dffsr, $adff, $dlatch
4592 \end{lstlisting}
4593
4594 \section{splice -- create explicit splicing cells}
4595 \label{cmd:splice}
4596 \begin{lstlisting}[numbers=left,frame=single]
4597 splice [options] [selection]
4598
4599 This command adds $slice and $concat cells to the design to make the splicing
4600 of multi-bit signals explicit. This for example is useful for coarse grain
4601 synthesis, where dedicated hardware is needed to splice signals.
4602
4603 -sel_by_cell
4604 only select the cell ports to rewire by the cell. if the selection
4605 contains a cell, than all cell inputs are rewired, if necessary.
4606
4607 -sel_by_wire
4608 only select the cell ports to rewire by the wire. if the selection
4609 contains a wire, than all cell ports driven by this wire are wired,
4610 if necessary.
4611
4612 -sel_any_bit
4613 it is sufficient if the driver of any bit of a cell port is selected.
4614 by default all bits must be selected.
4615
4616 -wires
4617 also add $slice and $concat cells to drive otherwise unused wires.
4618
4619 -no_outputs
4620 do not rewire selected module outputs.
4621
4622 -port <name>
4623 only rewire cell ports with the specified name. can be used multiple
4624 times. implies -no_output.
4625
4626 -no_port <name>
4627 do not rewire cell ports with the specified name. can be used multiple
4628 times. can not be combined with -port <name>.
4629
4630 By default selected output wires and all cell ports of selected cells driven
4631 by selected wires are rewired.
4632 \end{lstlisting}
4633
4634 \section{splitnets -- split up multi-bit nets}
4635 \label{cmd:splitnets}
4636 \begin{lstlisting}[numbers=left,frame=single]
4637 splitnets [options] [selection]
4638
4639 This command splits multi-bit nets into single-bit nets.
4640
4641 -format char1[char2[char3]]
4642 the first char is inserted between the net name and the bit index, the
4643 second char is appended to the netname. e.g. -format () creates net
4644 names like 'mysignal(42)'. the 3rd character is the range separation
4645 character when creating multi-bit wires. the default is '[]:'.
4646
4647 -ports
4648 also split module ports. per default only internal signals are split.
4649
4650 -driver
4651 don't blindly split nets in individual bits. instead look at the driver
4652 and split nets so that no driver drives only part of a net.
4653 \end{lstlisting}
4654
4655 \section{stat -- print some statistics}
4656 \label{cmd:stat}
4657 \begin{lstlisting}[numbers=left,frame=single]
4658 stat [options] [selection]
4659
4660 Print some statistics (number of objects) on the selected portion of the
4661 design.
4662
4663 -top <module>
4664 print design hierarchy with this module as top. if the design is fully
4665 selected and a module has the 'top' attribute set, this module is used
4666 default value for this option.
4667
4668 -liberty <liberty_file>
4669 use cell area information from the provided liberty file
4670
4671 -tech <technology>
4672 print area estemate for the specified technology. Currently supported
4673 values for <technology>: xilinx, cmos
4674
4675 -width
4676 annotate internal cell types with their word width.
4677 e.g. $add_8 for an 8 bit wide $add cell.
4678 \end{lstlisting}
4679
4680 \section{submod -- moving part of a module to a new submodule}
4681 \label{cmd:submod}
4682 \begin{lstlisting}[numbers=left,frame=single]
4683 submod [options] [selection]
4684
4685 This pass identifies all cells with the 'submod' attribute and moves them to
4686 a newly created module. The value of the attribute is used as name for the
4687 cell that replaces the group of cells with the same attribute value.
4688
4689 This pass can be used to create a design hierarchy in flat design. This can
4690 be useful for analyzing or reverse-engineering a design.
4691
4692 This pass only operates on completely selected modules with no processes
4693 or memories.
4694
4695 -copy
4696 by default the cells are 'moved' from the source module and the source
4697 module will use an instance of the new module after this command is
4698 finished. call with -copy to not modify the source module.
4699
4700 -name <name>
4701 don't use the 'submod' attribute but instead use the selection. only
4702 objects from one module might be selected. the value of the -name option
4703 is used as the value of the 'submod' attribute instead.
4704
4705 -hidden
4706 instead of creating submodule ports with public names, create ports with
4707 private names so that a subsequent 'flatten; clean' call will restore the
4708 original module with original public names.
4709 \end{lstlisting}
4710
4711 \section{supercover -- add hi/lo cover cells for each wire bit}
4712 \label{cmd:supercover}
4713 \begin{lstlisting}[numbers=left,frame=single]
4714 supercover [options] [selection]
4715
4716 This command adds two cover cells for each bit of each selected wire, one
4717 checking for a hi signal level and one checking for lo level.
4718 \end{lstlisting}
4719
4720 \section{synth -- generic synthesis script}
4721 \label{cmd:synth}
4722 \begin{lstlisting}[numbers=left,frame=single]
4723 synth [options]
4724
4725 This command runs the default synthesis script. This command does not operate
4726 on partly selected designs.
4727
4728 -top <module>
4729 use the specified module as top module (default='top')
4730
4731 -auto-top
4732 automatically determine the top of the design hierarchy
4733
4734 -flatten
4735 flatten the design before synthesis. this will pass '-auto-top' to
4736 'hierarchy' if no top module is specified.
4737
4738 -encfile <file>
4739 passed to 'fsm_recode' via 'fsm'
4740
4741 -lut <k>
4742 perform synthesis for a k-LUT architecture.
4743
4744 -nofsm
4745 do not run FSM optimization
4746
4747 -noabc
4748 do not run abc (as if yosys was compiled without ABC support)
4749
4750 -noalumacc
4751 do not run 'alumacc' pass. i.e. keep arithmetic operators in
4752 their direct form ($add, $sub, etc.).
4753
4754 -nordff
4755 passed to 'memory'. prohibits merging of FFs into memory read ports
4756
4757 -noshare
4758 do not run SAT-based resource sharing
4759
4760 -run <from_label>[:<to_label>]
4761 only run the commands between the labels (see below). an empty
4762 from label is synonymous to 'begin', and empty to label is
4763 synonymous to the end of the command list.
4764
4765 -abc9
4766 use new ABC9 flow (EXPERIMENTAL)
4767
4768 -flowmap
4769 use FlowMap LUT techmapping instead of ABC
4770
4771
4772 The following commands are executed by this synthesis command:
4773
4774 begin:
4775 hierarchy -check [-top <top> | -auto-top]
4776
4777 coarse:
4778 proc
4779 flatten (if -flatten)
4780 opt_expr
4781 opt_clean
4782 check
4783 opt
4784 wreduce
4785 peepopt
4786 opt_clean
4787 techmap -map +/cmp2lut.v -map +/cmp2lcu.v (if -lut)
4788 alumacc (unless -noalumacc)
4789 share (unless -noshare)
4790 opt
4791 fsm (unless -nofsm)
4792 opt -fast
4793 memory -nomap
4794 opt_clean
4795
4796 fine:
4797 opt -fast -full
4798 memory_map
4799 opt -full
4800 techmap
4801 techmap -map +/gate2lut.v (if -noabc and -lut)
4802 clean; opt_lut (if -noabc and -lut)
4803 flowmap -maxlut K (if -flowmap and -lut)
4804 opt -fast
4805 abc -fast (unless -noabc, unless -lut)
4806 abc -fast -lut k (unless -noabc, if -lut)
4807 opt -fast (unless -noabc)
4808
4809 check:
4810 hierarchy -check
4811 stat
4812 check
4813 \end{lstlisting}
4814
4815 \section{synth\_achronix -- synthesis for Acrhonix Speedster22i FPGAs.}
4816 \label{cmd:synth_achronix}
4817 \begin{lstlisting}[numbers=left,frame=single]
4818 synth_achronix [options]
4819
4820 This command runs synthesis for Achronix Speedster eFPGAs. This work is still experimental.
4821
4822 -top <module>
4823 use the specified module as top module (default='top')
4824
4825 -vout <file>
4826 write the design to the specified Verilog netlist file. writing of an
4827 output file is omitted if this parameter is not specified.
4828
4829 -run <from_label>:<to_label>
4830 only run the commands between the labels (see below). an empty
4831 from label is synonymous to 'begin', and empty to label is
4832 synonymous to the end of the command list.
4833
4834 -noflatten
4835 do not flatten design before synthesis
4836
4837 -retime
4838 run 'abc' with '-dff -D 1' options
4839
4840
4841 The following commands are executed by this synthesis command:
4842
4843 begin:
4844 read_verilog -sv -lib +/achronix/speedster22i/cells_sim.v
4845 hierarchy -check -top <top>
4846
4847 flatten: (unless -noflatten)
4848 proc
4849 flatten
4850 tribuf -logic
4851 deminout
4852
4853 coarse:
4854 synth -run coarse
4855
4856 fine:
4857 opt -fast -mux_undef -undriven -fine -full
4858 memory_map
4859 opt -undriven -fine
4860 dff2dffe -direct-match $_DFF_*
4861 opt -fine
4862 techmap -map +/techmap.v
4863 opt -full
4864 clean -purge
4865 setundef -undriven -zero
4866 abc -markgroups -dff -D 1 (only if -retime)
4867
4868 map_luts:
4869 abc -lut 4
4870 clean
4871
4872 map_cells:
4873 iopadmap -bits -outpad $__outpad I:O -inpad $__inpad O:I
4874 techmap -map +/achronix/speedster22i/cells_map.v
4875 clean -purge
4876
4877 check:
4878 hierarchy -check
4879 stat
4880 check -noinit
4881
4882 vout:
4883 write_verilog -nodec -attr2comment -defparam -renameprefix syn_ <file-name>
4884 \end{lstlisting}
4885
4886 \section{synth\_anlogic -- synthesis for Anlogic FPGAs}
4887 \label{cmd:synth_anlogic}
4888 \begin{lstlisting}[numbers=left,frame=single]
4889 synth_anlogic [options]
4890
4891 This command runs synthesis for Anlogic FPGAs.
4892
4893 -top <module>
4894 use the specified module as top module
4895
4896 -edif <file>
4897 write the design to the specified EDIF file. writing of an output file
4898 is omitted if this parameter is not specified.
4899
4900 -json <file>
4901 write the design to the specified JSON file. writing of an output file
4902 is omitted if this parameter is not specified.
4903
4904 -run <from_label>:<to_label>
4905 only run the commands between the labels (see below). an empty
4906 from label is synonymous to 'begin', and empty to label is
4907 synonymous to the end of the command list.
4908
4909 -noflatten
4910 do not flatten design before synthesis
4911
4912 -retime
4913 run 'abc' with '-dff -D 1' options
4914
4915 -nolutram
4916 do not use EG_LOGIC_DRAM16X4 cells in output netlist
4917
4918
4919 The following commands are executed by this synthesis command:
4920
4921 begin:
4922 read_verilog -lib +/anlogic/cells_sim.v +/anlogic/eagle_bb.v
4923 hierarchy -check -top <top>
4924
4925 flatten: (unless -noflatten)
4926 proc
4927 flatten
4928 tribuf -logic
4929 deminout
4930
4931 coarse:
4932 synth -run coarse
4933
4934 map_lutram: (skip if -nolutram)
4935 memory_bram -rules +/anlogic/lutrams.txt
4936 techmap -map +/anlogic/lutrams_map.v
4937 setundef -zero -params t:EG_LOGIC_DRAM16X4
4938
4939 map_ffram:
4940 opt -fast -mux_undef -undriven -fine
4941 memory_map
4942 opt -undriven -fine
4943
4944 map_gates:
4945 techmap -map +/techmap.v -map +/anlogic/arith_map.v
4946 opt -fast
4947 abc -dff -D 1 (only if -retime)
4948
4949 map_ffs:
4950 techmap -D NO_LUT -map +/anlogic/cells_map.v
4951 dffinit -strinit SET RESET -ff AL_MAP_SEQ q REGSET -noreinit
4952 opt_expr -mux_undef
4953 simplemap
4954
4955 map_luts:
4956 abc -lut 4:6
4957 clean
4958
4959 map_cells:
4960 techmap -map +/anlogic/cells_map.v
4961 clean
4962
4963 map_anlogic:
4964 anlogic_fixcarry
4965 anlogic_eqn
4966
4967 check:
4968 hierarchy -check
4969 stat
4970 check -noinit
4971
4972 edif:
4973 write_edif <file-name>
4974
4975 json:
4976 write_json <file-name>
4977 \end{lstlisting}
4978
4979 \section{synth\_coolrunner2 -- synthesis for Xilinx Coolrunner-II CPLDs}
4980 \label{cmd:synth_coolrunner2}
4981 \begin{lstlisting}[numbers=left,frame=single]
4982 synth_coolrunner2 [options]
4983
4984 This command runs synthesis for Coolrunner-II CPLDs. This work is experimental.
4985 It is intended to be used with https://github.com/azonenberg/openfpga as the
4986 place-and-route.
4987
4988 -top <module>
4989 use the specified module as top module (default='top')
4990
4991 -json <file>
4992 write the design to the specified JSON file. writing of an output file
4993 is omitted if this parameter is not specified.
4994
4995 -run <from_label>:<to_label>
4996 only run the commands between the labels (see below). an empty
4997 from label is synonymous to 'begin', and empty to label is
4998 synonymous to the end of the command list.
4999
5000 -noflatten
5001 do not flatten design before synthesis
5002
5003 -retime
5004 run 'abc' with '-dff -D 1' options
5005
5006
5007 The following commands are executed by this synthesis command:
5008
5009 begin:
5010 read_verilog -lib +/coolrunner2/cells_sim.v
5011 hierarchy -check -top <top>
5012
5013 flatten: (unless -noflatten)
5014 proc
5015 flatten
5016 tribuf -logic
5017
5018 coarse:
5019 synth -run coarse
5020
5021 fine:
5022 extract_counter -dir up -allow_arst no
5023 techmap -map +/coolrunner2/cells_counter_map.v
5024 clean
5025 opt -fast -full
5026 techmap -map +/techmap.v -map +/coolrunner2/cells_latch.v
5027 opt -fast
5028 dfflibmap -prepare -liberty +/coolrunner2/xc2_dff.lib
5029
5030 map_tff:
5031 abc -g AND,XOR
5032 clean
5033 extract -map +/coolrunner2/tff_extract.v
5034
5035 map_pla:
5036 abc -sop -I 40 -P 56
5037 clean
5038
5039 map_cells:
5040 dfflibmap -liberty +/coolrunner2/xc2_dff.lib
5041 dffinit -ff FDCP Q INIT
5042 dffinit -ff FDCP_N Q INIT
5043 dffinit -ff FTCP Q INIT
5044 dffinit -ff FTCP_N Q INIT
5045 dffinit -ff LDCP Q INIT
5046 dffinit -ff LDCP_N Q INIT
5047 coolrunner2_sop
5048 clean
5049 iopadmap -bits -inpad IBUF O:I -outpad IOBUFE I:IO -inoutpad IOBUFE O:IO -toutpad IOBUFE E:I:IO -tinoutpad IOBUFE E:O:I:IO
5050 attrmvcp -attr src -attr LOC t:IOBUFE n:*
5051 attrmvcp -attr src -attr LOC -driven t:IBUF n:*
5052 coolrunner2_fixup
5053 splitnets
5054 clean
5055
5056 check:
5057 hierarchy -check
5058 stat
5059 check -noinit
5060
5061 json:
5062 write_json <file-name>
5063 \end{lstlisting}
5064
5065 \section{synth\_easic -- synthesis for eASIC platform}
5066 \label{cmd:synth_easic}
5067 \begin{lstlisting}[numbers=left,frame=single]
5068 synth_easic [options]
5069
5070 This command runs synthesis for eASIC platform.
5071
5072 -top <module>
5073 use the specified module as top module
5074
5075 -vlog <file>
5076 write the design to the specified structural Verilog file. writing of
5077 an output file is omitted if this parameter is not specified.
5078
5079 -etools <path>
5080 set path to the eTools installation. (default=/opt/eTools)
5081
5082 -run <from_label>:<to_label>
5083 only run the commands between the labels (see below). an empty
5084 from label is synonymous to 'begin', and empty to label is
5085 synonymous to the end of the command list.
5086
5087 -noflatten
5088 do not flatten design before synthesis
5089
5090 -retime
5091 run 'abc' with '-dff -D 1' options
5092
5093
5094 The following commands are executed by this synthesis command:
5095
5096 begin:
5097 read_liberty -lib <etools_phys_clk_lib>
5098 read_liberty -lib <etools_logic_lut_lib>
5099 hierarchy -check -top <top>
5100
5101 flatten: (unless -noflatten)
5102 proc
5103 flatten
5104
5105 coarse:
5106 synth -run coarse
5107
5108 fine:
5109 opt -fast -mux_undef -undriven -fine
5110 memory_map
5111 opt -undriven -fine
5112 techmap
5113 opt -fast
5114 abc -dff -D 1 (only if -retime)
5115 opt_clean (only if -retime)
5116
5117 map:
5118 dfflibmap -liberty <etools_phys_clk_lib>
5119 abc -liberty <etools_logic_lut_lib>
5120 opt_clean
5121
5122 check:
5123 hierarchy -check
5124 stat
5125 check -noinit
5126
5127 vlog:
5128 write_verilog -noexpr -attr2comment <file-name>
5129 \end{lstlisting}
5130
5131 \section{synth\_ecp5 -- synthesis for ECP5 FPGAs}
5132 \label{cmd:synth_ecp5}
5133 \begin{lstlisting}[numbers=left,frame=single]
5134 synth_ecp5 [options]
5135
5136 This command runs synthesis for ECP5 FPGAs.
5137
5138 -top <module>
5139 use the specified module as top module
5140
5141 -blif <file>
5142 write the design to the specified BLIF file. writing of an output file
5143 is omitted if this parameter is not specified.
5144
5145 -edif <file>
5146 write the design to the specified EDIF file. writing of an output file
5147 is omitted if this parameter is not specified.
5148
5149 -json <file>
5150 write the design to the specified JSON file. writing of an output file
5151 is omitted if this parameter is not specified.
5152
5153 -run <from_label>:<to_label>
5154 only run the commands between the labels (see below). an empty
5155 from label is synonymous to 'begin', and empty to label is
5156 synonymous to the end of the command list.
5157
5158 -noflatten
5159 do not flatten design before synthesis
5160
5161 -retime
5162 run 'abc' with '-dff -D 1' options
5163
5164 -noccu2
5165 do not use CCU2 cells in output netlist
5166
5167 -nodffe
5168 do not use flipflops with CE in output netlist
5169
5170 -nobram
5171 do not use block RAM cells in output netlist
5172
5173 -nolutram
5174 do not use LUT RAM cells in output netlist
5175
5176 -nowidelut
5177 do not use PFU muxes to implement LUTs larger than LUT4s
5178
5179 -asyncprld
5180 use async PRLD mode to implement DLATCH and DFFSR (EXPERIMENTAL)
5181
5182 -abc2
5183 run two passes of 'abc' for slightly improved logic density
5184
5185 -abc9
5186 use new ABC9 flow (EXPERIMENTAL)
5187
5188 -vpr
5189 generate an output netlist (and BLIF file) suitable for VPR
5190 (this feature is experimental and incomplete)
5191
5192 -nodsp
5193 do not map multipliers to MULT18X18D
5194
5195
5196 The following commands are executed by this synthesis command:
5197
5198 begin:
5199 read_verilog -lib -specify +/ecp5/cells_sim.v +/ecp5/cells_bb.v
5200 hierarchy -check -top <top>
5201
5202 coarse:
5203 proc
5204 flatten
5205 tribuf -logic
5206 deminout
5207 opt_expr
5208 opt_clean
5209 check
5210 opt
5211 wreduce
5212 peepopt
5213 opt_clean
5214 share
5215 techmap -map +/cmp2lut.v -D LUT_WIDTH=4
5216 opt_expr
5217 opt_clean
5218 techmap -map +/mul2dsp.v -map +/ecp5/dsp_map.v -D DSP_A_MAXWIDTH=18 -D DSP_B_MAXWIDTH=18 -D DSP_A_MINWIDTH=2 -D DSP_B_MINWIDTH=2 -D DSP_NAME=$__MUL18X18 (unless -nodsp)
5219 chtype -set $mul t:$__soft_mul (unless -nodsp)
5220 alumacc
5221 opt
5222 fsm
5223 opt -fast
5224 memory -nomap
5225 opt_clean
5226
5227 map_bram: (skip if -nobram)
5228 memory_bram -rules +/ecp5/brams.txt
5229 techmap -map +/ecp5/brams_map.v
5230
5231 map_lutram: (skip if -nolutram)
5232 memory_bram -rules +/ecp5/lutrams.txt
5233 techmap -map +/ecp5/lutrams_map.v
5234
5235 map_ffram:
5236 opt -fast -mux_undef -undriven -fine
5237 memory_map -iattr -attr !ram_block -attr !rom_block -attr logic_block -attr syn_ramstyle=auto -attr syn_ramstyle=registers -attr syn_romstyle=auto -attr syn_romstyle=logic
5238 opt -undriven -fine
5239
5240 map_gates:
5241 techmap -map +/techmap.v -map +/ecp5/arith_map.v
5242 opt -fast
5243 abc -dff -D 1 (only if -retime)
5244
5245 map_ffs:
5246 dff2dffs
5247 opt_clean
5248 dff2dffe -direct-match $_DFF_* -direct-match $__DFFS_*
5249 techmap -D NO_LUT [-D ASYNC_PRLD] -map +/ecp5/cells_map.v
5250 opt_expr -undriven -mux_undef
5251 simplemap
5252 ecp5_ffinit
5253 ecp5_gsr
5254 attrmvcp -copy -attr syn_useioff
5255 opt_clean
5256
5257 map_luts:
5258 abc (only if -abc2)
5259 techmap -map +/ecp5/latches_map.v
5260 abc -lut 4:7 -dress
5261 clean
5262
5263 map_cells:
5264 techmap -map +/ecp5/cells_map.v (with -D NO_LUT in vpr mode)
5265 opt_lut_ins -tech ecp5
5266 clean
5267
5268 check:
5269 autoname
5270 hierarchy -check
5271 stat
5272 check -noinit
5273
5274 blif:
5275 opt_clean -purge (vpr mode)
5276 write_blif -attr -cname -conn -param <file-name> (vpr mode)
5277 write_blif -gates -attr -param <file-name> (non-vpr mode)
5278
5279 edif:
5280 write_edif <file-name>
5281
5282 json:
5283 write_json <file-name>
5284 \end{lstlisting}
5285
5286 \section{synth\_efinix -- synthesis for Efinix FPGAs}
5287 \label{cmd:synth_efinix}
5288 \begin{lstlisting}[numbers=left,frame=single]
5289 synth_efinix [options]
5290
5291 This command runs synthesis for Efinix FPGAs.
5292
5293 -top <module>
5294 use the specified module as top module
5295
5296 -edif <file>
5297 write the design to the specified EDIF file. writing of an output file
5298 is omitted if this parameter is not specified.
5299
5300 -json <file>
5301 write the design to the specified JSON file. writing of an output file
5302 is omitted if this parameter is not specified.
5303
5304 -run <from_label>:<to_label>
5305 only run the commands between the labels (see below). an empty
5306 from label is synonymous to 'begin', and empty to label is
5307 synonymous to the end of the command list.
5308
5309 -noflatten
5310 do not flatten design before synthesis
5311
5312 -retime
5313 run 'abc' with '-dff -D 1' options
5314
5315 -nobram
5316 do not use EFX_RAM_5K cells in output netlist
5317
5318
5319 The following commands are executed by this synthesis command:
5320
5321 begin:
5322 read_verilog -lib +/efinix/cells_sim.v
5323 hierarchy -check -top <top>
5324
5325 flatten: (unless -noflatten)
5326 proc
5327 flatten
5328 tribuf -logic
5329 deminout
5330
5331 coarse:
5332 synth -run coarse
5333 memory_bram -rules +/efinix/brams.txt
5334 techmap -map +/efinix/brams_map.v
5335 setundef -zero -params t:EFX_RAM_5K
5336
5337 map_ffram:
5338 opt -fast -mux_undef -undriven -fine
5339 memory_map
5340 opt -undriven -fine
5341
5342 map_gates:
5343 techmap -map +/techmap.v -map +/efinix/arith_map.v
5344 opt -fast
5345 abc -dff -D 1 (only if -retime)
5346
5347 map_ffs:
5348 techmap -D NO_LUT -map +/efinix/cells_map.v
5349 dffinit -strinit SET RESET -ff AL_MAP_SEQ q REGSET -noreinit
5350 opt_expr -mux_undef
5351 simplemap
5352
5353 map_luts:
5354 abc -lut 4
5355 clean
5356
5357 map_cells:
5358 techmap -map +/efinix/cells_map.v
5359 clean
5360
5361 map_gbuf:
5362 efinix_gbuf
5363 efinix_fixcarry
5364 clean
5365
5366 check:
5367 hierarchy -check
5368 stat
5369 check -noinit
5370
5371 edif:
5372 write_edif <file-name>
5373
5374 json:
5375 write_json <file-name>
5376 \end{lstlisting}
5377
5378 \section{synth\_gowin -- synthesis for Gowin FPGAs}
5379 \label{cmd:synth_gowin}
5380 \begin{lstlisting}[numbers=left,frame=single]
5381 synth_gowin [options]
5382
5383 This command runs synthesis for Gowin FPGAs. This work is experimental.
5384
5385 -top <module>
5386 use the specified module as top module (default='top')
5387
5388 -vout <file>
5389 write the design to the specified Verilog netlist file. writing of an
5390 output file is omitted if this parameter is not specified.
5391
5392 -run <from_label>:<to_label>
5393 only run the commands between the labels (see below). an empty
5394 from label is synonymous to 'begin', and empty to label is
5395 synonymous to the end of the command list.
5396
5397 -nodffe
5398 do not use flipflops with CE in output netlist
5399
5400 -nobram
5401 do not use BRAM cells in output netlist
5402
5403 -nolutram
5404 do not use distributed RAM cells in output netlist
5405
5406 -noflatten
5407 do not flatten design before synthesis
5408
5409 -retime
5410 run 'abc' with '-dff -D 1' options
5411
5412 -nowidelut
5413 do not use muxes to implement LUTs larger than LUT4s
5414
5415 -noiopads
5416 do not emit IOB at top level ports
5417
5418
5419 The following commands are executed by this synthesis command:
5420
5421 begin:
5422 read_verilog -lib +/gowin/cells_sim.v
5423 hierarchy -check -top <top>
5424
5425 flatten: (unless -noflatten)
5426 proc
5427 flatten
5428 tribuf -logic
5429 deminout
5430
5431 coarse:
5432 synth -run coarse
5433
5434 map_bram: (skip if -nobram)
5435 memory_bram -rules +/gowin/brams.txt
5436 techmap -map +/gowin/brams_map.v
5437
5438 map_lutram: (skip if -nolutram)
5439 memory_bram -rules +/gowin/lutrams.txt
5440 techmap -map +/gowin/lutrams_map.v
5441 determine_init
5442
5443 map_ffram:
5444 opt -fast -mux_undef -undriven -fine
5445 memory_map
5446 opt -undriven -fine
5447
5448 map_gates:
5449 techmap -map +/techmap.v -map +/gowin/arith_map.v
5450 opt -fast
5451 abc -dff -D 1 (only if -retime)
5452 splitnets
5453
5454 map_ffs:
5455 dff2dffs -match-init
5456 opt_clean
5457 dff2dffe -direct-match $_DFF_* -direct-match $__DFFS_*
5458 techmap -map +/gowin/cells_map.v
5459 opt_expr -mux_undef
5460 simplemap
5461
5462 map_luts:
5463 abc -lut 4:8
5464 clean
5465
5466 map_cells:
5467 techmap -map +/gowin/cells_map.v
5468 opt_lut_ins -tech gowin
5469 setundef -undriven -params -zero
5470 hilomap -singleton -hicell VCC V -locell GND G
5471 iopadmap -bits -inpad IBUF O:I -outpad OBUF I:O -toutpad TBUF OEN:I:O -tinoutpad IOBUF OEN:O:I:IO (unless -noiopads)
5472 clean
5473
5474 check:
5475 hierarchy -check
5476 stat
5477 check -noinit
5478
5479 vout:
5480 write_verilog -decimal -attr2comment -defparam -renameprefix gen <file-name>
5481 \end{lstlisting}
5482
5483 \section{synth\_greenpak4 -- synthesis for GreenPAK4 FPGAs}
5484 \label{cmd:synth_greenpak4}
5485 \begin{lstlisting}[numbers=left,frame=single]
5486 synth_greenpak4 [options]
5487
5488 This command runs synthesis for GreenPAK4 FPGAs. This work is experimental.
5489 It is intended to be used with https://github.com/azonenberg/openfpga as the
5490 place-and-route.
5491
5492 -top <module>
5493 use the specified module as top module (default='top')
5494
5495 -part <part>
5496 synthesize for the specified part. Valid values are SLG46140V,
5497 SLG46620V, and SLG46621V (default).
5498
5499 -json <file>
5500 write the design to the specified JSON file. writing of an output file
5501 is omitted if this parameter is not specified.
5502
5503 -run <from_label>:<to_label>
5504 only run the commands between the labels (see below). an empty
5505 from label is synonymous to 'begin', and empty to label is
5506 synonymous to the end of the command list.
5507
5508 -noflatten
5509 do not flatten design before synthesis
5510
5511 -retime
5512 run 'abc' with '-dff -D 1' options
5513
5514
5515 The following commands are executed by this synthesis command:
5516
5517 begin:
5518 read_verilog -lib +/greenpak4/cells_sim.v
5519 hierarchy -check -top <top>
5520
5521 flatten: (unless -noflatten)
5522 proc
5523 flatten
5524 tribuf -logic
5525
5526 coarse:
5527 synth -run coarse
5528
5529 fine:
5530 extract_counter -pout GP_DCMP,GP_DAC -maxwidth 14
5531 clean
5532 opt -fast -mux_undef -undriven -fine
5533 memory_map
5534 opt -undriven -fine
5535 techmap -map +/techmap.v -map +/greenpak4/cells_latch.v
5536 dfflibmap -prepare -liberty +/greenpak4/gp_dff.lib
5537 opt -fast
5538 abc -dff -D 1 (only if -retime)
5539
5540 map_luts:
5541 nlutmap -assert -luts 0,6,8,2 (for -part SLG46140V)
5542 nlutmap -assert -luts 2,8,16,2 (for -part SLG46620V)
5543 nlutmap -assert -luts 2,8,16,2 (for -part SLG46621V)
5544 clean
5545
5546 map_cells:
5547 shregmap -tech greenpak4
5548 dfflibmap -liberty +/greenpak4/gp_dff.lib
5549 dffinit -ff GP_DFF Q INIT
5550 dffinit -ff GP_DFFR Q INIT
5551 dffinit -ff GP_DFFS Q INIT
5552 dffinit -ff GP_DFFSR Q INIT
5553 iopadmap -bits -inpad GP_IBUF OUT:IN -outpad GP_OBUF IN:OUT -inoutpad GP_OBUF OUT:IN -toutpad GP_OBUFT OE:IN:OUT -tinoutpad GP_IOBUF OE:OUT:IN:IO
5554 attrmvcp -attr src -attr LOC t:GP_OBUF t:GP_OBUFT t:GP_IOBUF n:*
5555 attrmvcp -attr src -attr LOC -driven t:GP_IBUF n:*
5556 techmap -map +/greenpak4/cells_map.v
5557 greenpak4_dffinv
5558 clean
5559
5560 check:
5561 hierarchy -check
5562 stat
5563 check -noinit
5564
5565 json:
5566 write_json <file-name>
5567 \end{lstlisting}
5568
5569 \section{synth\_ice40 -- synthesis for iCE40 FPGAs}
5570 \label{cmd:synth_ice40}
5571 \begin{lstlisting}[numbers=left,frame=single]
5572 synth_ice40 [options]
5573
5574 This command runs synthesis for iCE40 FPGAs.
5575
5576 -device < hx | lp | u >
5577 relevant only for '-abc9' flow, optimise timing for the specified device.
5578 default: hx
5579
5580 -top <module>
5581 use the specified module as top module
5582
5583 -blif <file>
5584 write the design to the specified BLIF file. writing of an output file
5585 is omitted if this parameter is not specified.
5586
5587 -edif <file>
5588 write the design to the specified EDIF file. writing of an output file
5589 is omitted if this parameter is not specified.
5590
5591 -json <file>
5592 write the design to the specified JSON file. writing of an output file
5593 is omitted if this parameter is not specified.
5594
5595 -run <from_label>:<to_label>
5596 only run the commands between the labels (see below). an empty
5597 from label is synonymous to 'begin', and empty to label is
5598 synonymous to the end of the command list.
5599
5600 -noflatten
5601 do not flatten design before synthesis
5602
5603 -retime
5604 run 'abc' with '-dff -D 1' options
5605
5606 -nocarry
5607 do not use SB_CARRY cells in output netlist
5608
5609 -nodffe
5610 do not use SB_DFFE* cells in output netlist
5611
5612 -dffe_min_ce_use <min_ce_use>
5613 do not use SB_DFFE* cells if the resulting CE line would go to less
5614 than min_ce_use SB_DFFE* in output netlist
5615
5616 -nobram
5617 do not use SB_RAM40_4K* cells in output netlist
5618
5619 -dsp
5620 use iCE40 UltraPlus DSP cells for large arithmetic
5621
5622 -noabc
5623 use built-in Yosys LUT techmapping instead of abc
5624
5625 -abc2
5626 run two passes of 'abc' for slightly improved logic density
5627
5628 -vpr
5629 generate an output netlist (and BLIF file) suitable for VPR
5630 (this feature is experimental and incomplete)
5631
5632 -abc9
5633 use new ABC9 flow (EXPERIMENTAL)
5634
5635 -flowmap
5636 use FlowMap LUT techmapping instead of abc (EXPERIMENTAL)
5637
5638
5639 The following commands are executed by this synthesis command:
5640
5641 begin:
5642 read_verilog -D ICE40_HX -lib -specify +/ice40/cells_sim.v
5643 hierarchy -check -top <top>
5644 proc
5645
5646 flatten: (unless -noflatten)
5647 flatten
5648 tribuf -logic
5649 deminout
5650
5651 coarse:
5652 opt_expr
5653 opt_clean
5654 check
5655 opt
5656 wreduce
5657 peepopt
5658 opt_clean
5659 share
5660 techmap -map +/cmp2lut.v -D LUT_WIDTH=4
5661 opt_expr
5662 opt_clean
5663 memory_dff
5664 wreduce t:$mul
5665 techmap -map +/mul2dsp.v -map +/ice40/dsp_map.v -D DSP_A_MAXWIDTH=16 -D DSP_B_MAXWIDTH=16 -D DSP_A_MINWIDTH=2 -D DSP_B_MINWIDTH=2 -D DSP_Y_MINWIDTH=11 -D DSP_NAME=$__MUL16X16 (if -dsp)
5666 select a:mul2dsp (if -dsp)
5667 setattr -unset mul2dsp (if -dsp)
5668 opt_expr -fine (if -dsp)
5669 wreduce (if -dsp)
5670 select -clear (if -dsp)
5671 ice40_dsp (if -dsp)
5672 chtype -set $mul t:$__soft_mul (if -dsp)
5673 alumacc
5674 opt
5675 fsm
5676 opt -fast
5677 memory -nomap
5678 opt_clean
5679
5680 map_bram: (skip if -nobram)
5681 memory_bram -rules +/ice40/brams.txt
5682 techmap -map +/ice40/brams_map.v
5683 ice40_braminit
5684
5685 map_ffram:
5686 opt -fast -mux_undef -undriven -fine
5687 memory_map -iattr -attr !ram_block -attr !rom_block -attr logic_block -attr syn_ramstyle=auto -attr syn_ramstyle=registers -attr syn_romstyle=auto -attr syn_romstyle=logic
5688 opt -undriven -fine
5689
5690 map_gates:
5691 ice40_wrapcarry
5692 techmap -map +/techmap.v -map +/ice40/arith_map.v
5693 opt -fast
5694 abc -dff -D 1 (only if -retime)
5695 ice40_opt
5696
5697 map_ffs:
5698 dff2dffe -direct-match $_DFF_*
5699 techmap -D NO_LUT -D NO_ADDER -map +/ice40/cells_map.v
5700 opt_expr -mux_undef
5701 simplemap
5702 ice40_ffinit
5703 ice40_ffssr
5704 ice40_opt -full
5705
5706 map_luts:
5707 abc (only if -abc2)
5708 ice40_opt (only if -abc2)
5709 techmap -map +/ice40/latches_map.v
5710 simplemap (if -noabc or -flowmap)
5711 techmap -map +/gate2lut.v -D LUT_WIDTH=4 (only if -noabc)
5712 flowmap -maxlut 4 (only if -flowmap)
5713 abc -dress -lut 4 (skip if -noabc)
5714 ice40_wrapcarry -unwrap
5715 techmap -D NO_LUT -map +/ice40/cells_map.v
5716 clean
5717 opt_lut -dlogic SB_CARRY:I0=2:I1=1:CI=0
5718
5719 map_cells:
5720 techmap -map +/ice40/cells_map.v (with -D NO_LUT in vpr mode)
5721 clean
5722
5723 check:
5724 autoname
5725 hierarchy -check
5726 stat
5727 check -noinit
5728
5729 blif:
5730 opt_clean -purge (vpr mode)
5731 write_blif -attr -cname -conn -param <file-name> (vpr mode)
5732 write_blif -gates -attr -param <file-name> (non-vpr mode)
5733
5734 edif:
5735 write_edif <file-name>
5736
5737 json:
5738 write_json <file-name>
5739 \end{lstlisting}
5740
5741 \section{synth\_intel -- synthesis for Intel (Altera) FPGAs.}
5742 \label{cmd:synth_intel}
5743 \begin{lstlisting}[numbers=left,frame=single]
5744 synth_intel [options]
5745
5746 This command runs synthesis for Intel FPGAs.
5747
5748 -family <max10 | arria10gx | cyclone10lp | cyclonev | cycloneiv | cycloneive>
5749 generate the synthesis netlist for the specified family.
5750 MAX10 is the default target if no family argument specified.
5751 For Cyclone IV GX devices, use cycloneiv argument; for Cyclone IV E, use cycloneive.
5752 Cyclone V and Arria 10 GX devices are experimental.
5753
5754 -top <module>
5755 use the specified module as top module (default='top')
5756
5757 -vqm <file>
5758 write the design to the specified Verilog Quartus Mapping File. Writing of an
5759 output file is omitted if this parameter is not specified.
5760 Note that this backend has not been tested and is likely incompatible
5761 with recent versions of Quartus.
5762
5763 -vpr <file>
5764 write BLIF files for VPR flow experiments. The synthesized BLIF output file is not
5765 compatible with the Quartus flow. Writing of an
5766 output file is omitted if this parameter is not specified.
5767
5768 -run <from_label>:<to_label>
5769 only run the commands between the labels (see below). an empty
5770 from label is synonymous to 'begin', and empty to label is
5771 synonymous to the end of the command list.
5772
5773 -iopads
5774 use IO pad cells in output netlist
5775
5776 -nobram
5777 do not use block RAM cells in output netlist
5778
5779 -noflatten
5780 do not flatten design before synthesis
5781
5782 -retime
5783 run 'abc' with '-dff -D 1' options
5784
5785 The following commands are executed by this synthesis command:
5786
5787 begin:
5788
5789 family:
5790 read_verilog -sv -lib +/intel/max10/cells_sim.v
5791 read_verilog -sv -lib +/intel/common/m9k_bb.v
5792 read_verilog -sv -lib +/intel/common/altpll_bb.v
5793 hierarchy -check -top <top>
5794
5795 flatten: (unless -noflatten)
5796 proc
5797 flatten
5798 tribuf -logic
5799 deminout
5800
5801 coarse:
5802 synth -run coarse
5803
5804 map_bram: (skip if -nobram)
5805 memory_bram -rules +/intel/common/brams_m9k.txt (if applicable for family)
5806 techmap -map +/intel/common/brams_map_m9k.v (if applicable for family)
5807
5808 map_ffram:
5809 opt -fast -mux_undef -undriven -fine -full
5810 memory_map
5811 opt -undriven -fine
5812 dff2dffe -direct-match $_DFF_*
5813 opt -fine
5814 techmap -map +/techmap.v
5815 opt -full
5816 clean -purge
5817 setundef -undriven -zero
5818 abc -markgroups -dff -D 1 (only if -retime)
5819
5820 map_luts:
5821 abc -lut 4
5822 clean
5823
5824 map_cells:
5825 iopadmap -bits -outpad $__outpad I:O -inpad $__inpad O:I (if -iopads)
5826 techmap -map +/intel/max10/cells_map.v
5827 dffinit -highlow -ff dffeas q power_up
5828 clean -purge
5829
5830 check:
5831 hierarchy -check
5832 stat
5833 check -noinit
5834
5835 vqm:
5836 write_verilog -attr2comment -defparam -nohex -decimal -renameprefix syn_ <file-name>
5837
5838 vpr:
5839 opt_clean -purge
5840 write_blif <file-name>
5841
5842
5843 WARNING: THE 'synth_intel' COMMAND IS EXPERIMENTAL.
5844 \end{lstlisting}
5845
5846 \section{synth\_sf2 -- synthesis for SmartFusion2 and IGLOO2 FPGAs}
5847 \label{cmd:synth_sf2}
5848 \begin{lstlisting}[numbers=left,frame=single]
5849 synth_sf2 [options]
5850
5851 This command runs synthesis for SmartFusion2 and IGLOO2 FPGAs.
5852
5853 -top <module>
5854 use the specified module as top module
5855
5856 -edif <file>
5857 write the design to the specified EDIF file. writing of an output file
5858 is omitted if this parameter is not specified.
5859
5860 -vlog <file>
5861 write the design to the specified Verilog file. writing of an output file
5862 is omitted if this parameter is not specified.
5863
5864 -json <file>
5865 write the design to the specified JSON file. writing of an output file
5866 is omitted if this parameter is not specified.
5867
5868 -run <from_label>:<to_label>
5869 only run the commands between the labels (see below). an empty
5870 from label is synonymous to 'begin', and empty to label is
5871 synonymous to the end of the command list.
5872
5873 -noflatten
5874 do not flatten design before synthesis
5875
5876 -noiobs
5877 run synthesis in "block mode", i.e. do not insert IO buffers
5878
5879 -clkbuf
5880 insert direct PAD->global_net buffers
5881
5882 -retime
5883 run 'abc' with '-dff -D 1' options
5884
5885
5886 The following commands are executed by this synthesis command:
5887
5888 begin:
5889 read_verilog -lib +/sf2/cells_sim.v
5890 hierarchy -check -top <top>
5891
5892 flatten: (unless -noflatten)
5893 proc
5894 flatten
5895 tribuf -logic
5896 deminout
5897
5898 coarse:
5899 synth -run coarse
5900
5901 fine:
5902 opt -fast -mux_undef -undriven -fine
5903 memory_map
5904 opt -undriven -fine
5905 techmap -map +/techmap.v -map +/sf2/arith_map.v
5906 opt -fast
5907 abc -dff -D 1 (only if -retime)
5908
5909 map_ffs:
5910 techmap -D NO_LUT -map +/sf2/cells_map.v
5911 opt_expr -mux_undef
5912 simplemap
5913
5914 map_luts:
5915 abc -lut 4
5916 clean
5917
5918 map_cells:
5919 techmap -map +/sf2/cells_map.v
5920 clean
5921
5922 map_iobs:
5923 sf2_iobs [-clkbuf] (unless -noiobs)
5924 clean
5925
5926 check:
5927 hierarchy -check
5928 stat
5929 check -noinit
5930
5931 edif:
5932 write_edif -gndvccy <file-name>
5933
5934 vlog:
5935 write_verilog <file-name>
5936
5937 json:
5938 write_json <file-name>
5939 \end{lstlisting}
5940
5941 \section{synth\_xilinx -- synthesis for Xilinx FPGAs}
5942 \label{cmd:synth_xilinx}
5943 \begin{lstlisting}[numbers=left,frame=single]
5944 synth_xilinx [options]
5945
5946 This command runs synthesis for Xilinx FPGAs. This command does not operate on
5947 partly selected designs. At the moment this command creates netlists that are
5948 compatible with 7-Series Xilinx devices.
5949
5950 -top <module>
5951 use the specified module as top module
5952
5953 -family <family>
5954 run synthesis for the specified Xilinx architecture
5955 generate the synthesis netlist for the specified family.
5956 supported values:
5957 - xcup: Ultrascale Plus
5958 - xcu: Ultrascale
5959 - xc7: Series 7 (default)
5960 - xc6s: Spartan 6
5961 - xc6v: Virtex 6
5962 - xc5v: Virtex 5 (EXPERIMENTAL)
5963 - xc4v: Virtex 4 (EXPERIMENTAL)
5964 - xc3sda: Spartan 3A DSP (EXPERIMENTAL)
5965 - xc3sa: Spartan 3A (EXPERIMENTAL)
5966 - xc3se: Spartan 3E (EXPERIMENTAL)
5967 - xc3s: Spartan 3 (EXPERIMENTAL)
5968 - xc2vp: Virtex 2 Pro (EXPERIMENTAL)
5969 - xc2v: Virtex 2 (EXPERIMENTAL)
5970 - xcve: Virtex E, Spartan 2E (EXPERIMENTAL)
5971 - xcv: Virtex, Spartan 2 (EXPERIMENTAL)
5972
5973 -edif <file>
5974 write the design to the specified edif file. writing of an output file
5975 is omitted if this parameter is not specified.
5976
5977 -blif <file>
5978 write the design to the specified BLIF file. writing of an output file
5979 is omitted if this parameter is not specified.
5980
5981 -vpr
5982 generate an output netlist (and BLIF file) suitable for VPR
5983 (this feature is experimental and incomplete)
5984
5985 -ise
5986 generate an output netlist suitable for ISE
5987
5988 -nobram
5989 do not use block RAM cells in output netlist
5990
5991 -nolutram
5992 do not use distributed RAM cells in output netlist
5993
5994 -nosrl
5995 do not use distributed SRL cells in output netlist
5996
5997 -nocarry
5998 do not use XORCY/MUXCY/CARRY4 cells in output netlist
5999
6000 -nowidelut
6001 do not use MUXF[5-9] resources to implement LUTs larger than native for the target
6002
6003 -nodsp
6004 do not use DSP48*s to implement multipliers and associated logic
6005
6006 -noiopad
6007 disable I/O buffer insertion (useful for hierarchical or
6008 out-of-context flows)
6009
6010 -noclkbuf
6011 disable automatic clock buffer insertion
6012
6013 -uram
6014 infer URAM288s for large memories (xcup only)
6015
6016 -widemux <int>
6017 enable inference of hard multiplexer resources (MUXF[78]) for muxes at or
6018 above this number of inputs (minimum value 2, recommended value >= 5).
6019 default: 0 (no inference)
6020
6021 -run <from_label>:<to_label>
6022 only run the commands between the labels (see below). an empty
6023 from label is synonymous to 'begin', and empty to label is
6024 synonymous to the end of the command list.
6025
6026 -flatten
6027 flatten design before synthesis
6028
6029 -dff
6030 run 'abc'/'abc9' with -dff option
6031
6032 -retime
6033 run 'abc' with '-D 1' option to enable flip-flop retiming.
6034 implies -dff.
6035
6036 -abc9
6037 use new ABC9 flow (EXPERIMENTAL)
6038
6039
6040 The following commands are executed by this synthesis command:
6041
6042 begin:
6043 read_verilog -lib -specify +/xilinx/cells_sim.v
6044 read_verilog -lib +/xilinx/cells_xtra.v
6045 hierarchy -check -auto-top
6046
6047 prepare:
6048 proc
6049 flatten (with '-flatten')
6050 tribuf -logic
6051 deminout
6052 opt_expr
6053 opt_clean
6054 check
6055 opt
6056 wreduce [-keepdc] (option for '-widemux')
6057 peepopt
6058 opt_clean
6059 muxpack ('-widemux' only)
6060 pmux2shiftx (skip if '-nosrl' and '-widemux=0')
6061 clean (skip if '-nosrl' and '-widemux=0')
6062
6063 map_dsp: (skip if '-nodsp')
6064 memory_dff
6065 techmap -map +/mul2dsp.v -map +/xilinx/{family}_dsp_map.v {options}
6066 select a:mul2dsp
6067 setattr -unset mul2dsp
6068 opt_expr -fine
6069 wreduce
6070 select -clear
6071 xilinx_dsp -family <family>
6072 chtype -set $mul t:$__soft_mul
6073
6074 coarse:
6075 techmap -map +/cmp2lut.v -map +/cmp2lcu.v -D LUT_WIDTH=[46]
6076 alumacc
6077 share
6078 opt
6079 fsm
6080 opt -fast
6081 memory -nomap
6082 opt_clean
6083
6084 map_uram: (only if '-uram')
6085 memory_bram -rules +/xilinx/{family}_urams.txt
6086 techmap -map +/xilinx/{family}_urams_map.v
6087
6088 map_bram: (skip if '-nobram')
6089 memory_bram -rules +/xilinx/{family}_brams.txt
6090 techmap -map +/xilinx/{family}_brams_map.v
6091
6092 map_lutram: (skip if '-nolutram')
6093 memory_bram -rules +/xilinx/lut[46]_lutrams.txt
6094 techmap -map +/xilinx/lutrams_map.v
6095
6096 map_ffram:
6097 simplemap t:$dff t:$adff t:$mux
6098 dff2dffs [-match-init] (-match-init for xc6s only)
6099 opt -fast -full
6100 memory_map
6101
6102 fine:
6103 dff2dffe -direct-match $_DFF_* -direct-match $__DFFS_*
6104 muxcover <internal options> ('-widemux' only)
6105 opt -full
6106 xilinx_srl -variable -minlen 3 (skip if '-nosrl')
6107 techmap -map +/techmap.v -D LUT_SIZE=[46] [-map +/xilinx/mux_map.v] -map +/xilinx/arith_map.v
6108 opt -fast
6109
6110 map_cells:
6111 iopadmap -bits -outpad OBUF I:O -inpad IBUF O:I -toutpad $__XILINX_TOUTPAD OE:I:O -tinoutpad $__XILINX_TINOUTPAD OE:O:I:IO A:top (skip if '-noiopad')
6112 techmap -map +/techmap.v -map +/xilinx/cells_map.v
6113 clean
6114
6115 map_ffs:
6116 techmap -map +/xilinx/{family}_ff_map.v ('-abc9' only)
6117
6118 map_luts:
6119 opt_expr -mux_undef
6120 abc -luts 2:2,3,6:5[,10,20] [-dff] [-D 1] (option for 'nowidelut', '-dff', '-retime')
6121 clean
6122 xilinx_srl -fixed -minlen 3 (skip if '-nosrl')
6123 techmap -map +/xilinx/lut_map.v -map +/xilinx/cells_map.v -map +/xilinx/{family}_ff_map.v -D LUT_WIDTH=[46]
6124 xilinx_dffopt [-lut4]
6125 opt_lut_ins -tech xilinx
6126
6127 finalize:
6128 clkbufmap -buf BUFG O:I (skip if '-noclkbuf')
6129 extractinv -inv INV O:I (only if '-ise')
6130 clean
6131
6132 check:
6133 hierarchy -check
6134 stat -tech xilinx
6135 check -noinit
6136
6137 edif:
6138 write_edif -pvector bra
6139
6140 blif:
6141 write_blif
6142 \end{lstlisting}
6143
6144 \section{tcl -- execute a TCL script file}
6145 \label{cmd:tcl}
6146 \begin{lstlisting}[numbers=left,frame=single]
6147 tcl <filename> [args]
6148
6149 This command executes the tcl commands in the specified file.
6150 Use 'yosys cmd' to run the yosys command 'cmd' from tcl.
6151
6152 The tcl command 'yosys -import' can be used to import all yosys
6153 commands directly as tcl commands to the tcl shell. Yosys commands
6154 'proc' and 'rename' are wrapped to tcl commands 'procs' and 'renames'
6155 in order to avoid a name collision with the built in commands.
6156
6157 If any arguments are specified, these arguments are provided to the script via
6158 the standard $argc and $argv variables.
6159 \end{lstlisting}
6160
6161 \section{techmap -- generic technology mapper}
6162 \label{cmd:techmap}
6163 \begin{lstlisting}[numbers=left,frame=single]
6164 techmap [-map filename] [selection]
6165
6166 This pass implements a very simple technology mapper that replaces cells in
6167 the design with implementations given in form of a Verilog or ilang source
6168 file.
6169
6170 -map filename
6171 the library of cell implementations to be used.
6172 without this parameter a builtin library is used that
6173 transforms the internal RTL cells to the internal gate
6174 library.
6175
6176 -map %<design-name>
6177 like -map above, but with an in-memory design instead of a file.
6178
6179 -extern
6180 load the cell implementations as separate modules into the design
6181 instead of inlining them.
6182
6183 -max_iter <number>
6184 only run the specified number of iterations on each module.
6185 default: unlimited
6186
6187 -recursive
6188 instead of the iterative breadth-first algorithm use a recursive
6189 depth-first algorithm. both methods should yield equivalent results,
6190 but may differ in performance.
6191
6192 -autoproc
6193 Automatically call "proc" on implementations that contain processes.
6194
6195 -wb
6196 Ignore the 'whitebox' attribute on cell implementations.
6197
6198 -assert
6199 this option will cause techmap to exit with an error if it can't map
6200 a selected cell. only cell types that end on an underscore are accepted
6201 as final cell types by this mode.
6202
6203 -D <define>, -I <incdir>
6204 this options are passed as-is to the Verilog frontend for loading the
6205 map file. Note that the Verilog frontend is also called with the
6206 '-nooverwrite' option set.
6207
6208 When a module in the map file has the 'techmap_celltype' attribute set, it will
6209 match cells with a type that match the text value of this attribute. Otherwise
6210 the module name will be used to match the cell.
6211
6212 When a module in the map file has the 'techmap_simplemap' attribute set, techmap
6213 will use 'simplemap' (see 'help simplemap') to map cells matching the module.
6214
6215 When a module in the map file has the 'techmap_maccmap' attribute set, techmap
6216 will use 'maccmap' (see 'help maccmap') to map cells matching the module.
6217
6218 When a module in the map file has the 'techmap_wrap' attribute set, techmap
6219 will create a wrapper for the cell and then run the command string that the
6220 attribute is set to on the wrapper module.
6221
6222 When a port on a module in the map file has the 'techmap_autopurge' attribute
6223 set, and that port is not connected in the instantiation that is mapped, then
6224 then a cell port connected only to such wires will be omitted in the mapped
6225 version of the circuit.
6226
6227 All wires in the modules from the map file matching the pattern _TECHMAP_*
6228 or *._TECHMAP_* are special wires that are used to pass instructions from
6229 the mapping module to the techmap command. At the moment the following special
6230 wires are supported:
6231
6232 _TECHMAP_FAIL_
6233 When this wire is set to a non-zero constant value, techmap will not
6234 use this module and instead try the next module with a matching
6235 'techmap_celltype' attribute.
6236
6237 When such a wire exists but does not have a constant value after all
6238 _TECHMAP_DO_* commands have been executed, an error is generated.
6239
6240 _TECHMAP_DO_*
6241 This wires are evaluated in alphabetical order. The constant text value
6242 of this wire is a yosys command (or sequence of commands) that is run
6243 by techmap on the module. A common use case is to run 'proc' on modules
6244 that are written using always-statements.
6245
6246 When such a wire has a non-constant value at the time it is to be
6247 evaluated, an error is produced. That means it is possible for such a
6248 wire to start out as non-constant and evaluate to a constant value
6249 during processing of other _TECHMAP_DO_* commands.
6250
6251 A _TECHMAP_DO_* command may start with the special token 'CONSTMAP; '.
6252 in this case techmap will create a copy for each distinct configuration
6253 of constant inputs and shorted inputs at this point and import the
6254 constant and connected bits into the map module. All further commands
6255 are executed in this copy. This is a very convenient way of creating
6256 optimized specializations of techmap modules without using the special
6257 parameters described below.
6258
6259 A _TECHMAP_DO_* command may start with the special token 'RECURSION; '.
6260 then techmap will recursively replace the cells in the module with their
6261 implementation. This is not affected by the -max_iter option.
6262
6263 It is possible to combine both prefixes to 'RECURSION; CONSTMAP; '.
6264
6265 _TECHMAP_REMOVEINIT_<port-name>_
6266 When this wire is set to a constant value, the init attribute of the wire(s)
6267 connected to this port will be consumed. This wire must have the same
6268 width as the given port, and for every bit that is set to 1 in the value,
6269 the corresponding init attribute bit will be changed to 1'bx. If all
6270 bits of an init attribute are left as x, it will be removed.
6271
6272 In addition to this special wires, techmap also supports special parameters in
6273 modules in the map file:
6274
6275 _TECHMAP_CELLTYPE_
6276 When a parameter with this name exists, it will be set to the type name
6277 of the cell that matches the module.
6278
6279 _TECHMAP_CONSTMSK_<port-name>_
6280 _TECHMAP_CONSTVAL_<port-name>_
6281 When this pair of parameters is available in a module for a port, then
6282 former has a 1-bit for each constant input bit and the latter has the
6283 value for this bit. The unused bits of the latter are set to undef (x).
6284
6285 _TECHMAP_WIREINIT_<port-name>_
6286 When a parameter with this name exists, it will be set to the initial
6287 value of the wire(s) connected to the given port, as specified by the init
6288 attribute. If the attribute doesn't exist, x will be filled for the
6289 missing bits. To remove the init attribute bits used, use the
6290 _TECHMAP_REMOVEINIT_*_ wires.
6291
6292 _TECHMAP_BITS_CONNMAP_
6293 _TECHMAP_CONNMAP_<port-name>_
6294 For an N-bit port, the _TECHMAP_CONNMAP_<port-name>_ parameter, if it
6295 exists, will be set to an N*_TECHMAP_BITS_CONNMAP_ bit vector containing
6296 N words (of _TECHMAP_BITS_CONNMAP_ bits each) that assign each single
6297 bit driver a unique id. The values 0-3 are reserved for 0, 1, x, and z.
6298 This can be used to detect shorted inputs.
6299
6300 When a module in the map file has a parameter where the according cell in the
6301 design has a port, the module from the map file is only used if the port in
6302 the design is connected to a constant value. The parameter is then set to the
6303 constant value.
6304
6305 A cell with the name _TECHMAP_REPLACE_ in the map file will inherit the name
6306 and attributes of the cell that is being replaced.
6307 A cell with a name of the form `_TECHMAP_REPLACE_.<suffix>` in the map file will
6308 be named thus but with the `_TECHMAP_REPLACE_' prefix substituted with the name
6309 of the cell being replaced.
6310 Similarly, a wire named in the form `_TECHMAP_REPLACE_.<suffix>` will cause a
6311 new wire alias to be created and named as above but with the `_TECHMAP_REPLACE_'
6312 prefix also substituted.
6313
6314 See 'help extract' for a pass that does the opposite thing.
6315
6316 See 'help flatten' for a pass that does flatten the design (which is
6317 essentially techmap but using the design itself as map library).
6318 \end{lstlisting}
6319
6320 \section{tee -- redirect command output to file}
6321 \label{cmd:tee}
6322 \begin{lstlisting}[numbers=left,frame=single]
6323 tee [-q] [-o logfile|-a logfile] cmd
6324
6325 Execute the specified command, optionally writing the commands output to the
6326 specified logfile(s).
6327
6328 -q
6329 Do not print output to the normal destination (console and/or log file).
6330
6331 -o logfile
6332 Write output to this file, truncate if exists.
6333
6334 -a logfile
6335 Write output to this file, append if exists.
6336
6337 +INT, -INT
6338 Add/subtract INT from the -v setting for this command.
6339 \end{lstlisting}
6340
6341 \section{test\_abcloop -- automatically test handling of loops in abc command}
6342 \label{cmd:test_abcloop}
6343 \begin{lstlisting}[numbers=left,frame=single]
6344 test_abcloop [options]
6345
6346 Test handling of logic loops in ABC.
6347
6348 -n {integer}
6349 create this number of circuits and test them (default = 100).
6350
6351 -s {positive_integer}
6352 use this value as rng seed value (default = unix time).
6353 \end{lstlisting}
6354
6355 \section{test\_autotb -- generate simple test benches}
6356 \label{cmd:test_autotb}
6357 \begin{lstlisting}[numbers=left,frame=single]
6358 test_autotb [options] [filename]
6359
6360 Automatically create primitive Verilog test benches for all modules in the
6361 design. The generated testbenches toggle the input pins of the module in
6362 a semi-random manner and dumps the resulting output signals.
6363
6364 This can be used to check the synthesis results for simple circuits by
6365 comparing the testbench output for the input files and the synthesis results.
6366
6367 The backend automatically detects clock signals. Additionally a signal can
6368 be forced to be interpreted as clock signal by setting the attribute
6369 'gentb_clock' on the signal.
6370
6371 The attribute 'gentb_constant' can be used to force a signal to a constant
6372 value after initialization. This can e.g. be used to force a reset signal
6373 low in order to explore more inner states in a state machine.
6374
6375 The attribute 'gentb_skip' can be attached to modules to suppress testbench
6376 generation.
6377
6378 -n <int>
6379 number of iterations the test bench should run (default = 1000)
6380
6381 -seed <int>
6382 seed used for pseudo-random number generation (default = 0).
6383 a value of 0 will cause an arbitrary seed to be chosen, based on
6384 the current system time.
6385 \end{lstlisting}
6386
6387 \section{test\_cell -- automatically test the implementation of a cell type}
6388 \label{cmd:test_cell}
6389 \begin{lstlisting}[numbers=left,frame=single]
6390 test_cell [options] {cell-types}
6391
6392 Tests the internal implementation of the given cell type (for example '$add')
6393 by comparing SAT solver, EVAL and TECHMAP implementations of the cell types..
6394
6395 Run with 'all' instead of a cell type to run the test on all supported
6396 cell types. Use for example 'all /$add' for all cell types except $add.
6397
6398 -n {integer}
6399 create this number of cell instances and test them (default = 100).
6400
6401 -s {positive_integer}
6402 use this value as rng seed value (default = unix time).
6403
6404 -f {ilang_file}
6405 don't generate circuits. instead load the specified ilang file.
6406
6407 -w {filename_prefix}
6408 don't test anything. just generate the circuits and write them
6409 to ilang files with the specified prefix
6410
6411 -map {filename}
6412 pass this option to techmap.
6413
6414 -simlib
6415 use "techmap -D SIMLIB_NOCHECKS -map +/simlib.v -max_iter 2 -autoproc"
6416
6417 -aigmap
6418 instead of calling "techmap", call "aigmap"
6419
6420 -muxdiv
6421 when creating test benches with dividers, create an additional mux
6422 to mask out the division-by-zero case
6423
6424 -script {script_file}
6425 instead of calling "techmap", call "script {script_file}".
6426
6427 -const
6428 set some input bits to random constant values
6429
6430 -nosat
6431 do not check SAT model or run SAT equivalence checking
6432
6433 -noeval
6434 do not check const-eval models
6435
6436 -edges
6437 test cell edges db creator against sat-based implementation
6438
6439 -v
6440 print additional debug information to the console
6441
6442 -vlog {filename}
6443 create a Verilog test bench to test simlib and write_verilog
6444 \end{lstlisting}
6445
6446 \section{test\_pmgen -- test pass for pmgen}
6447 \label{cmd:test_pmgen}
6448 \begin{lstlisting}[numbers=left,frame=single]
6449 test_pmgen -reduce_chain [options] [selection]
6450
6451 Demo for recursive pmgen patterns. Map chains of AND/OR/XOR to $reduce_*.
6452
6453
6454 test_pmgen -reduce_tree [options] [selection]
6455
6456 Demo for recursive pmgen patterns. Map trees of AND/OR/XOR to $reduce_*.
6457
6458
6459 test_pmgen -eqpmux [options] [selection]
6460
6461 Demo for recursive pmgen patterns. Optimize EQ/NE/PMUX circuits.
6462
6463
6464 test_pmgen -generate [options] <pattern_name>
6465
6466 Create modules that match the specified pattern.
6467 \end{lstlisting}
6468
6469 \section{torder -- print cells in topological order}
6470 \label{cmd:torder}
6471 \begin{lstlisting}[numbers=left,frame=single]
6472 torder [options] [selection]
6473
6474 This command prints the selected cells in topological order.
6475
6476 -stop <cell_type> <cell_port>
6477 do not use the specified cell port in topological sorting
6478
6479 -noautostop
6480 by default Q outputs of internal FF cells and memory read port outputs
6481 are not used in topological sorting. this option deactivates that.
6482 \end{lstlisting}
6483
6484 \section{trace -- redirect command output to file}
6485 \label{cmd:trace}
6486 \begin{lstlisting}[numbers=left,frame=single]
6487 trace cmd
6488
6489 Execute the specified command, logging all changes the command performs on
6490 the design in real time.
6491 \end{lstlisting}
6492
6493 \section{tribuf -- infer tri-state buffers}
6494 \label{cmd:tribuf}
6495 \begin{lstlisting}[numbers=left,frame=single]
6496 tribuf [options] [selection]
6497
6498 This pass transforms $mux cells with 'z' inputs to tristate buffers.
6499
6500 -merge
6501 merge multiple tri-state buffers driving the same net
6502 into a single buffer.
6503
6504 -logic
6505 convert tri-state buffers that do not drive output ports
6506 to non-tristate logic. this option implies -merge.
6507 \end{lstlisting}
6508
6509 \section{uniquify -- create unique copies of modules}
6510 \label{cmd:uniquify}
6511 \begin{lstlisting}[numbers=left,frame=single]
6512 uniquify [selection]
6513
6514 By default, a module that is instantiated by several other modules is only
6515 kept once in the design. This preserves the original modularity of the design
6516 and reduces the overall size of the design in memory. But it prevents certain
6517 optimizations and other operations on the design. This pass creates unique
6518 modules for all selected cells. The created modules are marked with the
6519 'unique' attribute.
6520
6521 This commands only operates on modules that by themself have the 'unique'
6522 attribute set (the 'top' module is unique implicitly).
6523 \end{lstlisting}
6524
6525 \section{verific -- load Verilog and VHDL designs using Verific}
6526 \label{cmd:verific}
6527 \begin{lstlisting}[numbers=left,frame=single]
6528 verific {-vlog95|-vlog2k|-sv2005|-sv2009|-sv2012|-sv} <verilog-file>..
6529
6530 Load the specified Verilog/SystemVerilog files into Verific.
6531
6532 All files specified in one call to this command are one compilation unit.
6533 Files passed to different calls to this command are treated as belonging to
6534 different compilation units.
6535
6536 Additional -D<macro>[=<value>] options may be added after the option indicating
6537 the language version (and before file names) to set additional verilog defines.
6538 The macros SYNTHESIS and VERIFIC are defined implicitly.
6539
6540
6541 verific -formal <verilog-file>..
6542
6543 Like -sv, but define FORMAL instead of SYNTHESIS.
6544
6545
6546 verific {-vhdl87|-vhdl93|-vhdl2k|-vhdl2008|-vhdl} <vhdl-file>..
6547
6548 Load the specified VHDL files into Verific.
6549
6550
6551 verific [-work <libname>] {-sv|-vhdl|...} <hdl-file>
6552
6553 Load the specified Verilog/SystemVerilog/VHDL file into the specified library.
6554 (default library when -work is not present: "work")
6555
6556
6557 verific [-L <libname>] {-sv|-vhdl|...} <hdl-file>
6558
6559 Look up external definitions in the specified library.
6560 (-L may be used more than once)
6561
6562
6563 verific -vlog-incdir <directory>..
6564
6565 Add Verilog include directories.
6566
6567
6568 verific -vlog-libdir <directory>..
6569
6570 Add Verilog library directories. Verific will search in this directories to
6571 find undefined modules.
6572
6573
6574 verific -vlog-define <macro>[=<value>]..
6575
6576 Add Verilog defines.
6577
6578
6579 verific -vlog-undef <macro>..
6580
6581 Remove Verilog defines previously set with -vlog-define.
6582
6583
6584 verific -set-error <msg_id>..
6585 verific -set-warning <msg_id>..
6586 verific -set-info <msg_id>..
6587 verific -set-ignore <msg_id>..
6588
6589 Set message severity. <msg_id> is the string in square brackets when a message
6590 is printed, such as VERI-1209.
6591
6592
6593 verific -import [options] <top-module>..
6594
6595 Elaborate the design for the specified top modules, import to Yosys and
6596 reset the internal state of Verific.
6597
6598 Import options:
6599
6600 -all
6601 Elaborate all modules, not just the hierarchy below the given top
6602 modules. With this option the list of modules to import is optional.
6603
6604 -gates
6605 Create a gate-level netlist.
6606
6607 -flatten
6608 Flatten the design in Verific before importing.
6609
6610 -extnets
6611 Resolve references to external nets by adding module ports as needed.
6612
6613 -autocover
6614 Generate automatic cover statements for all asserts
6615
6616 -fullinit
6617 Keep all register initializations, even those for non-FF registers.
6618
6619 -chparam name value
6620 Elaborate the specified top modules (all modules when -all given) using
6621 this parameter value. Modules on which this parameter does not exist will
6622 cause Verific to produce a VERI-1928 or VHDL-1676 message. This option
6623 can be specified multiple times to override multiple parameters.
6624 String values must be passed in double quotes (").
6625
6626 -v, -vv
6627 Verbose log messages. (-vv is even more verbose than -v.)
6628
6629 The following additional import options are useful for debugging the Verific
6630 bindings (for Yosys and/or Verific developers):
6631
6632 -k
6633 Keep going after an unsupported verific primitive is found. The
6634 unsupported primitive is added as blockbox module to the design.
6635 This will also add all SVA related cells to the design parallel to
6636 the checker logic inferred by it.
6637
6638 -V
6639 Import Verific netlist as-is without translating to Yosys cell types.
6640
6641 -nosva
6642 Ignore SVA properties, do not infer checker logic.
6643
6644 -L <int>
6645 Maximum number of ctrl bits for SVA checker FSMs (default=16).
6646
6647 -n
6648 Keep all Verific names on instances and nets. By default only
6649 user-declared names are preserved.
6650
6651 -d <dump_file>
6652 Dump the Verific netlist as a verilog file.
6653
6654
6655 Use Symbiotic EDA Suite if you need Yosys+Verifc.
6656 https://www.symbioticeda.com/seda-suite
6657
6658 Contact office@symbioticeda.com for free evaluation
6659 binaries of Symbiotic EDA Suite.
6660 \end{lstlisting}
6661
6662 \section{verilog\_defaults -- set default options for read\_verilog}
6663 \label{cmd:verilog_defaults}
6664 \begin{lstlisting}[numbers=left,frame=single]
6665 verilog_defaults -add [options]
6666
6667 Add the specified options to the list of default options to read_verilog.
6668
6669
6670 verilog_defaults -clear
6671
6672 Clear the list of Verilog default options.
6673
6674
6675 verilog_defaults -push
6676 verilog_defaults -pop
6677
6678 Push or pop the list of default options to a stack. Note that -push does
6679 not imply -clear.
6680 \end{lstlisting}
6681
6682 \section{verilog\_defines -- define and undefine verilog defines}
6683 \label{cmd:verilog_defines}
6684 \begin{lstlisting}[numbers=left,frame=single]
6685 verilog_defines [options]
6686
6687 Define and undefine verilog preprocessor macros.
6688
6689 -Dname[=definition]
6690 define the preprocessor symbol 'name' and set its optional value
6691 'definition'
6692
6693 -Uname[=definition]
6694 undefine the preprocessor symbol 'name'
6695
6696 -reset
6697 clear list of defined preprocessor symbols
6698
6699 -list
6700 list currently defined preprocessor symbols
6701 \end{lstlisting}
6702
6703 \section{wbflip -- flip the whitebox attribute}
6704 \label{cmd:wbflip}
6705 \begin{lstlisting}[numbers=left,frame=single]
6706 wbflip [selection]
6707
6708 Flip the whitebox attribute on selected cells. I.e. if it's set, unset it, and
6709 vice-versa. Blackbox cells are not effected by this command.
6710 \end{lstlisting}
6711
6712 \section{wreduce -- reduce the word size of operations if possible}
6713 \label{cmd:wreduce}
6714 \begin{lstlisting}[numbers=left,frame=single]
6715 wreduce [options] [selection]
6716
6717 This command reduces the word size of operations. For example it will replace
6718 the 32 bit adders in the following code with adders of more appropriate widths:
6719
6720 module test(input [3:0] a, b, c, output [7:0] y);
6721 assign y = a + b + c + 1;
6722 endmodule
6723
6724 Options:
6725
6726 -memx
6727 Do not change the width of memory address ports. Use this options in
6728 flows that use the 'memory_memx' pass.
6729
6730 -keepdc
6731 Do not optimize explicit don't-care values.
6732 \end{lstlisting}
6733
6734 \section{write\_aiger -- write design to AIGER file}
6735 \label{cmd:write_aiger}
6736 \begin{lstlisting}[numbers=left,frame=single]
6737 write_aiger [options] [filename]
6738
6739 Write the current design to an AIGER file. The design must be flattened and
6740 must not contain any cell types except $_AND_, $_NOT_, simple FF types,
6741 $assert and $assume cells, and $initstate cells.
6742
6743 $assert and $assume cells are converted to AIGER bad state properties and
6744 invariant constraints.
6745
6746 -ascii
6747 write ASCII version of AIGER format
6748
6749 -zinit
6750 convert FFs to zero-initialized FFs, adding additional inputs for
6751 uninitialized FFs.
6752
6753 -miter
6754 design outputs are AIGER bad state properties
6755
6756 -symbols
6757 include a symbol table in the generated AIGER file
6758
6759 -map <filename>
6760 write an extra file with port and latch symbols
6761
6762 -vmap <filename>
6763 like -map, but more verbose
6764
6765 -I, -O, -B, -L
6766 If the design contains no input/output/assert/flip-flop then create one
6767 dummy input/output/bad_state-pin or latch to make the tools reading the
6768 AIGER file happy.
6769 \end{lstlisting}
6770
6771 \section{write\_blif -- write design to BLIF file}
6772 \label{cmd:write_blif}
6773 \begin{lstlisting}[numbers=left,frame=single]
6774 write_blif [options] [filename]
6775
6776 Write the current design to an BLIF file.
6777
6778 -top top_module
6779 set the specified module as design top module
6780
6781 -buf <cell-type> <in-port> <out-port>
6782 use cells of type <cell-type> with the specified port names for buffers
6783
6784 -unbuf <cell-type> <in-port> <out-port>
6785 replace buffer cells with the specified name and port names with
6786 a .names statement that models a buffer
6787
6788 -true <cell-type> <out-port>
6789 -false <cell-type> <out-port>
6790 -undef <cell-type> <out-port>
6791 use the specified cell types to drive nets that are constant 1, 0, or
6792 undefined. when '-' is used as <cell-type>, then <out-port> specifies
6793 the wire name to be used for the constant signal and no cell driving
6794 that wire is generated. when '+' is used as <cell-type>, then <out-port>
6795 specifies the wire name to be used for the constant signal and a .names
6796 statement is generated to drive the wire.
6797
6798 -noalias
6799 if a net name is aliasing another net name, then by default a net
6800 without fanout is created that is driven by the other net. This option
6801 suppresses the generation of this nets without fanout.
6802
6803 The following options can be useful when the generated file is not going to be
6804 read by a BLIF parser but a custom tool. It is recommended to not name the output
6805 file *.blif when any of this options is used.
6806
6807 -icells
6808 do not translate Yosys's internal gates to generic BLIF logic
6809 functions. Instead create .subckt or .gate lines for all cells.
6810
6811 -gates
6812 print .gate instead of .subckt lines for all cells that are not
6813 instantiations of other modules from this design.
6814
6815 -conn
6816 do not generate buffers for connected wires. instead use the
6817 non-standard .conn statement.
6818
6819 -attr
6820 use the non-standard .attr statement to write cell attributes
6821
6822 -param
6823 use the non-standard .param statement to write cell parameters
6824
6825 -cname
6826 use the non-standard .cname statement to write cell names
6827
6828 -iname, -iattr
6829 enable -cname and -attr functionality for .names statements
6830 (the .cname and .attr statements will be included in the BLIF
6831 output after the truth table for the .names statement)
6832
6833 -blackbox
6834 write blackbox cells with .blackbox statement.
6835
6836 -impltf
6837 do not write definitions for the $true, $false and $undef wires.
6838 \end{lstlisting}
6839
6840 \section{write\_btor -- write design to BTOR file}
6841 \label{cmd:write_btor}
6842 \begin{lstlisting}[numbers=left,frame=single]
6843 write_btor [options] [filename]
6844
6845 Write a BTOR description of the current design.
6846
6847 -v
6848 Add comments and indentation to BTOR output file
6849
6850 -s
6851 Output only a single bad property for all asserts
6852
6853 -c
6854 Output cover properties using 'bad' statements instead of asserts
6855
6856 -i <filename>
6857 Create additional info file with auxiliary information
6858 \end{lstlisting}
6859
6860 \section{write\_cxxrtl -- convert design to C++ RTL simulation}
6861 \label{cmd:write_cxxrtl}
6862 \begin{lstlisting}[numbers=left,frame=single]
6863 write_cxxrtl [options] [filename]
6864
6865 Write C++ code for simulating the design. The generated code requires a driver;
6866 the following simple driver is provided as an example:
6867
6868 #include "top.cc"
6869
6870 int main() {
6871 cxxrtl_design::p_top top;
6872 while (1) {
6873 top.p_clk.next = value<1> {1u};
6874 top.step();
6875 top.p_clk.next = value<1> {0u};
6876 top.step();
6877 }
6878 }
6879
6880 The following options are supported by this backend:
6881
6882 -O <level>
6883 set the optimization level. the default is -O5. higher optimization
6884 levels dramatically decrease compile and run time, and highest level
6885 possible for a design should be used.
6886
6887 -O0
6888 no optimization.
6889
6890 -O1
6891 elide internal wires if possible.
6892
6893 -O2
6894 like -O1, and localize internal wires if possible.
6895
6896 -O3
6897 like -O2, and elide public wires not marked (*keep*) if possible.
6898
6899 -O4
6900 like -O3, and localize public wires not marked (*keep*) if possible.
6901
6902 -O5
6903 like -O4, and run `splitnets -driver; opt_clean -purge` first.
6904 \end{lstlisting}
6905
6906 \section{write\_edif -- write design to EDIF netlist file}
6907 \label{cmd:write_edif}
6908 \begin{lstlisting}[numbers=left,frame=single]
6909 write_edif [options] [filename]
6910
6911 Write the current design to an EDIF netlist file.
6912
6913 -top top_module
6914 set the specified module as design top module
6915
6916 -nogndvcc
6917 do not create "GND" and "VCC" cells. (this will produce an error
6918 if the design contains constant nets. use "hilomap" to map to custom
6919 constant drivers first)
6920
6921 -gndvccy
6922 create "GND" and "VCC" cells with "Y" outputs. (the default is "G"
6923 for "GND" and "P" for "VCC".)
6924
6925 -attrprop
6926 create EDIF properties for cell attributes
6927
6928 -pvector {par|bra|ang}
6929 sets the delimiting character for module port rename clauses to
6930 parentheses, square brackets, or angle brackets.
6931
6932 Unfortunately there are different "flavors" of the EDIF file format. This
6933 command generates EDIF files for the Xilinx place&route tools. It might be
6934 necessary to make small modifications to this command when a different tool
6935 is targeted.
6936 \end{lstlisting}
6937
6938 \section{write\_file -- write a text to a file}
6939 \label{cmd:write_file}
6940 \begin{lstlisting}[numbers=left,frame=single]
6941 write_file [options] output_file [input_file]
6942
6943 Write the text from the input file to the output file.
6944
6945 -a
6946 Append to output file (instead of overwriting)
6947
6948
6949 Inside a script the input file can also can a here-document:
6950
6951 write_file hello.txt <<EOT
6952 Hello World!
6953 EOT
6954 \end{lstlisting}
6955
6956 \section{write\_firrtl -- write design to a FIRRTL file}
6957 \label{cmd:write_firrtl}
6958 \begin{lstlisting}[numbers=left,frame=single]
6959 write_firrtl [options] [filename]
6960
6961 Write a FIRRTL netlist of the current design.
6962 The following commands are executed by this command:
6963 pmuxtree
6964 \end{lstlisting}
6965
6966 \section{write\_ilang -- write design to ilang file}
6967 \label{cmd:write_ilang}
6968 \begin{lstlisting}[numbers=left,frame=single]
6969 write_ilang [filename]
6970
6971 Write the current design to an 'ilang' file. (ilang is a text representation
6972 of a design in yosys's internal format.)
6973
6974 -selected
6975 only write selected parts of the design.
6976 \end{lstlisting}
6977
6978 \section{write\_intersynth -- write design to InterSynth netlist file}
6979 \label{cmd:write_intersynth}
6980 \begin{lstlisting}[numbers=left,frame=single]
6981 write_intersynth [options] [filename]
6982
6983 Write the current design to an 'intersynth' netlist file. InterSynth is
6984 a tool for Coarse-Grain Example-Driven Interconnect Synthesis.
6985
6986 -notypes
6987 do not generate celltypes and conntypes commands. i.e. just output
6988 the netlists. this is used for postsilicon synthesis.
6989
6990 -lib <verilog_or_ilang_file>
6991 Use the specified library file for determining whether cell ports are
6992 inputs or outputs. This option can be used multiple times to specify
6993 more than one library.
6994
6995 -selected
6996 only write selected modules. modules must be selected entirely or
6997 not at all.
6998
6999 http://www.clifford.at/intersynth/
7000 \end{lstlisting}
7001
7002 \section{write\_json -- write design to a JSON file}
7003 \label{cmd:write_json}
7004 \begin{lstlisting}[numbers=left,frame=single]
7005 write_json [options] [filename]
7006
7007 Write a JSON netlist of the current design.
7008
7009 -aig
7010 include AIG models for the different gate types
7011
7012 -compat-int
7013 emit 32-bit or smaller fully-defined parameter values directly
7014 as JSON numbers (for compatibility with old parsers)
7015
7016
7017 The general syntax of the JSON output created by this command is as follows:
7018
7019 {
7020 "modules": {
7021 <module_name>: {
7022 "ports": {
7023 <port_name>: <port_details>,
7024 ...
7025 },
7026 "cells": {
7027 <cell_name>: <cell_details>,
7028 ...
7029 },
7030 "netnames": {
7031 <net_name>: <net_details>,
7032 ...
7033 }
7034 }
7035 },
7036 "models": {
7037 ...
7038 },
7039 }
7040
7041 Where <port_details> is:
7042
7043 {
7044 "direction": <"input" | "output" | "inout">,
7045 "bits": <bit_vector>
7046 }
7047
7048 And <cell_details> is:
7049
7050 {
7051 "hide_name": <1 | 0>,
7052 "type": <cell_type>,
7053 "parameters": {
7054 <parameter_name>: <parameter_value>,
7055 ...
7056 },
7057 "attributes": {
7058 <attribute_name>: <attribute_value>,
7059 ...
7060 },
7061 "port_directions": {
7062 <port_name>: <"input" | "output" | "inout">,
7063 ...
7064 },
7065 "connections": {
7066 <port_name>: <bit_vector>,
7067 ...
7068 },
7069 }
7070
7071 And <net_details> is:
7072
7073 {
7074 "hide_name": <1 | 0>,
7075 "bits": <bit_vector>
7076 }
7077
7078 The "hide_name" fields are set to 1 when the name of this cell or net is
7079 automatically created and is likely not of interest for a regular user.
7080
7081 The "port_directions" section is only included for cells for which the
7082 interface is known.
7083
7084 Module and cell ports and nets can be single bit wide or vectors of multiple
7085 bits. Each individual signal bit is assigned a unique integer. The <bit_vector>
7086 values referenced above are vectors of this integers. Signal bits that are
7087 connected to a constant driver are denoted as string "0", "1", "x", or
7088 "z" instead of a number.
7089
7090 Bit vectors (including integers) are written as string holding the binaryrepresentation of the value. Strings are written as strings, with an appendedblank in cases of strings of the form /[01xz]* */.
7091
7092 For example the following Verilog code:
7093
7094 module test(input x, y);
7095 (* keep *) foo #(.P(42), .Q(1337))
7096 foo_inst (.A({x, y}), .B({y, x}), .C({4'd10, {4{x}}}));
7097 endmodule
7098
7099 Translates to the following JSON output:
7100
7101 {
7102 "modules": {
7103 "test": {
7104 "ports": {
7105 "x": {
7106 "direction": "input",
7107 "bits": [ 2 ]
7108 },
7109 "y": {
7110 "direction": "input",
7111 "bits": [ 3 ]
7112 }
7113 },
7114 "cells": {
7115 "foo_inst": {
7116 "hide_name": 0,
7117 "type": "foo",
7118 "parameters": {
7119 "Q": 1337,
7120 "P": 42
7121 },
7122 "attributes": {
7123 "keep": 1,
7124 "src": "test.v:2"
7125 },
7126 "connections": {
7127 "C": [ 2, 2, 2, 2, "0", "1", "0", "1" ],
7128 "B": [ 2, 3 ],
7129 "A": [ 3, 2 ]
7130 }
7131 }
7132 },
7133 "netnames": {
7134 "y": {
7135 "hide_name": 0,
7136 "bits": [ 3 ],
7137 "attributes": {
7138 "src": "test.v:1"
7139 }
7140 },
7141 "x": {
7142 "hide_name": 0,
7143 "bits": [ 2 ],
7144 "attributes": {
7145 "src": "test.v:1"
7146 }
7147 }
7148 }
7149 }
7150 }
7151 }
7152
7153 The models are given as And-Inverter-Graphs (AIGs) in the following form:
7154
7155 "models": {
7156 <model_name>: [
7157 /* 0 */ [ <node-spec> ],
7158 /* 1 */ [ <node-spec> ],
7159 /* 2 */ [ <node-spec> ],
7160 ...
7161 ],
7162 ...
7163 },
7164
7165 The following node-types may be used:
7166
7167 [ "port", <portname>, <bitindex>, <out-list> ]
7168 - the value of the specified input port bit
7169
7170 [ "nport", <portname>, <bitindex>, <out-list> ]
7171 - the inverted value of the specified input port bit
7172
7173 [ "and", <node-index>, <node-index>, <out-list> ]
7174 - the ANDed value of the specified nodes
7175
7176 [ "nand", <node-index>, <node-index>, <out-list> ]
7177 - the inverted ANDed value of the specified nodes
7178
7179 [ "true", <out-list> ]
7180 - the constant value 1
7181
7182 [ "false", <out-list> ]
7183 - the constant value 0
7184
7185 All nodes appear in topological order. I.e. only nodes with smaller indices
7186 are referenced by "and" and "nand" nodes.
7187
7188 The optional <out-list> at the end of a node specification is a list of
7189 output portname and bitindex pairs, specifying the outputs driven by this node.
7190
7191 For example, the following is the model for a 3-input 3-output $reduce_and cell
7192 inferred by the following code:
7193
7194 module test(input [2:0] in, output [2:0] out);
7195 assign in = &out;
7196 endmodule
7197
7198 "$reduce_and:3U:3": [
7199 /* 0 */ [ "port", "A", 0 ],
7200 /* 1 */ [ "port", "A", 1 ],
7201 /* 2 */ [ "and", 0, 1 ],
7202 /* 3 */ [ "port", "A", 2 ],
7203 /* 4 */ [ "and", 2, 3, "Y", 0 ],
7204 /* 5 */ [ "false", "Y", 1, "Y", 2 ]
7205 ]
7206
7207 Future version of Yosys might add support for additional fields in the JSON
7208 format. A program processing this format must ignore all unknown fields.
7209 \end{lstlisting}
7210
7211 \section{write\_simplec -- convert design to simple C code}
7212 \label{cmd:write_simplec}
7213 \begin{lstlisting}[numbers=left,frame=single]
7214 write_simplec [options] [filename]
7215
7216 Write simple C code for simulating the design. The C code written can be used to
7217 simulate the design in a C environment, but the purpose of this command is to
7218 generate code that works well with C-based formal verification.
7219
7220 -verbose
7221 this will print the recursive walk used to export the modules.
7222
7223 -i8, -i16, -i32, -i64
7224 set the maximum integer bit width to use in the generated code.
7225
7226 THIS COMMAND IS UNDER CONSTRUCTION
7227 \end{lstlisting}
7228
7229 \section{write\_smt2 -- write design to SMT-LIBv2 file}
7230 \label{cmd:write_smt2}
7231 \begin{lstlisting}[numbers=left,frame=single]
7232 write_smt2 [options] [filename]
7233
7234 Write a SMT-LIBv2 [1] description of the current design. For a module with name
7235 '<mod>' this will declare the sort '<mod>_s' (state of the module) and will
7236 define and declare functions operating on that state.
7237
7238 The following SMT2 functions are generated for a module with name '<mod>'.
7239 Some declarations/definitions are printed with a special comment. A prover
7240 using the SMT2 files can use those comments to collect all relevant metadata
7241 about the design.
7242
7243 ; yosys-smt2-module <mod>
7244 (declare-sort |<mod>_s| 0)
7245 The sort representing a state of module <mod>.
7246
7247 (define-fun |<mod>_h| ((state |<mod>_s|)) Bool (...))
7248 This function must be asserted for each state to establish the
7249 design hierarchy.
7250
7251 ; yosys-smt2-input <wirename> <width>
7252 ; yosys-smt2-output <wirename> <width>
7253 ; yosys-smt2-register <wirename> <width>
7254 ; yosys-smt2-wire <wirename> <width>
7255 (define-fun |<mod>_n <wirename>| (|<mod>_s|) (_ BitVec <width>))
7256 (define-fun |<mod>_n <wirename>| (|<mod>_s|) Bool)
7257 For each port, register, and wire with the 'keep' attribute set an
7258 accessor function is generated. Single-bit wires are returned as Bool,
7259 multi-bit wires as BitVec.
7260
7261 ; yosys-smt2-cell <submod> <instancename>
7262 (declare-fun |<mod>_h <instancename>| (|<mod>_s|) |<submod>_s|)
7263 There is a function like that for each hierarchical instance. It
7264 returns the sort that represents the state of the sub-module that
7265 implements the instance.
7266
7267 (declare-fun |<mod>_is| (|<mod>_s|) Bool)
7268 This function must be asserted 'true' for initial states, and 'false'
7269 otherwise.
7270
7271 (define-fun |<mod>_i| ((state |<mod>_s|)) Bool (...))
7272 This function must be asserted 'true' for initial states. For
7273 non-initial states it must be left unconstrained.
7274
7275 (define-fun |<mod>_t| ((state |<mod>_s|) (next_state |<mod>_s|)) Bool (...))
7276 This function evaluates to 'true' if the states 'state' and
7277 'next_state' form a valid state transition.
7278
7279 (define-fun |<mod>_a| ((state |<mod>_s|)) Bool (...))
7280 This function evaluates to 'true' if all assertions hold in the state.
7281
7282 (define-fun |<mod>_u| ((state |<mod>_s|)) Bool (...))
7283 This function evaluates to 'true' if all assumptions hold in the state.
7284
7285 ; yosys-smt2-assert <id> <filename:linenum>
7286 (define-fun |<mod>_a <id>| ((state |<mod>_s|)) Bool (...))
7287 Each $assert cell is converted into one of this functions. The function
7288 evaluates to 'true' if the assert statement holds in the state.
7289
7290 ; yosys-smt2-assume <id> <filename:linenum>
7291 (define-fun |<mod>_u <id>| ((state |<mod>_s|)) Bool (...))
7292 Each $assume cell is converted into one of this functions. The function
7293 evaluates to 'true' if the assume statement holds in the state.
7294
7295 ; yosys-smt2-cover <id> <filename:linenum>
7296 (define-fun |<mod>_c <id>| ((state |<mod>_s|)) Bool (...))
7297 Each $cover cell is converted into one of this functions. The function
7298 evaluates to 'true' if the cover statement is activated in the state.
7299
7300 Options:
7301
7302 -verbose
7303 this will print the recursive walk used to export the modules.
7304
7305 -stbv
7306 Use a BitVec sort to represent a state instead of an uninterpreted
7307 sort. As a side-effect this will prevent use of arrays to model
7308 memories.
7309
7310 -stdt
7311 Use SMT-LIB 2.6 style datatypes to represent a state instead of an
7312 uninterpreted sort.
7313
7314 -nobv
7315 disable support for BitVec (FixedSizeBitVectors theory). without this
7316 option multi-bit wires are represented using the BitVec sort and
7317 support for coarse grain cells (incl. arithmetic) is enabled.
7318
7319 -nomem
7320 disable support for memories (via ArraysEx theory). this option is
7321 implied by -nobv. only $mem cells without merged registers in
7322 read ports are supported. call "memory" with -nordff to make sure
7323 that no registers are merged into $mem read ports. '<mod>_m' functions
7324 will be generated for accessing the arrays that are used to represent
7325 memories.
7326
7327 -wires
7328 create '<mod>_n' functions for all public wires. by default only ports,
7329 registers, and wires with the 'keep' attribute are exported.
7330
7331 -tpl <template_file>
7332 use the given template file. the line containing only the token '%%'
7333 is replaced with the regular output of this command.
7334
7335 [1] For more information on SMT-LIBv2 visit http://smt-lib.org/ or read David
7336 R. Cok's tutorial: http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf
7337
7338 ---------------------------------------------------------------------------
7339
7340 Example:
7341
7342 Consider the following module (test.v). We want to prove that the output can
7343 never transition from a non-zero value to a zero value.
7344
7345 module test(input clk, output reg [3:0] y);
7346 always @(posedge clk)
7347 y <= (y << 1) | ^y;
7348 endmodule
7349
7350 For this proof we create the following template (test.tpl).
7351
7352 ; we need QF_UFBV for this proof
7353 (set-logic QF_UFBV)
7354
7355 ; insert the auto-generated code here
7356 %%
7357
7358 ; declare two state variables s1 and s2
7359 (declare-fun s1 () test_s)
7360 (declare-fun s2 () test_s)
7361
7362 ; state s2 is the successor of state s1
7363 (assert (test_t s1 s2))
7364
7365 ; we are looking for a model with y non-zero in s1
7366 (assert (distinct (|test_n y| s1) #b0000))
7367
7368 ; we are looking for a model with y zero in s2
7369 (assert (= (|test_n y| s2) #b0000))
7370
7371 ; is there such a model?
7372 (check-sat)
7373
7374 The following yosys script will create a 'test.smt2' file for our proof:
7375
7376 read_verilog test.v
7377 hierarchy -check; proc; opt; check -assert
7378 write_smt2 -bv -tpl test.tpl test.smt2
7379
7380 Running 'cvc4 test.smt2' will print 'unsat' because y can never transition
7381 from non-zero to zero in the test design.
7382 \end{lstlisting}
7383
7384 \section{write\_smv -- write design to SMV file}
7385 \label{cmd:write_smv}
7386 \begin{lstlisting}[numbers=left,frame=single]
7387 write_smv [options] [filename]
7388
7389 Write an SMV description of the current design.
7390
7391 -verbose
7392 this will print the recursive walk used to export the modules.
7393
7394 -tpl <template_file>
7395 use the given template file. the line containing only the token '%%'
7396 is replaced with the regular output of this command.
7397
7398 THIS COMMAND IS UNDER CONSTRUCTION
7399 \end{lstlisting}
7400
7401 \section{write\_spice -- write design to SPICE netlist file}
7402 \label{cmd:write_spice}
7403 \begin{lstlisting}[numbers=left,frame=single]
7404 write_spice [options] [filename]
7405
7406 Write the current design to an SPICE netlist file.
7407
7408 -big_endian
7409 generate multi-bit ports in MSB first order
7410 (default is LSB first)
7411
7412 -neg net_name
7413 set the net name for constant 0 (default: Vss)
7414
7415 -pos net_name
7416 set the net name for constant 1 (default: Vdd)
7417
7418 -nc_prefix
7419 prefix for not-connected nets (default: _NC)
7420
7421 -inames
7422 include names of internal ($-prefixed) nets in outputs
7423 (default is to use net numbers instead)
7424
7425 -top top_module
7426 set the specified module as design top module
7427 \end{lstlisting}
7428
7429 \section{write\_table -- write design as connectivity table}
7430 \label{cmd:write_table}
7431 \begin{lstlisting}[numbers=left,frame=single]
7432 write_table [options] [filename]
7433
7434 Write the current design as connectivity table. The output is a tab-separated
7435 ASCII table with the following columns:
7436
7437 module name
7438 cell name
7439 cell type
7440 cell port
7441 direction
7442 signal
7443
7444 module inputs and outputs are output using cell type and port '-' and with
7445 'pi' (primary input) or 'po' (primary output) or 'pio' as direction.
7446 \end{lstlisting}
7447
7448 \section{write\_verilog -- write design to Verilog file}
7449 \label{cmd:write_verilog}
7450 \begin{lstlisting}[numbers=left,frame=single]
7451 write_verilog [options] [filename]
7452
7453 Write the current design to a Verilog file.
7454
7455 -norename
7456 without this option all internal object names (the ones with a dollar
7457 instead of a backslash prefix) are changed to short names in the
7458 format '_<number>_'.
7459
7460 -renameprefix <prefix>
7461 insert this prefix in front of auto-generated instance names
7462
7463 -noattr
7464 with this option no attributes are included in the output
7465
7466 -attr2comment
7467 with this option attributes are included as comments in the output
7468
7469 -noexpr
7470 without this option all internal cells are converted to Verilog
7471 expressions.
7472
7473 -siminit
7474 add initial statements with hierarchical refs to initialize FFs when
7475 in -noexpr mode.
7476
7477 -nodec
7478 32-bit constant values are by default dumped as decimal numbers,
7479 not bit pattern. This option deactivates this feature and instead
7480 will write out all constants in binary.
7481
7482 -decimal
7483 dump 32-bit constants in decimal and without size and radix
7484
7485 -nohex
7486 constant values that are compatible with hex output are usually
7487 dumped as hex values. This option deactivates this feature and
7488 instead will write out all constants in binary.
7489
7490 -nostr
7491 Parameters and attributes that are specified as strings in the
7492 original input will be output as strings by this back-end. This
7493 deactivates this feature and instead will write string constants
7494 as binary numbers.
7495
7496 -extmem
7497 instead of initializing memories using assignments to individual
7498 elements, use the '$readmemh' function to read initialization data
7499 from a file. This data is written to a file named by appending
7500 a sequential index to the Verilog filename and replacing the extension
7501 with '.mem', e.g. 'write_verilog -extmem foo.v' writes 'foo-1.mem',
7502 'foo-2.mem' and so on.
7503
7504 -defparam
7505 use 'defparam' statements instead of the Verilog-2001 syntax for
7506 cell parameters.
7507
7508 -blackboxes
7509 usually modules with the 'blackbox' attribute are ignored. with
7510 this option set only the modules with the 'blackbox' attribute
7511 are written to the output file.
7512
7513 -selected
7514 only write selected modules. modules must be selected entirely or
7515 not at all.
7516
7517 -v
7518 verbose output (print new names of all renamed wires and cells)
7519
7520 Note that RTLIL processes can't always be mapped directly to Verilog
7521 always blocks. This frontend should only be used to export an RTLIL
7522 netlist, i.e. after the "proc" pass has been used to convert all
7523 processes to logic networks and registers. A warning is generated when
7524 this command is called on a design with RTLIL processes.
7525 \end{lstlisting}
7526
7527 \section{write\_xaiger -- write design to XAIGER file}
7528 \label{cmd:write_xaiger}
7529 \begin{lstlisting}[numbers=left,frame=single]
7530 write_xaiger [options] [filename]
7531
7532 Write the top module (according to the (* top *) attribute or if only one module
7533 is currently selected) to an XAIGER file. Any non $_NOT_, $_AND_, $_ABC9_FF_, ornon (* abc9_box_id *) cells will be converted into psuedo-inputs and
7534 pseudo-outputs. Whitebox contents will be taken from the '<module-name>$holes'
7535 module, if it exists.
7536
7537 -ascii
7538 write ASCII version of AIGER format
7539
7540 -map <filename>
7541 write an extra file with port and box symbols
7542 \end{lstlisting}
7543
7544 \section{xilinx\_dffopt -- Xilinx: optimize FF control signal usage}
7545 \label{cmd:xilinx_dffopt}
7546 \begin{lstlisting}[numbers=left,frame=single]
7547 xilinx_dffopt [options] [selection]
7548
7549 Converts hardware clock enable and set/reset signals on FFs to emulation
7550 using LUTs, if doing so would improve area. Operates on post-techmap Xilinx
7551 cells (LUT*, FD*).
7552
7553 -lut4
7554 Assume a LUT4-based device (instead of a LUT6-based device).
7555 \end{lstlisting}
7556
7557 \section{xilinx\_dsp -- Xilinx: pack resources into DSPs}
7558 \label{cmd:xilinx_dsp}
7559 \begin{lstlisting}[numbers=left,frame=single]
7560 xilinx_dsp [options] [selection]
7561
7562 Pack input registers (A2, A1, B2, B1, C, D, AD; with optional enable/reset),
7563 pipeline registers (M; with optional enable/reset), output registers (P; with
7564 optional enable/reset), pre-adder and/or post-adder into Xilinx DSP resources.
7565
7566 Multiply-accumulate operations using the post-adder with feedback on the 'C'
7567 input will be folded into the DSP. In this scenario only, the 'C' input can be
7568 used to override the current accumulation result with a new value, which will
7569 be added to the multiplier result to form the next accumulation result.
7570
7571 Use of the dedicated 'PCOUT' -> 'PCIN' cascade path is detected for 'P' -> 'C'
7572 connections (optionally, where 'P' is right-shifted by 17-bits and used as an
7573 input to the post-adder -- a pattern common for summing partial products to
7574 implement wide multipliers). Limited support also exists for similar cascading
7575 for A and B using '[AB]COUT' -> '[AB]CIN'. Currently, cascade chains are limited
7576 to a maximum length of 20 cells, corresponding to the smallest Xilinx 7 Series
7577 device.
7578
7579 This pass is a no-op if the scratchpad variable 'xilinx_dsp.multonly' is set
7580 to 1.
7581
7582
7583 Experimental feature: addition/subtractions less than 12 or 24 bits with the
7584 '(* use_dsp="simd" *)' attribute attached to the output wire or attached to
7585 the add/subtract operator will cause those operations to be implemented using
7586 the 'SIMD' feature of DSPs.
7587
7588 Experimental feature: the presence of a `$ge' cell attached to the registered
7589 P output implementing the operation "(P >= <power-of-2>)" will be transformed
7590 into using the DSP48E1's pattern detector feature for overflow detection.
7591
7592 -family {xcup|xcu|xc7|xc6v|xc5v|xc4v|xc6s|xc3sda}
7593 select the family to target
7594 default: xc7
7595 \end{lstlisting}
7596
7597 \section{xilinx\_srl -- Xilinx shift register extraction}
7598 \label{cmd:xilinx_srl}
7599 \begin{lstlisting}[numbers=left,frame=single]
7600 xilinx_srl [options] [selection]
7601
7602 This pass converts chains of built-in flops (bit-level: $_DFF_[NP]_, $_DFFE_*
7603 and word-level: $dff, $dffe) as well as Xilinx flops (FDRE, FDRE_1) into a
7604 $__XILINX_SHREG cell. Chains must be of the same cell type, clock, clock polarity,
7605 enable, and enable polarity (where relevant).
7606 Flops with resets cannot be mapped to Xilinx devices and will not be inferred.
7607 -minlen N
7608 min length of shift register (default = 3)
7609
7610 -fixed
7611 infer fixed-length shift registers.
7612
7613 -variable
7614 infer variable-length shift registers (i.e. fixed-length shifts where
7615 each element also fans-out to a $shiftx cell).
7616 \end{lstlisting}
7617
7618 \section{zinit -- add inverters so all FF are zero-initialized}
7619 \label{cmd:zinit}
7620 \begin{lstlisting}[numbers=left,frame=single]
7621 zinit [options] [selection]
7622
7623 Add inverters as needed to make all FFs zero-initialized.
7624
7625 -all
7626 also add zero initialization to uninitialized FFs
7627 \end{lstlisting}
7628