Skip to content

Commit 6eb8a0a

Browse files
authored
Merge pull request #2139 from verilog-to-routing/yosys_plugins_docs
Update Documentation with recent changes for Yosys Plugins
2 parents 8593839 + 313c146 commit 6eb8a0a

File tree

9 files changed

+481
-242
lines changed

9 files changed

+481
-242
lines changed

doc/src/odin/quickstart.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,24 @@ To build you may use the Makefile wrapper in the $VTR_ROOT/ODIN_II ``make build`
2828

2929
./odin_II [arguments]
3030

31-
*Requires one and only one of `-c`, `-V`, or `-b`
31+
*Requires one and only one of `-c`, `-v`, or `-b`
3232

33-
| arg | following argument | Description |
33+
| arg | following argument | Description |
3434
|------|---|---|
35-
| `-c` | XML Configuration File | an XML configuration file dictating the runtime parameters of odin |
36-
| `-V` | Verilog HDL FIle | You may specify multiple verilog HDL files |
37-
| `-b` | BLIF File | You may specify multiple blif files |
38-
| `-o` | BLIF output file | full output path and file name for the blif output file |
39-
| `-a` | architecture file | You may specify multiple verilog HDL files for synthesis |
40-
| `-h` | | Print help |
35+
| `-c` | XML Configuration File | an XML configuration file dictating the runtime parameters of odin |
36+
| `-v` | Verilog HDL File | You may specify multiple space-separated verilog HDL files |
37+
| `-b` | BLIF File | You may specify multiple space-separated blif files |
38+
| `-o` | BLIF output file | full output path and file name for the blif output file |
39+
| `-a` | architecture file | You may not specify the architecture file, which results in pure soft logic synthesis |
40+
| `-h` | | Print help |
4141

4242
## Example Usage
4343

4444
The following are simple command-line arguments and a description of what they do.
4545
It is assumed that they are being performed in the Odin_II directory.
4646

4747
```bash
48-
./odin_II -V <path/to/verilog/File>
48+
./odin_II -v <path/to/verilog/File>
4949
```
5050

5151
Passes a verilog HDL file to Odin II where it is synthesized.
@@ -58,7 +58,7 @@ Warnings and errors may appear regarding the HDL code.
5858
Passes a blif file to Odin II where it is synthesized.
5959

6060
```bash
61-
./odin_II -V <path/to/verilog/File> -a <path/to/arch/file> -o myModel.blif
61+
./odin_II -v <path/to/verilog/File> -a <path/to/arch/file> -o myModel.blif
6262
```
6363

6464
Passes a verilog HDL file and and architecture to Odin II where it is synthesized.

doc/src/odin/user_guide.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
| arg | following argument | Description |
66
|-------|:-----------------------:|------------------------------------------------------- |
7-
| `-c` | XML Configuration File | XML runtime directives for the syntesizer such as the verilog file, and parametrized synthesis |
8-
| `-V` | Verilog HDL FIle | You may specify multiple verilog HDL files for synthesis|
9-
| `-b` | BLIF File | |
10-
| `-o` | BLIF output file | full output path and file name for the blif output file |
11-
| `-a` | architecture file | You may specify multiple verilog HDL files for synthesis |
12-
| `-G` | | Output netlist graph in GraphViz viewable .dot format. (net.dot, opens with dotty) |
13-
| `-A` | | Output AST graph in in GraphViz viewable .dot format. |
14-
| `-W` | | Print all warnings. (Can be substantial.) |
15-
| `-h` | | Print help |
7+
| `-c` | XML Configuration File | XML runtime directives for the syntesizer such as the verilog file, and parametrized synthesis |
8+
| `-v` | Verilog HDL File | You may specify multiple space-separated verilog HDL files for synthesis |
9+
| `-b` | BLIF File | You may **not** specify multiple BLIF files as only single input BLIF file is accepted |
10+
| `-o` | BLIF output file | full output path and file name for the BLIF output file |
11+
| `-a` | architecture file | You may specify multiple space-separated Verilog HDL files for synthesis |
12+
| `-G` | | Output netlist graph in GraphViz viewable .dot format. (net.dot, opens with dotty) |
13+
| `-A` | | Output AST graph in in GraphViz viewable .dot format. |
14+
| `-W` | | Print all warnings. (Can be substantial.) |
15+
| `-h` | | Print help |
1616

1717
## Simulation Arguments
1818

@@ -111,7 +111,7 @@ Simulation always produces the folowing files:
111111
> a distinct shared object file for each instance of the block you wish
112112
> to simulate. The method signature the simulator expects contains only
113113
> int and int[] parameters, leaving the code provided to simulate the
114-
> hard blokc agnostic of the internal Odin II data structures. However,
114+
> hard block agnostic of the internal Odin II data structures. However,
115115
> a cycle parameter is included to provide researchers with the ability
116116
> to delay results of operations performed by the simulation code.
117117
>
@@ -158,15 +158,15 @@ A very useful function of Odin II is to compare the simulated output vector file
158158
To do this the command line should be:
159159

160160
```shell
161-
./odin_II -V <Path/to/verilog/file> -t <Path/to/Input/Vector/File> -T <Path/to/Output/Vector/File>
161+
./odin_II -v <Path/to/verilog/file> -t <Path/to/Input/Vector/File> -T <Path/to/Output/Vector/File>
162162
```
163163

164164
An error will arrise if the output vector files do not match.
165165

166166
Without an expected vector output file the command line would be:
167167

168168
```shell
169-
./odin_II -V <Path/to/verilog/file> -t <Path/to/Input/Vector/File>
169+
./odin_II -v <Path/to/verilog/file> -t <Path/to/Input/Vector/File>
170170
```
171171

172172
The generated output file can be found in the current directory under the name output_vectors.
@@ -176,7 +176,7 @@ The generated output file can be found in the current directory under the name o
176176
This function generates N amounnt of random input vectors for Odin II to simulate with.
177177

178178
```shell
179-
./odin_II -V <Path/to/verilog/file> -g 10
179+
./odin_II -v <Path/to/verilog/file> -g 10
180180
```
181181

182182
This example will produce 10 autogenerated input vectors. These vectors can be found in the current directory under input_vectors and the resulting output vectors can be found under output_vectors.

doc/src/vtr/run_vtr_flow.rst

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,44 @@ For example::
6060
will run the VTR flow to map the circuit ``my_circuit.v`` onto the architecture ``my_arch.xml``; the arguments ``--pack`` and ``--place`` will be passed to VPR (since they are unrecognized arguments to ``run_vtr_flow.py``).
6161
They will cause VPR to perform only :ref:`packing and placement <general_options>`.
6262

63+
.. code-block:: bash
64+
65+
# Using the Yosys conventional Verilog parser
66+
./run_vtr_flow <path/to/Verilog/File> <path/to/arch/file> -elaborator yosys -fflegalize
67+
68+
# Using the Yosys-SystemVerilog plugin if installed, otherwise the Yosys conventional Verilog parser
69+
./run_vtr_flow <path/to/SystemVerilog/File> <path/to/arch/file> -elaborator yosys -fflegalize
70+
71+
# Using the Surelog plugin if installed, otherwise failure on the unsupported file type
72+
./run_vtr_flow <path/to/UHDM/File> <path/to/arch/file> -elaborator yosys -fflegalize
73+
74+
Passes a Verilog/SystemVerilog/UHDM file to Yosys to perform elaboration.
75+
The BLIF elaboration and partial mapping phases will be executed on the generated netlist by Odin-II, and all latches in the Yosys+Odin-II output file will be rising edge.
76+
Then ABC and VPR perform the default behaviour for the VTR flow, respectively.
77+
78+
.. code-block:: bash
79+
80+
# Using the Yosys conventional Verilog parser
81+
./run_vtr_flow <path/to/Verilog/File> <path/to/arch/file> -start yosys
82+
83+
# Using the Yosys-SystemVerilog plugin if installed, otherwise the Yosys conventional Verilog parser
84+
./run_vtr_flow <path/to/SystemVerilog/File> <path/to/arch/file> -start yosys
85+
86+
Running the VTR flow with the default configuration using the Yosys standalone front-end.
87+
The parser for these runs is considered the Yosys conventional Verilog/SystemVerilog parser (i.e., ``read_verilog -sv``), as the parser is not explicitly specified.
88+
89+
.. code-block:: bash
90+
91+
# Using the Yosys-SystemVerilog plugin if installed, otherwise the Yosys conventional Verilog parser
92+
./run_vtr_flow <path/to/SystemVerilog/File> <path/to/arch/file> -start yosys -parser yosys-plugin
93+
94+
# Using the Surelog plugin if installed, otherwise failure on the unsupported file type
95+
./run_vtr_flow <path/to/UHDM/File> <path/to/arch/file> -start yosys -parser surelog
96+
97+
Running the default VTR flow using the Yosys standalone front-end.
98+
The Yosys HDL parser is considered as Yosys-SystemVerilog plugin (i.e., ``read_systemverilog``) and Yosys UHDM plugin (i.e., ``read_uhdm``), respectively.
99+
It is worth mentioning that utilizing Yosys plugins requires passing the ``-DYOSYS_SV_UHDM_PLUGIN=ON`` compile flag to build and install the plugins for the Yosys front-end.
100+
63101
Detailed Command-line Options
64102
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65103

@@ -72,6 +110,7 @@ Detailed Command-line Options
72110
Accepted values:
73111

74112
* ``odin``
113+
* ``yosys``
75114
* ``abc``
76115
* ``scripts``
77116
* ``vpr``
@@ -86,6 +125,7 @@ Detailed Command-line Options
86125
Accepted values:
87126

88127
* ``odin``
128+
* ``yosys``
89129
* ``abc``
90130
* ``scripts``
91131
* ``vpr``
@@ -183,3 +223,93 @@ Detailed Command-line Options
183223
scenarios. This option is needed for running the entire VTR flow with
184224
additional parameters for ODIN II that are provided from within the
185225
.xml file.
226+
227+
.. option:: -use_odin_simulation
228+
229+
Tells ODIN II to run simulation.
230+
231+
.. option:: -min_hard_mult_size <min_hard_mult_size>
232+
233+
Tells ODIN II the minimum multiplier size (in bits) to be implemented using hard multiplier.
234+
235+
**Default:** 3
236+
237+
.. option:: -min_hard_adder_size <MIN_HARD_ADDER_SIZE>
238+
239+
Tells ODIN II the minimum adder size (in bits) that should be implemented using hard adder.
240+
241+
**Default:** 1
242+
243+
.. option:: -elaborator <ELABORATOR>
244+
245+
Specifies the elaborator of the synthesis flow for ODIN II [odin, yosys]
246+
247+
**Default:** odin
248+
249+
.. option:: -top_module <TOP_MODULE>
250+
251+
Specifies the name of the module in the design that should be considered as top
252+
253+
.. option:: -coarsen
254+
255+
Notifies ODIN II if the input BLIF is coarse-grained.
256+
257+
**Default:** False
258+
259+
.. note::
260+
261+
A coarse-grained BLIF file is defined as a BLIF file inclduing unmapped cells with the Yosys internal cell (listed `here <https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/b913727959e22ae7a535ac8b907d0aaa9a3eda3d/ODIN_II/SRC/enum_str.cpp#L402-L494>`_) format which are represented by the ``.subckt`` tag in coarse-grained BLIF.
262+
263+
.. option:: -fflegalize
264+
265+
Makes flip-flops rising edge for coarse-grained input BLIFs in the partial technology mapping phase (ODIN II synthesis flow generates rising edge FFs by default, should be used for Yosys+Odin-II)
266+
267+
**Default:** False
268+
269+
.. option:: -encode_names
270+
271+
Enables ODIN II utilization of operation-type-encoded naming style for Yosys coarse-grained RTLIL nodes.
272+
273+
.. code-block::
274+
275+
# example of a DFF subcircuit in the Yosys coarse-grained BLIF
276+
.subckt $dff CLK=clk D=a Q=inst1.inst2.temp
277+
.param CLK_POLARITY 1
278+
279+
.names inst1.inst2.temp o
280+
1 1
281+
282+
# fine-grained BLIF file with enabled encode_names option for Odin-II partial mapper
283+
.latch test^a test^inst1.inst2.temp^FF~0 re test^clk 3
284+
285+
.names test^inst1.inst2.temp^FF~0 test^o
286+
1 1
287+
288+
# fine-grained BLIF file with disabled encode_names option for Odin-II partial mapper
289+
.latch test^a test^$dff^FF~0 re test^clk 3
290+
291+
.names test^$dff^FF~0 test^o
292+
1 1
293+
294+
**Default:** False
295+
296+
.. option:: -yosys_script <YOSYS_SCRIPT>
297+
298+
Supplies Yosys with a .ys script file (similar to Tcl script), including the synthesis steps.
299+
300+
**Default:** None
301+
302+
.. option:: -parser <PARSER>
303+
304+
Specify a parser for the Yosys synthesizer [yosys (Verilog-2005), surelog (UHDM), yosys-plugin (SystemVerilog)].
305+
The script uses the Yosys conventional Verilog parser if this argument is not used.
306+
307+
**Default:** yosys
308+
309+
.. note::
310+
311+
Universal Hardware Data Model (UHDM) is a complete modeling of the IEEE SystemVerilog Object Model with VPI Interface, Elaborator, Serialization, Visitor and Listener.
312+
UHDM is used as a compiled interchange format in between SystemVerilog tools.
313+
The ``yosys-plugins`` parser, which represents the ``read_systemverilog`` command, reads SystemVerilog files directly in Yosys.
314+
It executes Surelog with provided filenames and converts them (in memory) into UHDM file. Then, this UHDM file is converted into Yosys AST. `[Yosys-SystemVerilog] <https://github.com/antmicro/yosys-systemverilog#usage>`_
315+
On the other hand, the ``surelog`` parser, which uses the ``read_uhdm`` Yosys command, walks the design tree and converts its nodes into Yosys AST nodes using Surelog. `[UHDM-Yosys <https://github.com/chipsalliance/UHDM-integration-tests#uhdm-yosys>`_, `Surelog] <https://github.com/chipsalliance/Surelog#surelog>`_

0 commit comments

Comments
 (0)