Skip to content

Commit 6fda822

Browse files
committed
Merge branch 'master' into rename_size_down
2 parents 5665352 + 1fccb93 commit 6fda822

217 files changed

Lines changed: 41440 additions & 1676 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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ third-party/abc/
77
tmp
88
# standalone workspace for downstream consumer tests
99
test/downstream/
10+
# fmt ships its own BUILD.bazel assuming it is the workspace root; we overlay
11+
# fmt via new_local_repository(name="fmt"), so hide this nested package from
12+
# //... discovery (its glob(["include/fmt/*.h"]) matches nothing here).
13+
third-party/slang-elab/third_party/fmt/support/bazel/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "src/abc"]
55
path = third-party/abc
66
url = ../../The-OpenROAD-Project/abc.git
7+
[submodule "third-party/slang-elab"]
8+
path = third-party/slang-elab
9+
url = https://github.com/povik/yosys-slang

BUILD.bazel

Lines changed: 103 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: BSD-3-Clause
22
# Copyright (c) 2025-2025, The OpenROAD Authors
33

4+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
45
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
56
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
67
load("@rules_cc//cc:cc_library.bzl", "cc_library")
@@ -98,6 +99,7 @@ OPENROAD_LIBRARY_DEPS = [
9899
"//src/exa:ui",
99100
"//src/fin",
100101
"//src/gpl",
102+
"//src/gpl:ui",
101103
"//src/grt",
102104
"//src/grt:ui",
103105
"//src/ifp",
@@ -128,6 +130,8 @@ OPENROAD_LIBRARY_DEPS = [
128130
"//src/rsz:ui",
129131
"//src/stt",
130132
"//src/stt:ui",
133+
"//src/syn",
134+
"//src/syn:ui",
131135
"//src/tap",
132136
"//src/tap:ui",
133137
"//src/upf",
@@ -138,12 +142,7 @@ OPENROAD_LIBRARY_DEPS = [
138142
"//src/web:ui",
139143
"@abc",
140144
":ord",
141-
] + select(
142-
{
143-
":platform_cli": ["//src/gui"],
144-
":platform_gui": ["//src/gui:gui_qt"],
145-
},
146-
)
145+
]
147146

148147
# Flags applied to top-level OpenROAD targets only. Flags that apply
149148
# globally to every cc_* target (-Wall, -Wextra, -Wno-sign-compare,
@@ -190,46 +189,113 @@ cc_library(
190189
],
191190
)
192191

