blob: 4f2a37b2ddb5d82c24ff68c0f70fd70ba9140110 [file] [log] [blame] [view]
Michael Schaffner1aa79bb2020-01-15 17:18:20 -08001**This synthesis flow is experimental and under development, it does not produce
2tape-out quality netlists and area/timing numbers it generates are not
3representative of what would be achievable with a tape-out quality flow**
4
5# Yosys/OpenSTA Ibex Synthesis Flow
6
7This is a synthesis-only implementation flow using Yosys for Synthesis and
8OpenSTA to produce timing reports. Its outputs are:
9
10* A pre-mapping netlist - Gate-level verilog using generic gates that hasn't
11 been mapped to a standard-cell library yet
12* A post synthesis netlist - Gate-level verilog after optimisation mapped to a
13 standard-cell library
14* An STA netlist - Logically equivilent to the netlist above but with changes to
15 allow processing by OpenSTA
16* Area/Cell Usage report - Total area consumed by utilised cells and counts of
17 each cell instance used
18* Timing reports - Overal timing report and reports broken down into various
19 path groups (register to register paths and per IO reports)
20
21Yosys doesn't yet support the full subset of SystemVerilog used by Ibex so the
22sv2v tool is used to first convert the Ibex RTL into the SystemVerilog subset
23Yosys can process.
24
25# Synthesis flow requirements
26
27The following must be installed:
28
29* Python 3 (version >= 3.5)
30* sv2v - https://github.com/zachjs/sv2v
31* Yosys - https://github.com/YosysHQ/yosys
32* OpenSTA - https://github.com/The-OpenROAD-Project/OpenSTA
33
Tom Robertsbc7f6d62021-03-04 12:33:23 +000034The flow was tested with yosys 0.9 and OpenSTA 2.2 but may work with other
35versions. A standard cell library is also required in the liberty (.lib)
36format. The following Open Libraries can be used:
Michael Schaffner1aa79bb2020-01-15 17:18:20 -080037
38* Nangate45 - https://github.com/The-OpenROAD-Project/OpenROAD-flow/tree/master/flow/platforms/nangate45
39
40# Synthesis flow setup
41
42The synthesis flow is configured via environment variables. The `syn_setup.sh`
43file is used to set the environment variables for the flow and any changes made
44should be placed there. An example `syn_setup.example.sh` is included. A copy
45of this named `syn_setup.sh` must be made and the values in it set appropriately
46for the flow to work.
47
48The environment variables that must be set in `syn_setup.sh` are
49
50* `LR_SYNTH_CELL_LIBRARY_PATH` - The path to the standard cell library, this
51 should point to the absolute path of the Nangate45 library
52 (`NangateOpenCellLibrary_typical.lib`).
53* `LR_SYNTH_CELL_LIBRARY_NAME` - The name of the standard cell library, this is
54 used to alter the flow configuration for the library, currently 'nangate' is
55 the only supported value
56
57# Running the synthesis flow
58
Tom Robertsbc7f6d62021-03-04 12:33:23 +000059Once `syn_setup.sh` has been created, call `syn_yosys.sh` to run the entire
Greg Chadwick063e5cc2020-04-07 13:13:07 +010060flow. All outputs are placed under the `syn/syn_out` directory with the prefix
61`ibex_` with the current date/time forming the rest of the name, e.g.
62`syn/syn_out/ibex_06_01_2020_11_19_15`
Michael Schaffner1aa79bb2020-01-15 17:18:20 -080063
Greg Chadwick063e5cc2020-04-07 13:13:07 +010064- `syn/syn_out/ibex_date`
Michael Schaffner1aa79bb2020-01-15 17:18:20 -080065 - `reports` - All of the generated reports
66 - area.rpt - Total area used and per cell instance counts
67 - `timing`
68 - *.rpt - Raw reports from OpenSTA, gives full paths
69 - *.csv.rpt - CSV reports gives start and end point and slack
70 - `log`
71 - syn.log - Log of the Yosys run
72 - sta.log - Log of the OpenSTA run
73 - `generated`
74 - *.v - Ibex RTL after sv2v processing
Tom Roberts8317b032021-04-09 14:59:35 +010075 - ibex_top.pre_map.v - Pre-mapping synthesis netlists
76 - ibex_top_netlist.v - Post-synthesis netlist
77 - ibex_top_netlist.sta.v - Post-synthesis netlist usable by OpenSTA
78 - ibex_top.[library-name].out.sdc - Generated .sdc timing constraints
Michael Schaffner1aa79bb2020-01-15 17:18:20 -080079 file
80
Greg Chadwick063e5cc2020-04-07 13:13:07 +010081If you wish to change the results directory naming or location edit
82`syn_setup.sh` appropriately.
83
Michael Schaffner1aa79bb2020-01-15 17:18:20 -080084# Timing constraints
85
86Two files specify the timing constraints and timing related settings for the
87flow. These are used to generate a single .sdc file
88
Tom Roberts8317b032021-04-09 14:59:35 +010089* `ibex_top_lr_synth_core.tcl` - This specifies the constraints on all inputs
Michael Schaffner1aa79bb2020-01-15 17:18:20 -080090 and outputs as a fraction of a clock cycle, the names of the clock and reset
91 inputs and the desired clock period in ps
92* `ibex.[library-name].sdc` - Header to include in generated .sdc file. Settings
93 can be library dependent so the `LR_SYNTH_CELL_LIBRARY_NAME` environment
94 varible is used to supply the `[library-name]` part of the name
95
96# Timing reports
97
98Timing reports are produced for the following path groups
99* Overall - Every path in the design, WNS (worst negative slack) from this report is the design WNS
100 that limits the frequency
101* reg2reg - Paths from register to register
Tom Roberts50634972020-08-12 08:52:13 +0100102* in2reg - Paths from any input to any register
103* reg2out - Paths from any register to any output
104* in2out - Paths from any input to any output
Michael Schaffner1aa79bb2020-01-15 17:18:20 -0800105
106They are available in two formats .rpt and .csv.rpt. The .rpt is the full output
107from OpenSTA and gives the full path between the start and end points. The CSV
108version contains the start-point, end-point and WNS (one path per line). CSV
109reports have had their start and end points translated to human readable names
110(though this isn't 100% reliable). The raw OpenSTA reports generally contain
111only generated cell names so will require further netlist inspection (via Yosys
112or simply looking at the netlist .v) to make sense of.
113
114# Post-synthesis inspection
115
116Both Yosys and OpenSTA can be run to perform further inspection on the generated
117synthesis. TCL is provided to setup the tools appropriately.
118
119First the environment variables must be setup for the flow and the directory
120containing the synthesis output set. This can be done with `syn_setup.sh`
121
122```
123$ source syn_setup.sh syn_out_06_01_2020_11_19_15/
124```
125
126Where `syn_out_06_01_2020_11_19_15/` is directory containing the synthesis
127outputs. Then start Yosys or OpenSTA and run one of the provided TCL files
128
129* `./tcl/yosys_pre_map.tcl` - Loads the pre-mapping netlist
130* `./tcl/yosys_post_synth.tcl` - Load the post-synthesis netlist
131
132So to load the post-synthesis netlist in Yosys:
133
134```
135$ yosys
136yosys> tcl ./tcl/yosys_post_synth.tcl
137```
138
139To open the design in OpenSTA
140
141```
142$ sta
143% source ./tcl/sta_open_design.tcl
144```
145