blob: 28695ca66f3c44ec98c8124a6a30deae7149322c [file] [log] [blame] [view]
Timothy Chene489c4a2021-04-15 12:08:01 -07001# OpenTitan Synthesis Flow
2
3This 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
7To 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
14This comment will invoke dvsim to run synthesis and terminate upon success or failure.
15The synthesis results are placed in the scratch area under `$SCRATCH_ROOT/{branch_name}/chip_earlgrey_asic-syn-dc/` for this example command.
16
17The main script that powers synthesis is `hw/syn/tools/dc/run-syn.tcl`.
18
Michael Schaffner9dc00702021-04-22 14:41:40 -070019To 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
21For example, overall status can be observed with
22```
23tail -f `$SCRATCH_ROOT/{branch_name}/chip_earlgrey_asic-syn-dc/default/synthesis.log`
24```
25
26Another example would be the elaboration status
27```
28tail -f `$SCRATCH_ROOT/{branch_name}/chip_earlgrey_asic-syn-dc/default/REPORTS/elab.rpt`
29```
30
Timothy Chene489c4a2021-04-15 12:08:01 -070031## Re-run Interactive Synthesis
32
33Assuming 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
35When 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
37To 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
45The above command opens dc_shell in the scratch area.
46Once 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
54Now, synthesis will begin again but will not exit dc_shell upon completion.
55If you do not wish for synthesis to run that far, `run_syn.tcl` can be directly modified to add or skip steps.
Timothy Cheneb475862021-04-29 13:02:12 -070056
57
58## Loading DDC After Synth Completion
59If 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
67The above command opens dc_shell in the scratch area.
68Once 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
78This will begin reading in the libraries and load up the database for further analysis / experiments.