192+
# Deps shared by :openroad and :openroad-qt. Kept as a Starlark list
193+
# rather than a cc_library wrapper because layering_check is enabled
194+
# package-wide: a deps-only cc_library does not re-export its deps'
195+
# headers to consumers, so direct binary deps are what each Main.cc
196+
# include needs to see.
197+
OPENROAD_MAIN_DEPS = [
198+
":openroad_version",
199+
":opt_notification",
200+
":ord",
201+
":tcl_readline_setup",
202+
"//bazel:tcl_library_init",
203+
"//src/cut",
204+
"//src/sta:opensta_lib",
205+
"//src/utl",
206+
"//src/web",
207+
"@abseil-cpp//absl/base:no_destructor",
208+
"@boost.stacktrace",
209+
"@rules_cc//cc/runfiles", # sets BAZEL_CURRENT_REPOSITORY
210+
"@tcl_lang//:tcl",
211+
]
212+
193213
cc_binary(
194214
name = "openroad",
195215
srcs = [
196216
"src/Main.cc",
197217
],
198218
copts = OPENROAD_COPTS,
219+
defines = OPENROAD_DEFINES,
199220
features = ["-use_header_modules"],
200221
malloc = select({
201222
"@platforms//os:linux": "@tcmalloc//tcmalloc",
202223
"@platforms//os:macos": "@bazel_tools//tools/cpp:malloc",
203224
}),
204225
visibility = ["//visibility:public"],
226+
deps = OPENROAD_MAIN_DEPS + select(
227+
{
228+
":platform_cli": [
229+
":openroad_lib",
230+
"//src/gui",
231+
"//src/gui:gui_stub",
232+
],
233+
":platform_gui": [
234+
":openroad_lib_qt",
235+
"//src/gui:gui_qt",
236+
],
237+
},
238+
),
239+
)
240+
241+
# Qt GUI variant. Build explicitly when the interactive GUI is wanted:
242+
# bazelisk build //:openroad-qt
243+
# Additive to the existing `--//:platform=gui //:openroad` flag path —
244+
# this target is preferable for ad-hoc GUI builds because it does not
245+
# invalidate `:openroad`'s cache the way flipping the flag does.
246+
cc_binary(
247+
name = "openroad-qt",
248+
srcs = [
249+
"src/Main.cc",
250+
],
251+
copts = OPENROAD_COPTS,
252+
defines = OPENROAD_DEFINES,
253+
features = ["-use_header_modules"],
254+
malloc = select({
255+
"@platforms//os:linux": "@tcmalloc//tcmalloc",
256+
"@platforms//os:macos": "@bazel_tools//tools/cpp:malloc",
257+
}),
258+
visibility = ["//visibility:public"],
259+
deps = OPENROAD_MAIN_DEPS + [
260+
":openroad_lib_qt",
261+
"//src/gui:gui_qt",
262+
],
263+
)
264+
265+
# CLI variant: the default. What downstream rule libraries pull as a
266+
# build-time tool, and what `bazelisk build //:openroad` produces.
267+
cc_library(
268+
name = "openroad_lib",
269+
srcs = [
270+
"src/Design.cc",
271+
"src/OpenRoad.cc",
272+
"src/Tech.cc",
273+
"src/Timing.cc",
274+
":openroad_swig",
275+
":openroad_tcl",
276+
],
277+
copts = OPENROAD_COPTS,
278+
defines = OPENROAD_DEFINES + ["BUILD_GUI=false"],
279+
features = ["-use_header_modules"],
280+
includes = [
281+
"include",
282+
],
283+
visibility = ["//:__subpackages__"],
205284
deps = [
206-
":openroad_lib",
207-
":openroad_version",
208-
":opt_notification",
209-
":ord",
210-
":tcl_readline_setup",
211-
"//bazel:tcl_library_init",
212-
"//src/cut",
213285
"//src/gui",
214286
"//src/sta:opensta_lib",
215-
"//src/utl",
216-
"//src/web",
217-
"@abseil-cpp//absl/base:no_destructor",
287+
"@abseil-cpp//absl/base:core_headers",
288+
"@abseil-cpp//absl/synchronization",
218289
"@boost.stacktrace",
219-
"@rules_cc//cc/runfiles", # sets BAZEL_CURRENT_REPOSITORY
220290
"@tcl_lang//:tcl",
221-
],
222-
)
223-
224-
GUI_BUILD_FLAGS = select(
225-
{
226-
":platform_cli": ["BUILD_GUI=false"],
227-
":platform_gui": ["BUILD_GUI=true"],
228-
},
291+
] + OPENROAD_LIBRARY_DEPS,
229292
)
230293

