Timothy Chen | e489c4a | 2021-04-15 12:08:01 -0700 | [diff] [blame] | 1 | # OpenTitan Synthesis Flow |
| 2 | |
| 3 | This readme gives some quick instructions on how to run synthesis in OpenTitan, using top_earlgrey as an example. |
| 4 | |
| 5 | ## Normal Synthesis Through dvsim |
| 6 | |
| 7 | To run synthesis through dvsim, use a command like the following: |
| 8 | |
| 9 | ``` |
| 10 | $ cd $REPO_TOP |
| 11 | $ ./util/dvsim/dvsim.py -t dc hw/top_earlgrey/syn/chip_earlgrey_asic_syn_cfg.hjson --purge --local |
| 12 | ``` |
| 13 | |
| 14 | This comment will invoke dvsim to run synthesis and terminate upon success or failure. |
| 15 | The synthesis results are placed in the scratch area under `$SCRATCH_ROOT/{branch_name}/chip_earlgrey_asic-syn-dc/` for this example command. |
| 16 | |
| 17 | The main script that powers synthesis is `hw/syn/tools/dc/run-syn.tcl`. |
| 18 | |
Michael Schaffner | 9dc0070 | 2021-04-22 14:41:40 -0700 | [diff] [blame] | 19 | To follow the progress of the different synthesis flow stages (analysis, elaboration, etc.), it is recommended to use the `tail -f` command on the report file of interest. |
| 20 | |
| 21 | For example, overall status can be observed with |
| 22 | ``` |
| 23 | tail -f `$SCRATCH_ROOT/{branch_name}/chip_earlgrey_asic-syn-dc/default/synthesis.log` |
| 24 | ``` |
| 25 | |
| 26 | Another example would be the elaboration status |
| 27 | ``` |
| 28 | tail -f `$SCRATCH_ROOT/{branch_name}/chip_earlgrey_asic-syn-dc/default/REPORTS/elab.rpt` |
| 29 | ``` |
| 30 | |
Timothy Chen | e489c4a | 2021-04-15 12:08:01 -0700 | [diff] [blame] | 31 | ## Re-run Interactive Synthesis |
| 32 | |
| 33 | Assuming the above synthesis steps produces an error or creates a situation where we must run synthesis interactively for debug, it can be done as follows. |
| 34 | |
| 35 | When the normal synthesis steps are run (see example above), an output file called `env_variables.tcl` is created in the synthesis scratch area, `$SCRATCH_ROOT/{branch_name}/chip_earlgrey_asic-syn-dc/default` in the above example. |
| 36 | |
| 37 | To re-run this synthesis interactively, do the following: |
| 38 | |
| 39 | ``` |
| 40 | $ cd $SCRATCH_ROOT/{branch_name}/chip_earlgrey_asic-syn-dc/default/syn-icarus |
| 41 | $ dc_shell |
| 42 | |
| 43 | ``` |
| 44 | |
| 45 | The above command opens dc_shell in the scratch area. |
| 46 | Once dc_shell is open, do the following: |
| 47 | |
| 48 | ``` |
| 49 | $ source ../env_variables.tcl |
| 50 | $ source $REPO_TOP/hw/syn/tools/dc/run-syn.tcl |
| 51 | |
| 52 | ``` |
| 53 | |
| 54 | Now, synthesis will begin again but will not exit dc_shell upon completion. |
| 55 | If you do not wish for synthesis to run that far, `run_syn.tcl` can be directly modified to add or skip steps. |
Timothy Chen | eb47586 | 2021-04-29 13:02:12 -0700 | [diff] [blame] | 56 | |
| 57 | |
| 58 | ## Loading DDC After Synth Completion |
| 59 | If a synthesis job has completed and you would like to reload the session for more details, follow the steps below |
| 60 | |
| 61 | ``` |
| 62 | $ cd $SCRATCH_ROOT/{branch_name}/chip_earlgrey_asic-syn-dc/default/syn-icarus |
| 63 | $ dc_shell |
| 64 | |
| 65 | ``` |
| 66 | |
| 67 | The above command opens dc_shell in the scratch area. |
| 68 | Once dc_shell is open, do the following: |
| 69 | |
| 70 | ``` |
| 71 | $ source ../env_variables.tcl |
| 72 | $ set foundry_root "$::env(foundry_root)" |
| 73 | $ source "${foundry_root}/syn/dc/setup.tcl" |
| 74 | $ read_ddc DDC/mapped.ddc |
| 75 | |
| 76 | ``` |
| 77 | |
| 78 | This will begin reading in the libraries and load up the database for further analysis / experiments. |