Skip to content

Commit

Permalink
Merge branch 'dev' into add-or-lef-write-option
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Sep 23, 2024
2 parents 12b8c52 + 13cd748 commit 84c18e3
Show file tree
Hide file tree
Showing 48 changed files with 2,222 additions and 1,185 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ omit =
*/steps/netgen.py
*/steps/odb.py
*/steps/openroad.py
*/steps/pyosys.py
*/steps/yosys.py
*/steps/verilator.py
*/steps/cvc_rv.py
Expand Down
2 changes: 1 addition & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[mypy]
mypy_path = "./mypy_stubs"
exclude = venv|build|odbpy|scripts/klayout|docs|designs|setup.py|test|sandbox
exclude = venv|build|odbpy|scripts/klayout|scripts/pyosys|docs|designs|setup.py|test|sandbox
11 changes: 10 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
## Documentation
-->

# 2.1.8

## Steps

* `OpenROAD.STA*PnR`

* Fixed a bug in STA metrics where paths with exactly zero slack are counted
as violations

# 2.1.7

## Steps
Expand All @@ -29,7 +38,7 @@
## Steps

* `Yosys.Synthesis`

* Fixed bug where `hilomap` command was invoked incorrectly (thanks @htfab!)

# 2.1.5
Expand Down
31 changes: 20 additions & 11 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
nix-gitignore,
# Tools
klayout,
klayout-pymod,
libparse,
magic-vlsi,
netgen,
Expand All @@ -43,6 +42,7 @@
click,
cloup,
pyyaml,
yamlcore,
rich,
requests,
pcpp,
Expand All @@ -57,6 +57,21 @@
ioplace-parser,
poetry-core,
}: let
yosys-env = yosys.withPlugins ([
yosys-sby
yosys-eqy
yosys-lighter
yosys-synlig-sv
yosys-f4pga-sdc
]
++ lib.optionals (builtins.elem system ["x86_64-linux" "x86_64-darwin"]) [yosys-ghdl]);
openroad-env = openroad.withPythonPackages (ps:
with ps; [
click
rich
pyyaml
ioplace-parser
]);
self = buildPythonPackage {
pname = "openlane";
version = (builtins.fromTOML (builtins.readFile ./pyproject.toml)).tool.poetry.version;
Expand All @@ -69,16 +84,9 @@
];

includedTools = [
(yosys.withPlugins ([
yosys-sby
yosys-eqy
yosys-lighter
yosys-synlig-sv
yosys-f4pga-sdc
]
++ lib.optionals (system == "x86_64-linux") [yosys-ghdl]))
opensta-stable
openroad
yosys-env
openroad-env
klayout
netgen
magic-vlsi
Expand All @@ -95,6 +103,7 @@
click
cloup
pyyaml
yamlcore
rich
requests
pcpp
Expand All @@ -104,7 +113,7 @@
deprecated
libparse
psutil
klayout-pymod
klayout.pymod
rapidfuzz
ioplace-parser
]
Expand Down
64 changes: 42 additions & 22 deletions docs/source/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

Unless the design uses the API directly, each OpenLane-compatible design must
come with a configuration file. These configuration files can be written in one
of two grammars: JSON or Tcl.
of three grammars: JSON, YAML or Tcl.

Tcl offers more flexibility at the detriment of security, while JSON is more
straightforward at the cost of flexibility. While Tcl allows you to do all
manner of computation on your variables, JSON has a limited expression engine
that will be detailed later in this document. Nevertheless, for security (and
future-proofing), we recommend you use either the JSON format or write Python
scripts using the API.
Tcl offers more flexibility at the detriment of security, while YAML/JSON are
more straightforward at the cost of flexibility. While Tcl allows you to do all
manner of computation on your variables, YAML/JSON have a limited expression
engine that will be detailed later in this document. Nevertheless, for security
(and future-proofing), we recommend you use either the YAML/JSON format or write
Python scripts using the API.

