|
| 1 | +**This synthesis flow is experimental and under development, it does not produce |
| 2 | +tape-out quality netlists and area/timing numbers it generates are not |
| 3 | +representative of what would be achievable with a tape-out quality flow** |
| 4 | + |
| 5 | +# Yosys/OpenSTA Ibex Synthesis Flow |
| 6 | + |
| 7 | +This is a synthesis-only implementation flow using Yosys for Synthesis and |
| 8 | +OpenSTA 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 | + |
| 21 | +Yosys doesn't yet support the full subset of SystemVerilog used by Ibex so the |
| 22 | +sv2v tool is used to first convert the Ibex RTL into the SystemVerilog subset |
| 23 | +Yosys can process. |
| 24 | + |
| 25 | +# Synthesis flow requirements |
| 26 | + |
| 27 | +The 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 | + |
| 34 | +The flow was tested with yosys 0.9 and OpenSTA 2.2 but may work with other |
| 35 | +versions. A standard cell library is also required in the liberty (.lib) |
| 36 | +format. The following Open Libraries can be used: |
| 37 | + |
| 38 | +* Nangate45 - https://github.com/The-OpenROAD-Project/OpenROAD-flow/tree/master/flow/platforms/nangate45 |
| 39 | + |
| 40 | +# Synthesis flow setup |
| 41 | + |
| 42 | +The synthesis flow is configured via environment variables. The `syn_setup.sh` |
| 43 | +file is used to set the environment variables for the flow and any changes made |
| 44 | +should be placed there. An example `syn_setup.example.sh` is included. A copy |
| 45 | +of this named `syn_setup.sh` must be made and the values in it set appropriately |
| 46 | +for the flow to work. |
| 47 | + |
| 48 | +The 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 | + |
| 59 | +Once `syn_setup.sh` has been created, call `syn_yosys.sh` to run the entire |
| 60 | +flow. 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` |
| 63 | + |
| 64 | +- `syn/syn_out/ibex_date` |
| 65 | + - `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 |
| 75 | + - 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 |
| 79 | + file |
| 80 | + |
| 81 | +If you wish to change the results directory naming or location edit |
| 82 | +`syn_setup.sh` appropriately. |
| 83 | + |
| 84 | +# Timing constraints |
| 85 | + |
| 86 | +Two files specify the timing constraints and timing related settings for the |
| 87 | +flow. These are used to generate a single .sdc file |
| 88 | + |
| 89 | +* `ibex_top_lr_synth_core.tcl` - This specifies the constraints on all inputs |
| 90 | + 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 | + |
| 98 | +Timing 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 |
| 102 | +* 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 |
| 105 | + |
| 106 | +They are available in two formats .rpt and .csv.rpt. The .rpt is the full output |
| 107 | +from OpenSTA and gives the full path between the start and end points. The CSV |
| 108 | +version contains the start-point, end-point and WNS (one path per line). CSV |
| 109 | +reports 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 |
| 111 | +only generated cell names so will require further netlist inspection (via Yosys |
| 112 | +or simply looking at the netlist .v) to make sense of. |
| 113 | + |
| 114 | +# Post-synthesis inspection |
| 115 | + |
| 116 | +Both Yosys and OpenSTA can be run to perform further inspection on the generated |
| 117 | +synthesis. TCL is provided to setup the tools appropriately. |
| 118 | + |
| 119 | +First the environment variables must be setup for the flow and the directory |
| 120 | +containing 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 | + |
| 126 | +Where `syn_out_06_01_2020_11_19_15/` is directory containing the synthesis |
| 127 | +outputs. 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 | + |
| 132 | +So to load the post-synthesis netlist in Yosys: |
| 133 | + |
| 134 | +``` |
| 135 | +$ yosys |
| 136 | +yosys> tcl ./tcl/yosys_post_synth.tcl |
| 137 | +``` |
| 138 | + |
| 139 | +To open the design in OpenSTA |
| 140 | + |
| 141 | +``` |
| 142 | +$ sta |
| 143 | +% source ./tcl/sta_open_design.tcl |
| 144 | +``` |
| 145 | + |
0 commit comments