Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fix-clock-propagationg
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Jul 18, 2024
2 parents f8df8d2 + d2d8db9 commit 21f0c4a
Show file tree
Hide file tree
Showing 39 changed files with 541 additions and 334 deletions.
99 changes: 99 additions & 0 deletions .github/scripts/add_openroad_overrides.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Copyright 2024 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import re
import argparse
import subprocess
import sys
import json
import os


def get_submodule_revs(filter, repository, commit):
api_result = None
filter = re.compile(filter)

try:
api_result = subprocess.check_output(
[
"curl",
"--fail",
"-s",
"-L",
"-H",
"Accept: application/vnd.github.v3+json",
f"https://api.github.com/repos/{repository}/git/trees/{commit}?recursive=True",
]
)
except Exception as e:
print(e, file=sys.stderr)
sys.exit(os.EX_DATAERR)

api_result_parsed = json.loads(api_result)
api_result_tree = api_result_parsed["tree"]
submodules = [element for element in api_result_tree if element["type"] == "commit"]
return {
submodule["path"]: submodule["sha"]
for submodule in submodules
if filter.search(submodule["path"])
}


def override_openroad_versions(commit):
info = {
"openroad": {
"rev": commit,
"repo": "The-OpenROAD-Project/OpenROAD",
}
}
submodule_revs = get_submodule_revs(r"sta|abc", info["openroad"]["repo"], commit)
info["opensta"] = {
"rev": submodule_revs["src/sta"],
"repo": "The-OpenROAD-Project/OpenSTA",
}
info["openroad-abc"] = {
"rev": submodule_revs["third-party/abc"],
"repo": "The-OpenROAD-Project/abc",
}
for derivation, info in info.items():
prefetch_info = subprocess.check_output(
[
"nix",
"run",
"github:seppeljordan/nix-prefetch-github",
"--",
"--rev",
info["rev"],
]
+ info["repo"].split("/"),
encoding="utf8",
)
prefetch_info_json = json.loads(prefetch_info)
hash = prefetch_info_json["hash"]
subprocess.check_call(
[
"sed",
"-i.bak",
f"s/# {derivation}-rev-sha/rev = \"{info['rev']}\"; sha256 = \"{hash}\";/",
"flake.nix",
]
)


if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Adds overrides for a given OpenROAD commit hash to flake.nix. Requires Nix with Flakes+Nix-Command enabled as well as curl and GNU sed."
)
parser.add_argument("commit", help="commit hash")
args = parser.parse_args()
override_openroad_versions(args.commit)
1 change: 1 addition & 0 deletions .github/scripts/update_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

tools = Tool.from_metadata_yaml(open(metadata_path).read())


# Handle Multiline Strings Properly / https://stackoverflow.com/a/33300001
def represent_str(dumper: yaml.Dumper, data: str):
if "\n" in data:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ pdks/
/install

# Venv
/venv
/venv

sandbox
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<p align="center">
<a href="https://github.com/efabless/openlane2">
<img src="./docs/_static/ol2_banner.png" style="width: 70%;overflow: visible" alt="Banner explaining that OpenLane is currently only for hardening Caravel User Project-based designs targeting chipIgnite"/>
</a>
</p>

<h1 align="center">OpenLane</h1>
<p align="center">
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0"/></a>
Expand All @@ -10,12 +16,6 @@ OpenLane is an automated RTL to GDSII flow based on several components including