The folder containing your `config.tcl`/`config.json` is known as the **Design
The folder containing your `config.{tcl/yml/yaml/json}` is known as the **Design
Directory** -- though the design directory can also be set explicitly over the
command-line using `--design-dir`. The design directory is special in that paths
in the JSON configuration files can be resolved relative to this directory and
Expand All @@ -24,17 +24,17 @@ enabling you to do complex pre-processing far beyond the capacity of either
JSON or Tcl files. You can still use `ref::` and such like JSON files though.
```

## JSON
## JSON/YAML

The JSON files are simple key-value pairs.
The JSON and YAML files are simple key-value pairs.

<a name="scalars"></a>

The values can be scalars (strings, numbers, Booleans, and `null`s), lists or
dictionaries, subject to validation.

All files must be ECMA404-compliant, i.e., pure JSON with no extensions such as
comments or the new elements introduced in [JSON5](https://json5.org/).
All JSON files must be ECMA404-compliant, i.e., pure JSON with no extensions
such as comments or the new elements introduced in [JSON5](https://json5.org/).

An minimal demonstrative configuration file would look as follows:

Expand All @@ -49,23 +49,43 @@ An minimal demonstrative configuration file would look as follows:
"FP_CORE_UTIL": 40,
"PL_TARGET_DENSITY_PCT": "expr::($FP_CORE_UTIL + 10.0)",
"scl::sky130_fd_sc_hd": {
"CLOCK_PERIOD": 15
"CLOCK_PERIOD": 15.0
}
}
}
```

