Skip to content

Commit 87b01b7

Browse files
authored
Merge pull request #4208 from oharboe/bazel-orfs-beta-test
bazel: add bazel rules for config.mk designs
2 parents 9671320 + 67fad13 commit 87b01b7

181 files changed

Lines changed: 5603 additions & 3885 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.

.bazelignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ jenkins/
66
docs/
77

88

9+
tmp

.bazelrc

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,4 @@ bazel-testlogs
105105

106106
# python venv
107107
venv/
108+
tmp/

MODULE.bazel

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

8-
bazel_dep(name = "bazel-orfs")
8+
# --- Regular dependencies (propagated to downstream consumers) ---
9+
10+
bazel_dep(name = "rules_python", version = "1.8.5")
11+
bazel_dep(name = "rules_shell", version = "0.6.1")
12+
13+
# --- Dev dependencies (only honoured when @orfs is the root module) ---
14+
#
15+
# When @orfs is consumed as a non-root dep (e.g. by tools/OpenROAD), the
16+
# downstream module brings its own openroad/qt-bazel/bazel-orfs/yosys-slang
17+
# pins and orfs.default() configuration. Marking everything below as
18+
# dev_dependency = True makes those declarations no-ops in that case, so
19+
# our MODULE.bazel doesn't need to be patched at non-root consumption
20+
# time.
21+
22+
bazel_dep(name = "toolchains_llvm", version = "1.5.0", dev_dependency = True)
23+
24+
bazel_dep(name = "openroad", dev_dependency = True)
25+
local_path_override(
26+
module_name = "openroad",
27+
path = "tools/OpenROAD",
28+
)
29+
30+
bazel_dep(name = "qt-bazel", dev_dependency = True)
31+
git_override(
32+
module_name = "qt-bazel",
33+
commit = "886104974c2fd72439f2c33b5deebf0fe4649df7",
34+
remote = "https://github.com/The-OpenROAD-Project/qt_bazel_prebuilts",
35+
)
36+
37+
bazel_dep(name = "bazel-orfs", dev_dependency = True)
38+
bazel_dep(name = "bazel-orfs-verilog", dev_dependency = True)
39+
40+
BAZEL_ORFS_COMMIT = "717655415dd4446ca4e2fc09907465c75cb23912"
41+
42+
BAZEL_ORFS_REMOTE = "https://github.com/The-OpenROAD-Project/bazel-orfs.git"
943

1044
# To bump version, run: bazelisk run @bazel-orfs//:bump
1145
git_override(
1246
module_name = "bazel-orfs",
13-
commit = "f8a4b694b37c8f5322323eba9a9ae37f9541ee17",
14-
remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git",
47+
commit = BAZEL_ORFS_COMMIT,
48+
remote = BAZEL_ORFS_REMOTE,
1549
)
1650

17-
bazel_dep(name = "rules_python", version = "1.8.5")
18-
bazel_dep(name = "rules_shell", version = "0.6.1")
51+
git_override(
52+
module_name = "bazel-orfs-verilog",
53+
commit = BAZEL_ORFS_COMMIT,
54+
remote = BAZEL_ORFS_REMOTE,
55+
strip_prefix = "verilog",
56+
)
57+
58+
# yosys-slang is not on BCR. Pin to a commit on povik/yosys-slang master
59+
# that has the upstream Bazel build (povik/yosys-slang#310) and the
60+
# slang.so visibility fix (povik/yosys-slang#311). Submodules pull in
61+
# vendored slang and fmt sources.
62+
bazel_dep(name = "yosys-slang", dev_dependency = True)
63+
git_override(
64+
module_name = "yosys-slang",
65+
commit = "7753ea70431d85929292b90c33b32f6dbdb3b048",
66+
init_submodules = True,
67+
remote = "https://github.com/povik/yosys-slang.git",
68+
)
69+
70+
# --- Extensions ---
71+
72+
llvm = use_extension(
73+
"@toolchains_llvm//toolchain/extensions:llvm.bzl",
74+
"llvm",
75+
dev_dependency = True,
76+
)
77+
llvm.toolchain(
78+
llvm_version = "20.1.8",
79+
)
80+
use_repo(llvm, "llvm_toolchain")
81+
82+
register_toolchains("@llvm_toolchain//:all", dev_dependency = True)
1983

2084
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
2185
python.toolchain(
@@ -31,16 +95,33 @@ pip.parse(
3195
)
3296
use_repo(pip, "orfs-pip")
3397

34-
orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories")
35-
36-
# To bump version, run: bazelisk run @bazel-orfs//:bump
98+
orfs = use_extension(
99+
"@bazel-orfs//:extension.bzl",
100+
"orfs_repositories",
101+
dev_dependency = True,
102+
)
37103
orfs.default(
38-
image = "docker.io/openroad/orfs:v3.0-3273-gedf3d6bf",
39-
# Use local files instead of docker image
40-
makefile = "//flow:makefile",
41-
makefile_yosys = "//flow:makefile_yosys",
42-
pdk = "//flow:asap7",
43-
sha256 = "f5692c6325ebcf27cc348e033355ec95c82c35ace1af7e72a0d352624ada143e",
44-
)
45-
use_repo(orfs, "com_github_nixos_patchelf_download")
46-
use_repo(orfs, "docker_orfs")
104+
# Expose the yosys-slang plugin via YOSYS_PLUGIN_PATH so
105+
# SYNTH_HDL_FRONTEND=slang works for ibex, cva6, uart, etc.
106+
yosys_plugins = ["@yosys-slang//src/yosys_plugin:slang.so"],
107+
)
108+
use_repo(orfs, "config")
109+
use_repo(orfs, "gnumake")
110+
use_repo(orfs, "orfs_variable_metadata")
111+
112+
# Auto-generate orfs_flow() targets from config.mk files.
113+
# See flow/README.md for usage.
114+
orfs_designs = use_repo_rule("@bazel-orfs//private:designs.bzl", "orfs_designs")
115+
116+
orfs_designs(
117+
name = "orfs_designs",
118+
designs_dir = "//flow/designs:BUILD",
119+
platforms = [
120+
"asap7",
121+
"gf180",
122+
"ihp-sg13g2",
123+
"nangate45",
124+
"sky130hd",
125+
"sky130hs",
126+
],
127+
)

0 commit comments

Comments
 (0)