Skip to content

Commit c53c6f9

Browse files
committed
bazel: use local ORFS files
Signed-off-by: Øyvind Harboe <[email protected]>
1 parent 5050970 commit c53c6f9

File tree

4 files changed

+140
-14
lines changed

4 files changed

+140
-14
lines changed

flow/BUILD.bazel

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
load("@bazel-orfs//:openroad.bzl", "orfs_pdk")
2+
3+
MAKEFILE_SHARED = [
4+
"scripts/*.py",
5+
"scripts/*.sh",
6+
"scripts/*.yaml",
7+
"scripts/*.mk",
8+
]
9+
10+
filegroup(
11+
name = "makefile_yosys",
12+
srcs = ["Makefile"],
13+
data = glob(MAKEFILE_SHARED + [
14+
"scripts/*.script",
15+
"scripts/util.tcl",
16+
"scripts/synth*.tcl",
17+
"platforms/common/**/*.v",
18+
]) +
19+
["//util:makefile_yosys"],
20+
visibility = ["//visibility:public"],
21+
)
22+
23+
24+
# The files used in the flow steps(floorplan, place, route, etc.)
25+
filegroup(
26+
name = "makefile",
27+
srcs = ["Makefile"],
28+
data = glob(MAKEFILE_SHARED + [
29+
"scripts/*.tcl",
30+
"platforms/common/**/*.v",
31+
]) + [
32+
"//util:makefile",
33+
],
34+
visibility = ["//visibility:public"],
35+
)
36+
37+
[orfs_pdk(
38+
name = pdk,
39+
config = ":platforms/{pdk}/config.mk".format(pdk = pdk),
40+
srcs = glob([
41+
"platforms/{pdk}/**/*.{ext}".format(pdk = pdk, ext = ext)
42+
for ext in [
43+
"gds",
44+
"lib.gz",
45+
"lef",
46+
"lib",
47+
"lyt",
48+
"mk",
49+
"rules",
50+
"sdc",
51+
"tcl",
52+
"v",
53+
"tlef",
54+
]
55+
]),
56+
visibility = ["//visibility:public"],
57+
) for pdk in [
58+
"asap7",
59+
"sky130hd",
60+
]]

flow/MODULE.bazel

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ module(
77
)
88

99
bazel_dep(name = "bazel-orfs")
10-
git_override(
11-
module_name = "bazel-orfs",
12-
commit = "41354d9de46816b79858e43baadf701cf7e997e5",
13-
remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git",
14-
)
10+
# git_override(
11+
# module_name = "bazel-orfs",
12+
# commit = "41354d9de46816b79858e43baadf701cf7e997e5",
13+
# remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git",
14+
# )
1515

1616
# Read: https://github.com/The-OpenROAD-Project/bazel-orfs?tab=readme-ov-file#usage
1717
#
@@ -20,9 +20,31 @@ git_override(
2020
# 1. uncomment below
2121
# 2. comment git_override() above
2222
#
23-
#local_path_override(
24-
# module_name = "bazel-orfs", path = "../bazel-orfs"
25-
#)
23+
local_path_override(
24+
module_name = "bazel-orfs",
25+
path = "../../bazel-orfs",
26+
)
27+
28+
29+
# HACK waiting for https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts/pull/3008/files
30+
new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")
31+
32+
new_local_repository(
33+
name = "openroad",
34+
build_file_content = """
35+
sh_binary(
36+
name = "openroadbin",
37+
srcs = ["openroad"],
38+
data = glob(["**/*"], exclude=["openroad"]),
39+
env = {
40+
"TCL_LIBRARY": "external/_main~_repo_rules~openroad/external/tk_tcl/library/",
41+
},
42+
visibility = ["//visibility:public"],
43+
)
44+
""",
45+
path = "../tools/OpenROAD/bazel-out/k8-opt/bin/openroad.runfiles/_main/",
46+
)
47+
2648

2749
bazel_dep(name = "rules_python", version = "0.31.0")
2850

@@ -50,8 +72,13 @@ orfs.default(
5072
# and update "image" to point to the local image.
5173

5274
# Official image https://hub.docker.com/r/openroad/orfs/tags
53-
image = "docker.io/openroad/orfs:v3.0-2707-g044183f3",
54-
sha256 = "34db776930937b94b22f96b68feea87381de70727d12efc47f342b88c8cb3db6",
75+
image = "docker.io/openroad/orfs:v3.0-2734-gcf6f0417",
76+
# Use local files instead of docker image
77+
makefile = "//:makefile",
78+
pdk = "//:asap7",
79+
makefile_yosys = "//:makefile_yosys",
80+
# openroad = "@openroad//:openroadbin",
81+
sha256 = "ef685898a5e3a2db7166c55238275adcf2dbec7ee0a7eb895a78657bcc27220a",
5582
)
5683
use_repo(orfs, "com_github_nixos_patchelf_download")
5784
use_repo(orfs, "docker_orfs")

flow/MODULE.bazel.lock

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

flow/util/BUILD.bazel

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,27 @@ compile_pip_requirements(
1616
src = "requirements.in",
1717
requirements_txt = "requirements_lock.txt",
1818
)
19+
20+
MAKEFILE_SHARED = [
21+
"*.mk",
22+
]
23+
24+
# The files used in the flow steps(floorplan, place, route, etc.)
25+
filegroup(
26+
name = "makefile",
27+
srcs = glob(MAKEFILE_SHARED + [
28+
"*.pl",
29+
"*.py",
30+
"*.sh",
31+
]),
32+
visibility = ["//visibility:public"],
33+
)
34+
35+
filegroup(
36+
name = "makefile_yosys",
37+
srcs = glob(MAKEFILE_SHARED) + [
38+
"preprocessLib.py",
39+
"mergeLib.pl",
40+
],
41+
visibility = ["//visibility:public"],
42+
)

0 commit comments

Comments
 (0)