You can check out the documentation, including in-depth guides and reference manuals at [ReadTheDocs](https://openlane.readthedocs.io/).

<p align="center">
<a href="https://github.com/efabless/openlane2">
<img src="./docs/_static/ol2_banner.svg" alt="Banner promoting OpenLane 2"/>
</a>
</p>

## Installation, the short version
The short version is, to install the OpenLane environment...

Expand Down
74 changes: 39 additions & 35 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,33 @@
openroad,
klayout,
netgen,
magic,
magic-vlsi,
verilog,
verilator,
volare,
tclFull,
}:
let
pyenv = (python3.withPackages (ps: with ps; [
libparse
click
pyyaml
XlsxWriter
klayout-pymod
]));
}: let
pyenv = python3.withPackages (ps:
with ps; [
libparse
click
pyyaml
XlsxWriter
klayout-pymod
volare
]);
pyenv-sitepackages = "${pyenv}/${pyenv.sitePackages}";
in
stdenv.mkDerivation rec {
name = "openlane1";

src = [
./flow.tcl
./scripts
./configuration
./dependencies
];

unpackPhase = ''
echo $src
for file in $src; do
Expand All @@ -64,49 +66,51 @@ in
done
ls -lah
'';

passthru = {
pyenv = pyenv;
};

includedTools = [
yosys
opensta
openroad
klayout
netgen
magic
magic-vlsi
verilog
verilator
tclFull
];

propagatedBuildInputs = includedTools ++ [
pyenv
ncurses
coreutils-full
gnugrep
gnused
bash
gnutar
gzip
git
];


propagatedBuildInputs =
includedTools
++ [
pyenv
ncurses
coreutils-full
gnugrep
gnused
bash
gnutar
gzip
git
];

nativeBuildInputs = [makeWrapper];

installPhase = ''
mkdir -p $out/bin
cp -r * $out/bin
wrapProgram $out/bin/flow.tcl\
--set PATH ${lib.makeBinPath (propagatedBuildInputs)}\
--set PYTHONPATH ${pyenv-sitepackages}
--set PATH ${lib.makeBinPath propagatedBuildInputs}\
--set PYTHONPATH ${pyenv-sitepackages}
'';

doCheck = true;
computed_PATH = lib.makeBinPath (propagatedBuildInputs);

computed_PATH = lib.makeBinPath propagatedBuildInputs;

meta = with lib; {
description = "RTL-to-GDSII flow for application-specific integrated circuits (ASIC)s";
homepage = "https://efabless.com/openlane";
Expand Down
1 change: 1 addition & 0 deletions dependencies/includedyaml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import io


# ------------------------------------------------------------------------------
# XXX "Warnings control" is now deprecated. Leaving in the API function to not
# break code that uses it.
Expand Down
1 change: 1 addition & 0 deletions dependencies/includedyaml/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ def set_python_instance_state(self, instance, state):
UnsafeConstructor.construct_python_object_apply,
)


# Constructor is same as UnsafeConstructor. Need to leave this in place in case
# people have extended it directly.
class Constructor(UnsafeConstructor):
Expand Down
6 changes: 3 additions & 3 deletions dependencies/includedyaml/emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,9 @@ def analyze_scalar(self, scalar):
# Spaces followed by breaks, as well as special character are only
# allowed for double quoted scalars.
if space_break or special_characters:
allow_flow_plain = (
allow_block_plain
) = allow_single_quoted = allow_block = False
allow_flow_plain = allow_block_plain = allow_single_quoted = allow_block = (
False
)

# Although the plain scalar writer supports breaks, we never emit
# multiline plain scalars.
Expand Down
14 changes: 8 additions & 6 deletions dependencies/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ def from_metadata_yaml(metadata_yaml: str) -> Dict[str, "Tool"]:
commit=tool["commit"],
build_script=tool.get("build") or "",
default_branch=tool.get("default_branch") or None,
in_container=tool["in_container"]
if tool.get("in_container") is not None
else True,
in_install=tool["in_install"]
if tool.get("in_install") is not None
else True,
in_container=(
tool["in_container"]
if tool.get("in_container") is not None
else True
),
in_install=(
tool["in_install"] if tool.get("in_install") is not None else True
),
pdk=tool.get("pdk") or False,
)
return final_dict
Expand Down
3 changes: 2 additions & 1 deletion dependencies/verify_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ def verify_versions(
)

for name, commit in tool_versions:
print(name, commit)
if name not in manifest_dict:
continue
manifest_commit = manifest_dict[name]["commit"]

if commit != manifest_commit:
Expand Down
1 change: 0 additions & 1 deletion dependencies/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ def _legacy_cmpkey(version):


class Version(_BaseVersion):

_regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)

def __init__(self, version):
Expand Down
28 changes: 12 additions & 16 deletions docker/docker.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@
silver-searcher,
coreutils,
}:

assert builtins.elem system ["x86_64-linux" "aarch64-linux"];

let
docker-arch-name = if system == "x86_64-linux" then
"amd64"
else
"arm64v8"
;
assert builtins.elem system ["x86_64-linux" "aarch64-linux"]; let
docker-arch-name =
if system == "x86_64-linux"
then "amd64"
else "arm64v8";
in (createDockerImage {
inherit pkgs;
inherit lib;
Expand All @@ -53,7 +49,7 @@ in (createDockerImage {
};
maxLayers = 2;
channelURL = "https://nixos.org/channels/nixos-23.11";

image-created = "now";
image-extraCommands = ''
mkdir -p ./etc
Expand All @@ -63,7 +59,7 @@ in (createDockerImage {
autoload -U compinit && compinit
autoload -U promptinit && promptinit && prompt suse && setopt prompt_sp
autoload -U colors && colors
export PS1=$'%{\033[31m%}OpenLane Container%{\033[0m%}:%{\033[32m%}%~%{\033[0m%}%% ';
HEREDOC
'';
Expand All @@ -74,10 +70,10 @@ in (createDockerImage {
openlane1.computed_PATH
];
image-config-extra-env = [
"LANG=C.UTF-8"
"LC_ALL=C.UTF-8"
"LC_CTYPE=C.UTF-8"
"EDITOR=nvim"
"TMPDIR=/tmp"
"LANG=C.UTF-8"
"LC_ALL=C.UTF-8"
"LC_CTYPE=C.UTF-8"
"EDITOR=nvim"
"TMPDIR=/tmp"
];
})
Binary file removed docs/_static/eco_flow.png
Binary file not shown.
Binary file removed docs/_static/eco_results.png
Binary file not shown.
Binary file added docs/_static/flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/_static/flow_v1.png
Binary file not shown.
Binary file added docs/_static/ol2_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 21f0c4a

Please sign in to comment.