All YAML files must conform to the
[YAML 1.2 specification](https://yaml.org/spec/1.2.2/). Scalar types are deduced
according to the
[YAML 1.2 Core Schema](https://yaml.org/spec/1.2.2/#103-core-schema).

An minimal demonstrative configuration file would look as follows:

```yml
DESIGN_NAME: spm
VERILOG_FILES: dir::src/*.v
CLOCK_PORT: clk
CLOCK_PERIOD: 100
pdk::sky130A:
MAX_FANOUT_CONSTRAINT: 6
FP_CORE_UTIL: 40
PL_TARGET_DENSITY_PCT: expr::($FP_CORE_UTIL + 10.0)
scl::sky130_fd_sc_hd:
CLOCK_PERIOD: 15.0
```
### Pre-processing
The JSON files are pre-processed at runtime. Features include conditional
JSON/YAML files are pre-processed at runtime. Features include conditional
execution, a way to reference the design directory, other variables, and a basic
numeric expression engine.
#### Conditional Execution
The JSON configuration files support conditional execution based on PDK or
standard cell library (or, by nesting as shown above, a combination thereof.)
You can do this using the `pdk::` or `scl::` key prefixes.
The configuration files support conditional execution based on PDK or standard
cell library (or, by nesting as shown above, a combination thereof.) You can do
this using the `pdk::` or `scl::` key prefixes.

The value for this key would be a `dict` that is only evaluated if the PDK or
SCL matches those in the key, i.e., for `pdk::sky130A` as shown above, this
Expand Down Expand Up @@ -135,9 +155,9 @@ reference a variable that is declared after the current expression.
> it is declared, but the latter is OK, where the value will be "vdd gnd" as
> well.

Do note that unlike Tcl config files, environment variables (other than
`DESIGN_DIR`, `PDK`, `PDKPATH`, `STD_CELL_LIBRARY`) are not exposed to
`config.json` by default.
Do note that unlike Tcl config files, environment variables are not exposed to
`config.{yml/yaml/json}` by default. You only have access to four specific
variables: `DESIGN_DIR`, `PDK`, `PDKPATH`, and `STD_CELL_LIBRARY`.

If the files you choose lie **inside** the design directory, a different prefix,
`refg::`, supports non-recursive globs, i.e., you can use an asterisk as a
Expand All @@ -150,8 +170,8 @@ wildcard to pick multiple files in a specific folder.
* If no elements were found, the glob string is returned verbatim as a single
element in array.

As shown below, `refg::$DESIGN_DIR/src/*.v` would find all files ending with `.v`
in the `src` folder inside the design directory.
As shown below, `refg::$DESIGN_DIR/src/*.v` would find all files ending with
`.v` in the `src` folder inside the design directory.

```json
{
Expand Down
7 changes: 4 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 35 additions & 24 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
};

inputs = {
nix-eda.url = github:efabless/nix-eda;
# TEMPORARY: Until https://github.com/YosysHQ/yosys/pull/4553 is merged
## DO NOT MERGE TO main WHILE WE'RE STILL ON A BRANCH OF NIX-EDA
nix-eda.url = github:efabless/nix-eda/yosys_python_flag;
libparse.url = github:efabless/libparse-python;
ioplace-parser.url = github:efabless/ioplace_parser;
volare.url = github:efabless/volare;
Expand Down Expand Up @@ -58,29 +60,38 @@
nix-eda.forAllSystems {
current = self;
withInputs = [nix-eda ioplace-parser libparse volare];
} (util:
with util;
rec {
mdformat = pkgs.python3.pkgs.mdformat.overridePythonAttrs (old: {
patches = [
./nix/patches/mdformat/donns_tweaks.patch
];
doCheck = false;
});
colab-env = callPackage ./nix/colab-env.nix {};
opensta = callPackage ./nix/opensta.nix {};
opensta-stable = callPackage ./nix/opensta.nix {
rev = "cc9eb1f12a0d5030aebc1f1428e4300480e30b40";
sha256 = "sha256-/ShPD4xWq3lkN0Z3uONKm7i9eqbT+IU41UF7yIvDJy4=";
};
openroad-abc = callPackage ./nix/openroad-abc.nix {};
openroad = callPythonPackage ./nix/openroad.nix {};
openlane = callPythonPackage ./default.nix {};
sphinx-tippy = callPythonPackage ./nix/sphinx-tippy.nix {};
sphinx-subfigure = callPythonPackage ./nix/sphinx-subfigure.nix {};
default = openlane;
}
// (pkgs.lib.optionalAttrs (pkgs.stdenv.isLinux) {openlane-docker = callPackage ./nix/docker.nix {createDockerImage = nix-eda.createDockerImage;};}));
} (
util: let
self = with util;
{
mdformat = pkgs.python3.pkgs.mdformat.overridePythonAttrs (old: {
patches = [
./nix/patches/mdformat/donns_tweaks.patch
];
doCheck = false;
});
colab-env = callPackage ./nix/colab-env.nix {};
opensta = callPackage ./nix/opensta.nix {};
opensta-stable = callPackage ./nix/opensta.nix {
rev = "cc9eb1f12a0d5030aebc1f1428e4300480e30b40";
sha256 = "sha256-/ShPD4xWq3lkN0Z3uONKm7i9eqbT+IU41UF7yIvDJy4=";
};
openroad-abc = callPackage ./nix/openroad-abc.nix {};
openroad = callPythonPackage ./nix/openroad.nix {
inherit (nix-eda) buildPythonEnvForInterpreter;
};
sphinx-tippy = callPythonPackage ./nix/sphinx-tippy.nix {};
sphinx-subfigure = callPythonPackage ./nix/sphinx-subfigure.nix {};
yamlcore = callPythonPackage ./nix/yamlcore.nix {};

# ---
openlane = callPythonPackage ./default.nix {};
default = self.openlane;
}
// (pkgs.lib.optionalAttrs (pkgs.stdenv.isLinux) {openlane-docker = callPackage ./nix/docker.nix {createDockerImage = nix-eda.createDockerImage;};});
in
self
);

devShells = nix-eda.forAllSystems {withInputs = [self devshell nix-eda ioplace-parser libparse volare];} (
util:
Expand Down
32 changes: 17 additions & 15 deletions nix/openroad.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,13 @@
bison,
clang-tools_14,
ioplace-parser,
buildEnv,
makeBinaryWrapper,
buildPythonEnvForInterpreter,
rev ? "b16bda7e82721d10566ff7e2b68f1ff0be9f9e38",
sha256 ? "sha256-+JGyX81Km2XidptA3k1Y5ZPwv+4Ed39LCsPfIHWd6ac=",
}: let
pyenv = python3.withPackages (p:
with p; [
click
rich
pyyaml
ioplace-parser
]);
pyenv-sitepackages = "${pyenv}/${pyenv.sitePackages}";
in
clangStdenv.mkDerivation (finalAttrs: {
self = clangStdenv.mkDerivation (finalAttrs: {
name = "openroad";
inherit rev;

Expand Down Expand Up @@ -98,7 +92,7 @@ in
boost183
eigen
tcl
pyenv
python3
readline
tclreadline
spdlog-internal-fmt
Expand Down Expand Up @@ -132,9 +126,15 @@ in
export DEVSHELL_CMAKE_FLAGS="${builtins.concatStringsSep " " finalAttrs.cmakeFlagsAll}"
'';

qtWrapperArgs = [
"--prefix PYTHONPATH : ${pyenv-sitepackages}"
];
passthru = {
inherit python3;
withPythonPackages = buildPythonEnvForInterpreter {
target = self;
inherit lib;
inherit buildEnv;
inherit makeBinaryWrapper;
};
};

meta = with lib; {
description = "OpenROAD's unified application implementing an RTL-to-GDS flow";
Expand All @@ -144,4 +144,6 @@ in
license = licenses.gpl3Plus;
platforms = platforms.linux ++ platforms.darwin;
};
})
});
in
self
14 changes: 0 additions & 14 deletions nix/patches/yosys/abc-editline.patch

This file was deleted.

Loading

0 comments on commit 84c18e3

Please sign in to comment.