Skip to content

Commit dfa4265

Browse files
committed
build: add bazel-orfs beta test for design builds
Adds Bazel-based design builds via bazel-orfs as a beta test alongside the existing Make flow. Lets users build ORFS designs with Bazel using the same config.mk files. Key changes: - MODULE.bazel: pin bazel-orfs at 78f19f25cec7 with yosys-slang plugin for slang HDL frontend; pin tools/OpenROAD via local_path_override. - flow/scripts/variables.yaml: register LIB_MODEL, MIN_CLK_ROUTING_LAYER, SDC_FILE_EXTRA, SYNTH_NUM_PARTITIONS, MOCK_ALU_OPERATIONS, MOCK_ALU_WIDTH so designs that use them pass bazel-orfs variable validation. - flow/designs/**/BUILD.bazel: add orfs_design() entry points for all public-PDK designs across asap7, sky130hd, sky130hs, nangate45, gf180, ihp-sg13g2. - flow/designs/src/**/BUILD.bazel: filegroup/exports_files for design source trees referenced via VERILOG_FILES. - flow/scripts/run_command.py: strip Bazel runfiles env vars before spawning subprocesses so child make invocations don't inherit them. - bazel-orfs.md: usage documentation, target conventions, working/blocked designs, and known limitations. Bumps tools/OpenROAD submodule to latest origin/master (26Q2-876-g45b7772b73) for the openroad/qt-bazel/yosys-slang integration that the new bazel-orfs relies on. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent 10a2bae commit dfa4265

181 files changed

Lines changed: 6023 additions & 4014 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
build --incompatible_strict_action_env
2+
common --experimental_isolated_extension_usages
3+
build --cxxopt "-std=c++20" --host_cxxopt "-std=c++20"
24
try-import %workspace%/user.bazelrc

MODULE.bazel

Lines changed: 78 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,67 @@ module(
55
version = "0.0.1",
66
)
77

8+
# --- Regular dependencies ---
9+
10+
bazel_dep(name = "rules_python", version = "1.8.5")
11+
bazel_dep(name = "rules_shell", version = "0.6.1")
12+
bazel_dep(name = "toolchains_llvm", version = "1.5.0")
13+
14+
bazel_dep(name = "openroad")
15+
local_path_override(
16+
module_name = "openroad",
17+
path = "tools/OpenROAD",
18+
)
19+
20+
bazel_dep(name = "qt-bazel")
21+
git_override(
22+
module_name = "qt-bazel",
23+
commit = "886104974c2fd72439f2c33b5deebf0fe4649df7",
24+
remote = "https://github.com/The-OpenROAD-Project/qt_bazel_prebuilts",
25+
)
26+
827
bazel_dep(name = "bazel-orfs")
28+
bazel_dep(name = "bazel-orfs-verilog")
29+
30+
BAZEL_ORFS_COMMIT = "78f19f25cec73bdec3517a76465dec7ce17ce227"
31+
32+
BAZEL_ORFS_REMOTE = "https://github.com/The-OpenROAD-Project/bazel-orfs.git"
933

1034
# To bump version, run: bazelisk run @bazel-orfs//:bump
1135
git_override(
1236
module_name = "bazel-orfs",
13-
commit = "f8a4b694b37c8f5322323eba9a9ae37f9541ee17",
14-
remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git",
37+
commit = BAZEL_ORFS_COMMIT,
38+
remote = BAZEL_ORFS_REMOTE,
1539
)
1640

17-
bazel_dep(name = "rules_python", version = "1.8.5")
18-
bazel_dep(name = "rules_shell", version = "0.6.1")
41+
git_override(
42+
module_name = "bazel-orfs-verilog",
43+
commit = BAZEL_ORFS_COMMIT,
44+
remote = BAZEL_ORFS_REMOTE,
45+
strip_prefix = "verilog",
46+
)
47+
48+
# yosys-slang is not on BCR. Pin to a commit on povik/yosys-slang master
49+
# that has the upstream Bazel build (povik/yosys-slang#310) and the
50+
# slang.so visibility fix (povik/yosys-slang#311). Submodules pull in
51+
# vendored slang and fmt sources.
52+
bazel_dep(name = "yosys-slang")
53+
git_override(
54+
module_name = "yosys-slang",
55+
commit = "7753ea70431d85929292b90c33b32f6dbdb3b048",
56+
init_submodules = True,
57+
remote = "https://github.com/povik/yosys-slang.git",
58+
)
59+
60+
# --- Extensions ---
61+
62+
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
63+
llvm.toolchain(
64+
llvm_version = "20.1.8",
65+
)
66+
use_repo(llvm, "llvm_toolchain")
67+
68+
register_toolchains("@llvm_toolchain//:all")
1969

2070
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
2171
python.toolchain(
@@ -32,15 +82,32 @@ pip.parse(
3282
use_repo(pip, "orfs-pip")
3383

3484
orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories")
35-
36-
# To bump version, run: bazelisk run @bazel-orfs//:bump
3785
orfs.default(
38-
image = "docker.io/openroad/orfs:v3.0-3273-gedf3d6bf",
39-
# Use local files instead of docker image
4086
makefile = "//flow:makefile",
4187
makefile_yosys = "//flow:makefile_yosys",
4288
pdk = "//flow:asap7",
43-
sha256 = "f5692c6325ebcf27cc348e033355ec95c82c35ace1af7e72a0d352624ada143e",
89+
variables_yaml = "//flow:scripts/variables.yaml",
90+
# Expose the yosys-slang plugin via YOSYS_PLUGIN_PATH so
91+
# SYNTH_HDL_FRONTEND=slang works for ibex, cva6, uart, etc.
92+
yosys_plugins = ["@yosys-slang//src/yosys_plugin:slang.so"],
93+
)
94+
use_repo(orfs, "config")
95+
use_repo(orfs, "gnumake")
96+
use_repo(orfs, "orfs_variable_metadata")
97+
98+
# Auto-generate orfs_flow() targets from config.mk files.
99+
# See bazel-orfs.md for usage.
100+
orfs_designs = use_repo_rule("@bazel-orfs//private:designs.bzl", "orfs_designs")
101+
102+
orfs_designs(
103+
name = "orfs_designs",
104+
designs_dir = "//flow/designs:BUILD.bazel",
105+
platforms = [
106+
"asap7",
107+
"gf180",
108+
"ihp-sg13g2",
109+
"nangate45",
110+
"sky130hd",
111+
"sky130hs",
112+
],
44113
)
45-
use_repo(orfs, "com_github_nixos_patchelf_download")
46-
use_repo(orfs, "docker_orfs")

MODULE.bazel.lock

Lines changed: 4159 additions & 3905 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)