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