Skip to content

Commit 43f9bb6

Browse files
authored
Merge pull request #3247 from Pinata-Consulting/docs-variables-background
docs: flow variables background
2 parents 4d7025b + 55a74b0 commit 43f9bb6

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

docs/user/FlowVariables.md

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,48 @@
1-
# Environment Variables for the OpenROAD Flow Scripts
1+
# Variables for the OpenROAD Flow Scripts
22

3-
4-
Environment variables are used in the OpenROAD flow to define various
3+
Variables are used in the OpenROAD flow to define various
54
platform, design and tool specific variables to allow finer control and
6-
user overrides at various flow stages. These are defined in the
7-
`config.mk` file located in the platform and design specific directories.
5+
user overrides at various flow stages.
6+
7+
These are normally defined in the `config.mk` file located in the platform and design-specific directories, but can also be defined on the command line or via environment variables. For example:
8+
9+
- Command line: `make PLACE_DENSITY=0.5`
10+
- Environment variable: `export PLACE_DENSITY=0.5`
11+
12+
This works provided that `config.mk` has defined it as a default value using the `export PLACE_DENSITY?=0.4` syntax.
13+
14+
The actual value used is determined by the priority rules set by `make`:
15+
16+
1. **Makefile Definitions**: Variables defined in the `Makefile` or included files are used when they are defined using the no-override `=` operator, `export PLACE_DENSITY=0.4` syntax. The priority within the included files is the `DESIGN_CONFIG` file, then `Makefile` definitions and finally platform(PDK) defined variables.
17+
2. **Command Line**: Variables defined on the command line take the highest priority in overriding defaults.
18+
3. **Environment Variables**: Variables exported in the shell environment are used if not overridden by the command line.
19+
4. **Default Values**: Variables defined with the `?=` operator in the `Makefile` are used only if the variable is not already defined elsewhere.
20+
21+
## Effects of variables
22+
23+
The variables for ORFS are not fully independent and can interact in complex ways. Small changes to a combination of variables can have large consequences, such as on macro placement, which can lead to vastly different quality of results.
24+
25+
Due to the large number of variables, some of which are continuous and require long runtimes, other discrete, it is not feasible to perform an exhaustive end-to-end search for the best combination of variables.
26+
27+
Instead, the following approaches are used to determine reasonable values, up to a point of diminishing returns:
28+
29+
- **Experience**: Leveraging domain expertise to set initial values.
30+
- **AI**: Using machine learning techniques to explore variable combinations.
31+
- **Parameter Sweeps**: Testing a smaller subset of variables to identify optimal ranges.
32+
33+
These values are then set in configuration files and kept under source control alongside the RTL input.
34+
35+
## Types of variables
36+
37+
Variables values are set in ORFS scripts or `config.mk` files and are kept in source control together with configuration files and RTL.
38+
39+
It is an ongoing effort to move variables upwards in the categories below.
40+
41+
| Category | Definition | User Involvement | Examples | Automation Potential | Notes |
42+
|--------------------|----------------------------------------------------------------------------|----------------------------------------|-----------------------------------------|-----------------------------|-----------------------------------------------------------------------|
43+
| **Trivial** | Automatically determined by tool with near-optimal results. | None (unless debugging) | Buffer sizing, default layers | **High** – can be hidden | Best if invisible; surfaced only in debug or verbose mode. |
44+
| **Easy** | Requires input, but easy to tune using reports or visuals. | Moderate – copy/edit from reports | `PLACE_DENSITY` | **Medium–High** | Smooth response curves, intuitive tuning. |
45+
| **Complex** | Small changes in values may result in large effects. | High – requires multiple runs/sweeps | `CTS_DISTANCE_BUF`, small changes can have large effects on skew and quality of results. Small changes to independent inputs, such as RTL, can invalidate earlier "good values". | **Low–Medium** | Needs scripted sweeps and statistical evaluation. |
846

947
## Platform
1048

@@ -20,7 +58,7 @@ variable. For OpenROAD Flow Scripts we have the following public platforms:
2058
- `nangate45`
2159
- `asap7`
2260

23-
## Platform Specific Environment Variables
61+
## Platform Specific Variables
2462

2563

2664
The table below lists the complete set of variables used in each of the

0 commit comments

Comments
 (0)