294+
# Qt variant: same sources, linked against the Qt GUI implementation.
295+
# Used by :openroad-qt, and by :openroad when --//:platform=gui is set.
296+
# Compiled separately (different `BUILD_GUI` define + different gui dep).
231297
cc_library(
232-
name = "openroad_lib",
298+
name = "openroad_lib_qt",
233299
srcs = [
234300
"src/Design.cc",
235301
"src/OpenRoad.cc",
@@ -239,13 +305,14 @@ cc_library(
239305
":openroad_tcl",
240306
],
241307
copts = OPENROAD_COPTS,
242-
defines = OPENROAD_DEFINES + GUI_BUILD_FLAGS,
308+
defines = OPENROAD_DEFINES + ["BUILD_GUI=true"],
243309
features = ["-use_header_modules"],
244310
includes = [
245311
"include",
246312
],
247313
visibility = ["//:__subpackages__"],
248314
deps = [
315+
"//src/gui:gui_qt",
249316
"//src/sta:opensta_lib",
250317
"@abseil-cpp//absl/base:core_headers",
251318
"@abseil-cpp//absl/synchronization",
@@ -347,6 +414,7 @@ cc_binary(
347414
"//src/gpl",
348415
"//src/grt",
349416
"//src/gui",
417+
"//src/gui:gui_stub",
350418
"//src/ifp",
351419
"//src/odb/src/db",
352420
"//src/par",
@@ -478,6 +546,14 @@ sh_test(
478546
tags = ["local"],
479547
)
480548

549+
# Make sure the Qt GUI variant keeps building. :openroad is exercised by
550+
# downstream rule libraries that pull it as a tool; :openroad-qt has no
551+
# such consumer in CI, so a build_test pins its compilability.
552+
build_test(
553+
name = "openroad_qt_build_test",
554+
targets = [":openroad-qt"],
555+
)
556+
481557
# ---------------------------------------------------------------------------
482558
# Lint & tidy targets
483559
#

MODULE.bazel

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,22 @@ orfs.default(
215215
yosys_plugins = ["@yosys-slang//src/yosys_plugin:slang.so"],
216216
)
217217

218+
# --- External archives ---
219+
220+
new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")
221+
222+
new_local_repository(
223+
name = "fmt",
224+
build_file = "//third-party/slang-elab/third_party:fmt.BUILD",
225+
path = "third-party/slang-elab/third_party/fmt",
226+
)
227+
228+
new_local_repository(
229+
name = "slang",
230+
build_file = "//third-party/slang-elab/third_party:slang.BUILD",
231+
path = "third-party/slang-elab/third_party/slang",
232+
)
233+
218234
# --- Overrides ---
219235

220236
single_version_override(

bazel/bzl_fmt_test.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ TOOL="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
1111
[ -L MODULE.bazel ] || { echo "MODULE.bazel missing from runfiles" >&2; exit 1; }
1212
WORKSPACE="$(dirname "$(readlink MODULE.bazel)")"
1313
cd "$WORKSPACE"
14-
# `git ls-files` skips submodule contents (src/sta, third-party/abc).
14+
# `-c submodule.recurse=false` keeps git ls-files from descending into
15+
# submodules (src/sta, third-party/abc, third-party/slang-elab and the
16+
# fmt sub-submodule nested in it) — we never want to reformat files
17+
# owned by another repo. The override is needed because CI sets
18+
# submodule.recurse=true globally.
1519
# Explicit -mode=check -lint=off separates format errors from lint warnings,
1620
# and overrides the repo-root .buildifier.json default (mode: fix).
17-
git ls-files '*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
21+
git -c submodule.recurse=false ls-files \
22+
'*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
1823
| xargs -0 "$TOOL" -mode=check -lint=off

bazel/bzl_lint_test.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ TOOL="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
1111
[ -L MODULE.bazel ] || { echo "MODULE.bazel missing from runfiles" >&2; exit 1; }
1212
WORKSPACE="$(dirname "$(readlink MODULE.bazel)")"
1313
cd "$WORKSPACE"
14-
# `git ls-files` skips submodule contents (src/sta, third-party/abc), so
15-
# we never try to reformat files owned by another repo.
14+
# `-c submodule.recurse=false` keeps git ls-files from descending into
15+
# submodules (src/sta, third-party/abc, third-party/slang-elab and the
16+
# fmt sub-submodule nested in it) — we never want to reformat files
17+
# owned by another repo. The override is needed because CI sets
18+
# submodule.recurse=true globally.
1619
# Explicit -mode=check overrides the repo-root .buildifier.json default.
17-
git ls-files '*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
20+
git -c submodule.recurse=false ls-files \
21+
'*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
1822
| xargs -0 "$TOOL" -mode=check -lint=warn

bazel/bzl_tidy.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
set -euo pipefail
77
TOOL="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
88
cd "${BUILD_WORKSPACE_DIRECTORY:-$PWD}"
9-
# `git ls-files` skips submodule contents (src/sta, third-party/abc),
10-
# so we never rewrite files owned by another repo.
11-
git ls-files '*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
9+
# `-c submodule.recurse=false` keeps git ls-files from descending into
10+
# submodules (src/sta, third-party/abc, third-party/slang-elab and the
11+
# fmt sub-submodule nested in it) — we never want to rewrite files
12+
# owned by another repo. The override is needed because CI sets
13+
# submodule.recurse=true globally.
14+
git -c submodule.recurse=false ls-files \
15+
'*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
1216
| xargs -0 "$TOOL" -mode=fix -lint=fix

etc/DependencyInstaller.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,28 @@ _verify_checksum() {
157157
_execute "Verifying ${filename} checksum..." bash -c "echo '${checksum} ${filename}' | md5sum --quiet -c -"
158158
}
159159

160+
# ------------------------------------------------------------------------------
161+
# Yosys build dependencies
162+
# ------------------------------------------------------------------------------
163+
# OpenROAD itself uses vendored linenoise, so readline is no longer in the
164+
# base package lists. Yosys still requires it at compile time, so install it
165+
# here right before the yosys build.
166+
_install_yosys_dependencies() {
167+
if _command_exists "apt-get"; then
168+
export DEBIAN_FRONTEND="noninteractive"
169+
_execute "Installing libreadline-dev for yosys..." \
170+
apt-get -y install --no-install-recommends libreadline-dev
171+
elif _command_exists "yum"; then
172+
_execute "Installing readline-devel for yosys..." \
173+
yum -y install readline-devel
174+
elif _command_exists "zypper"; then
175+
_execute "Installing readline-devel for yosys..." \
176+
zypper -n install readline-devel
177+
elif [[ "$OSTYPE" == "darwin"* ]]; then
178+
_execute "Installing readline for yosys..." brew install readline
179+
fi
180+
}
181+
160182
# ------------------------------------------------------------------------------
161183
# Yosys
162184
# ------------------------------------------------------------------------------
@@ -173,6 +195,7 @@ _install_yosys() {
173195
local required_version="${YOSYS_VERSION#v}"
174196
log "Checking Yosys (System: ${yosys_installed_version}, Required: ${required_version})"
175197
if [[ "${yosys_installed_version}" != "${required_version}" ]]; then
198+
_install_yosys_dependencies
176199
(
177200
cd "${BASE_DIR}"
178201
_execute "Cloning Yosys ${YOSYS_VERSION}..." git clone --depth=1 -b "${YOSYS_VERSION}" --recursive https://github.com/YosysHQ/yosys

include/ord/OpenRoad.hh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ namespace web {
130130
class WebServer;
131131
}
132132

133+
namespace syn {
134+
class Synthesis;
135+
}
136+
133137
namespace ord {
134138

135139
class dbVerilogNetwork;
@@ -184,6 +188,7 @@ class OpenRoad
184188
return estimate_parasitics_;
185189
}
186190
web::WebServer* getWebServer() { return web_server_; }
191+
syn::Synthesis* getSynthesis() { return synthesis_; }
187192

188193
// Return the bounding box of the db rows.
189194
odb::Rect getCore();
@@ -288,6 +293,7 @@ class OpenRoad
288293
dft::Dft* dft_ = nullptr;
289294
est::EstimateParasitics* estimate_parasitics_ = nullptr;
290295
web::WebServer* web_server_ = nullptr;
296+
syn::Synthesis* synthesis_ = nullptr;
291297
utl::ServiceRegistry* service_registry_ = nullptr;
292298

293299
int threads_ = 1;

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[tool.black]
2+
extend-exclude = '''
3+
^/third-party/
4+
'''
5+
force-exclude = '''
6+
^/third-party/
7+
'''

0 commit comments

Comments
 (0)