@@ -5,62 +5,128 @@ repository contains source files (e.g., LEF/DEF, Verilog, SDC, Liberty,
55RC extraction) and configuration files (e.g. ` config.mk ` ) that enable the user to run
66a small set of example designs through our complete RTL-to-GDS flow.
77
8- To keep track of the quality of the results, we maintain inside each
9- design folder two files :
8+ To keep track of the quality of the results, each design directory holds a
9+ rules file that gates the flow :
1010
11- 1 . ` metadata-base-ok.json ` which contains all the relevant
12- information extracted from the "golden" execution of the flow (i.e.,
13- last known good result).
11+ ``` text
12+ flow/designs/<platform>/<design>/rules-base.json
13+ ```
14+
15+ The file name comes from ` RULES_JSON ` , defined in
16+ [ ` flow/util/utils.mk ` ] ( https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts/blob/master/flow/util/utils.mk ) :
17+
18+ ``` makefile
19+ export RULES_JSON ?= $(DESIGN_DIR ) /rules-$(FLOW_VARIANT ) .json
20+ ```
21+
22+ `FLOW_VARIANT` defaults to `base`, which is why the committed file is
23+ `rules-base.json`. A run with a non-default `FLOW_VARIANT` looks for
24+ `rules-<variant>.json`, or you can point `RULES_JSON` at any file explicitly.
25+
26+ Each entry in the rules file is a metric name, a reference value, and a
27+ comparison operator. For example :
28+
29+ ``` json
30+ {
31+ "synth__design__instance__area__stdcell" : {
32+ "value" : 43.1,
33+ "compare" : "<="
34+ },
35+ "detailedplace__design__violations" : {
36+ "value" : 0,
37+ "compare" : "=="
38+ }
39+ }
40+ ```
1441
15- 2 . ` rules.json ` which holds a set of rules that we use to
16- evaluate new executions when a change is made .
42+ An entry may also carry ` "level": "warning" ` , which reports a mismatch without
43+ failing the build .
1744
18- ## Checking against golden
45+ The values a run is measured against are collected by
46+ ` flow/util/genMetrics.py ` into ` $(REPORTS_DIR)/metadata.json `
47+ (` reports/<platform>/<design>/<variant>/metadata.json ` ). That file is generated
48+ output — it is not committed. ` flow/util/checkMetadata.py ` compares it against
49+ the rules file.
1950
20- The evaluation checks for key metrics (e.g., worst slack, number of
21- DRCs) to ensure that changes do not degrade too much with respect to the
22- "golden" values.
51+ ## Checking against the rules
2352
24- After you make a significant change, e.g., fixing a bug in a piece of
25- code, or changing some configuration variable
26- (` PLACE_DENSITY ` ), you should review the results and compare
27- them with the "golden". To perform the check, you will need to run the
28- following command:
53+ The evaluation checks key metrics (e.g., worst slack, number of DRCs) to
54+ ensure that changes do not degrade the results.
55+
56+ After you make a significant change — e.g., fixing a bug in a piece of code, or
57+ changing a configuration variable such as ` PLACE_DENSITY ` — review the results
58+ and compare them against the rules. To perform the check, run:
2959
3060``` shell
3161cd OpenROAD-flow-scripts/flow
32- # the clean_metadata is only required if you need to re-run
62+ # clean_metadata is only required if you need to re-run the check
3363make [clean_metadata] metadata
3464```
3565
36- If the command above yields any error message, please review to
37- make sure the change in metrics is expected and justifiable. If so,
38- proceed to the next section to update the "golden" reference.
66+ ` make metadata ` runs three steps in order: ` finish ` (the full flow),
67+ ` metadata-generate ` (write ` metadata.json ` ), and ` metadata-check ` (compare it
68+ against ` RULES_JSON ` ). The check log is written to
69+ ` $(REPORTS_DIR)/metadata-check.log ` .
70+
71+ If you only changed synthesis, you can gate a synthesis-only run against the
72+ synthesis subset of the same rules file, without running the rest of the flow:
73+
74+ ``` shell
75+ make metadata-synth
76+ ```
77+
78+ If the check reports any error, review it to make sure the change in metrics is
79+ expected and justifiable. If so, proceed to the next section to update the
80+ reference values.
3981
4082## Update process
4183
42- Update of the reference files is mandatory if any metrics became worse
43- than the values limited by the ` rules.json ` (see previous
44- section on how to perform the check). Also, it is a good idea to update
45- the "golden" files if your changes have improved a metric, to ensure that
46- the improvement will not be lost in the future.
84+ Updating the rules file is mandatory if a metric became worse than the value
85+ allowed by ` rules-base.json ` (see the previous section on how to perform the
86+ check). It is also a good idea to update it when your change improves a metric,
87+ so that the improvement is not silently lost later.
4788
48- To update all the reference files:
89+ To update the rules file for a design, from a tree that has just been measured
90+ (so ` metadata.json ` exists):
4991
5092``` shell
5193cd OpenROAD-flow-scripts/flow
5294make update_ok
5395```
5496
55- In case you have a special reason to only update one of the files, you
56- can do so with the following commands:
97+ ` update_ok ` is an alias for ` update_rules ` . It runs ` flow/util/genRuleFile.py `
98+ with ` --failing --tighten ` , which:
99+
100+ - relaxes rules the current run fails, using the measured value plus a margin,
101+ so that small run-to-run variation does not break the flow; and
102+ - tightens rules the current run passes by a wide margin, so improvements are
103+ locked in.
104+
105+ The new file is written to ` $(REPORTS_DIR)/rules.json ` and then copied over
106+ ` $(RULES_JSON) ` — that copy is the file you commit.
107+
108+ If you need to overwrite every rule from the current run rather than only the
109+ failing and improved ones, use:
57110
58111``` shell
59- # update metadata-base-ok.json file for the design
60- make update_metadata
112+ make update_rules_force
113+ ```
114+
115+ This runs ` genRuleFile.py --update ` . Prefer ` make update_ok ` ; use the forced
116+ variant only when the metric set itself changed.
61117
62- # update rules.json file for the design
63- # this will use the current (+ a padding) metadata-base-ok.json
64- # the padding ensures that small changes do not break the flow
65- make update_rules
118+ ## Reference metadata (` metadata-<variant>-ok.json ` )
119+
120+ There is a second, optional file per design:
121+
122+ ``` shell
123+ # writes flow/designs/<platform>/<design>/metadata-base-ok.json
124+ make update_metadata
66125```
126+
127+ This copies the current ` metadata.json ` next to the design as
128+ ` metadata-$(FLOW_VARIANT)-ok.json ` . It is ** not** what gates the flow — nothing
129+ in ` make metadata ` reads it. It is consumed only by
130+ ` flow/util/genReportTable.py ` when building the golden-vs-current report table,
131+ and almost no design commits one. Update the rules file, not this one, unless
132+ you are specifically working on that report.
0 commit comments