Skip to content

Commit 238be8b

Browse files
oharboeclaude
andcommitted
designs: OpenROAD-SYN status targets in the config.mk DSL (asap7)
Every design now gets manual OpenROAD-SYN status targets via the orfs_design extra hook (flow/designs/design.bzl): a synthesis-only variant "syn" flow with SYNTH_USE_SYN=1 forced (<name>_syn_synth, and with a rules-syn.json also <name>_syn_test / <name>_syn_update) plus a best-effort <name>_syn_qor / <name>_yosys_qor pair (flow/designs/qor.bzl) that always builds, emitting metadata or a failure marker for the QoR comparison graph. flow/designs/asap7/BUILD aggregates them: bazelisk test //flow/designs/asap7:syn_test (17 designs, failing ones included — it is a status suite) and the graph genrules syn_qor_png / clock_period_png. ibex is excluded as a documented runaway: its OpenROAD-SYN synthesis completes but report_metrics STA spins for hours. gcd's SYNTH_USE_SYN local_arguments workaround is gone — the DSL now routes the variable natively, so gcd's regular flow uses OpenROAD-SYN like make does. The single-process comparison keeps a dedicated yosys-engine flow variant since single_flow.tcl seeds from the yosys netlist. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent 163df18 commit 238be8b

4 files changed

Lines changed: 413 additions & 10 deletions

File tree

‎flow/designs/asap7/BUILD‎

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# OpenROAD-SYN status suite for asap7.
2+
#
3+
# Every asap7 design gets manual <name>_syn_* targets from the config.mk
4+
# DSL (see flow/designs/design.bzl): a synthesis-only variant "syn" flow
5+
# with SYNTH_USE_SYN=1 forced, a rules-syn.json QoR gate, and a
6+
# best-effort <name>_syn_qor / <name>_yosys_qor pair for the comparison
7+
# graph. This package aggregates them:
8+
#
9+
# bazelisk test //flow/designs/asap7:syn_test
10+
# bazelisk build //flow/designs/asap7:syn_qor_png
11+
#
12+
# The suite deliberately includes designs that fail OpenROAD-SYN today —
13+
# it is a status report, not a green-only gate. Failing designs keep a
14+
# stub rules-syn.json (fails honestly at the synth stage); passing
15+
# designs get real rules via bazelisk run <pkg>:<name>_syn_update.
16+
17+
# Design directory -> DESIGN_NAME (bazel target prefix), ordered
18+
# fastest-first so --keep_going runs surface quick failures early.
19+
# Expected failures / quirks are listed last. "minimal" is excluded: it
20+
# has no VERILOG_FILES and thus no generated design targets.
21+
SYN_TEST_DESIGNS = {
22+
"gcd": "gcd", # smoketest, fast
23+
"uart": "uart",
24+
"mock-alu": "MockAlu",
25+
"riscv32i": "riscv_top",
26+
"aes": "aes_cipher_top",
27+
"aes_lvt": "aes_cipher_top",
28+
"aes-mbff": "aes_cipher_top",
29+
"jpeg": "jpeg_encoder",
30+
"jpeg_lvt": "jpeg_encoder",
31+
"ethmac": "ethmac",
32+
"ethmac_lvt": "ethmac",
33+
"mock-cpu": "mock_cpu",
34+
"swerv_wrapper": "swerv_wrapper", # large; SRAM macros
35+
"cva6": "cva6", # large; slang include dirs/defines
36+
"gcd-ccs": "gcd", # CCS liberty
37+
"aes-block": "aes_cipher_top", # hierarchical BLOCKS
38+
"riscv32i-mock-sram": "riscv_top", # hierarchical BLOCKS (fakeram)
39+
}
40+
41+
# Designs whose OpenROAD-SYN run does not terminate in reasonable time.
42+
# Deliberately excluded from syn_test and the QoR graph so the
43+
# aggregators stay runnable; their manual per-design targets remain
44+
# available to reproduce the problem, e.g.
45+
# bazelisk build //flow/designs/asap7/ibex:ibex_core_syn_synth
46+
#
47+
# - ibex: sv_elaborate/synthesize/repair_design complete in seconds, but
48+
# report_metrics ("Report metrics stage 1, synth...") spins in STA for
49+
# hours (observed >2h on 48 threads with no progress).
50+
SYN_RUNAWAY_DESIGNS = {
51+
"ibex": "ibex_core",
52+
}
53+
54+
# Explicitly listed manual tests DO run through a test_suite (the manual
55+
# tag only exempts them from wildcard expansion); the suite itself is
56+
# manual so `bazelisk test //flow/...` does not pull them in either.
57+
test_suite(
58+
name = "syn_test",
59+
tags = ["manual"],
60+
tests = [
61+
"//flow/designs/asap7/{pkg}:{name}_syn_test".format(
62+
name = name,
63+
pkg = pkg,
64+
)
65+
for pkg, name in SYN_TEST_DESIGNS.items()
66+
],
67+
)
68+
69+
# The syn-vs-yosys QoR comparison graph plus the runtime A/B chart. A
70+
# plain build target: the per-design _qor inputs are best-effort (marker
71+
# JSON on failure), so this always builds and failing designs render as
72+
# hatched FAIL columns.
73+
#
74+
# Refresh the checked-in copies embedded by the status PR with:
75+
# bazelisk build //flow/designs/asap7:syn_qor_png
76+
# cp -f bazel-bin/flow/designs/asap7/openroad-syn-{qor,runtime}.png \
77+
# flow/docs/images/
78+
# Effective clock period (target - gated worst slack) across stages,
79+
# one series per design, OpenROAD-SYN synthesis point overlaid. Consumes
80+
# only the checked-in rules-*.json files — no flow runs. Same refresh
81+
# pattern as syn_qor_png, into flow/docs/images/openroad-syn-clock-period.png.
82+
genrule(
83+
name = "clock_period_png",
84+
srcs = [
85+
"//flow/designs/asap7/{pkg}:rules-{kind}.json".format(
86+
kind = kind,
87+
pkg = pkg,
88+
)
89+
for pkg in SYN_TEST_DESIGNS
90+
for kind in [
91+
"base",
92+
"syn",
93+
]
94+
],
95+
outs = ["openroad-syn-clock-period.png"],
96+
cmd = "$(location //flow/util:plotClockPeriod) --output $@ " + " ".join([
97+
("--design {pkg} " +
98+
"--rules-base $(location //flow/designs/asap7/{pkg}:rules-base.json) " +
99+
"--rules-syn $(location //flow/designs/asap7/{pkg}:rules-syn.json)").format(
100+
pkg = pkg,
101+
)
102+
for pkg in SYN_TEST_DESIGNS
103+
]),
104+
tags = ["manual"],
105+
tools = ["//flow/util:plotClockPeriod"],
106+
)
107+
108+
genrule(
109+
name = "syn_qor_png",
110+
srcs = [
111+
"//flow/designs/asap7/{pkg}:{name}_{kind}_qor".format(
112+
name = name,
113+
kind = kind,
114+
pkg = pkg,
115+
)
116+
for pkg, name in SYN_TEST_DESIGNS.items()
117+
for kind in [
118+
"syn",
119+
"yosys",
120+
]
121+
],
122+
outs = [
123+
"openroad-syn-qor.png",
124+
"openroad-syn-runtime.png",
125+
],
126+
cmd = "$(location //flow/util:plotSynQoR) " +
127+
"--output $(location openroad-syn-qor.png) " +
128+
"--runtime-output $(location openroad-syn-runtime.png) " + " ".join([
129+
("--design {pkg} " +
130+
"--syn $(location //flow/designs/asap7/{pkg}:{name}_syn_qor) " +
131+
"--base $(location //flow/designs/asap7/{pkg}:{name}_yosys_qor)").format(
132+
name = name,
133+
pkg = pkg,
134+
)
135+
for pkg, name in SYN_TEST_DESIGNS.items()
136+
]),
137+
tags = ["manual"],
138+
tools = ["//flow/util:plotSynQoR"],
139+
)

‎flow/designs/asap7/gcd/BUILD‎

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1-
load("@bazel-orfs//:openroad.bzl", "orfs_run")
1+
load("@bazel-orfs//:openroad.bzl", "orfs_flow", "orfs_run")
22
load("@orfs_designs//:designs.bzl", "DESIGNS")
33
load("@rules_shell//shell:sh_test.bzl", "sh_test")
44
load("//flow/designs:design.bzl", "design")
55

6-
# SYNTH_USE_SYN is make-only for now: bazel-orfs's synth stage always
7-
# runs the yosys flow and neither stages the Verilog sources nor sets
8-
# VERILOG_FILES for the OpenROAD synthesis step, so the built-in
9-
# synthesizer opt-in must not reach the bazel arguments.
106
design(
117
config = "config.mk",
12-
local_arguments = ["SYNTH_USE_SYN"],
8+
)
9+
10+
# gcd's regular flow follows config.mk onto OpenROAD-SYN
11+
# (SYNTH_USE_SYN=1), but the single-process comparison below
12+
# deliberately exercises the yosys netlist path (single_flow.tcl seeds
13+
# from 1_2_yosys.v). Give the comparison its own yosys-engine flow;
14+
# manual so only the gcd_single_flow_test suite builds it.
15+
orfs_flow(
16+
name = "gcd",
17+
arguments = {
18+
k: v
19+
for k, v in DESIGNS["asap7/gcd"]["arguments"].items()
20+
if k != "SYNTH_USE_SYN"
21+
},
22+
pdk = "//flow:asap7",
23+
sources = DESIGNS["asap7/gcd"]["sources"],
24+
tags = ["manual"],
25+
variant = "yosys",
26+
verilog_files = DESIGNS["asap7/gcd"]["verilog_files"],
1327
)
1428

1529
# Stage-boundary .odb/.sdc stems shared by the normal per-stage flow
@@ -56,7 +70,7 @@ SINGLE_FLOW_EXTRA_OUTS = [
5670
# this package.
5771
orfs_run(
5872
name = "gcd_single_flow",
59-
src = ":gcd_synth",
73+
src = ":gcd_yosys_synth",
6074
outs = [
6175
"results/asap7/gcd/single/{}.{}".format(stem, ext)
6276
for stem in SINGLE_FLOW_STAGES.values()
@@ -79,11 +93,13 @@ orfs_run(
7993
variant = "single",
8094
)
8195

82-
# Normal-flow stage outputs, one filegroup per compared file.
96+
# Normal-flow stage outputs, one filegroup per compared file. Taken from
97+
# the yosys-engine variant above so both sides of the byte-compare start
98+
# from the same yosys netlist.
8399
[
84100
filegroup(
85101
name = "gcd_base_{}_{}".format(stage, ext),
86-
srcs = [":gcd_" + stage],
102+
srcs = [":gcd_yosys_" + stage],
87103
output_group = "{}.{}".format(stem, ext),
88104
)
89105
for stage, stem in SINGLE_FLOW_STAGES.items()

‎flow/designs/design.bzl‎

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""BUILD boilerplate for flow/designs/."""
22

3+
load("@bazel-orfs//:openroad.bzl", "orfs_flow")
34
load("@orfs_designs//:designs.bzl", "orfs_design")
5+
load("//flow/designs:qor.bzl", "orfs_qor")
46

57
# Per filegroup target: extensions included in the filegroup.
68
# bazel-orfs's config_mk_parser produces these target names from
@@ -17,7 +19,9 @@ _GROUPS = {
1719
# cross-package references resolve. Kept tight on purpose: globbing "*"
1820
# silently exposes LICENSE/.gitignore/etc. as the public API surface.
1921
# gds/gds.gz are inputs in hierarchical flows via ADDITIONAL_GDS.
20-
_EXPORTED_EXTS = ["v", "sv", "svh", "tcl", "sdc", "def", "cfg", "lef", "lib", "gds", "gds.gz"]
22+
# json covers rules-*.json so QoR reporting targets (e.g.
23+
# //flow/designs/asap7:clock_period_png) can consume them per file.
24+
_EXPORTED_EXTS = ["v", "sv", "svh", "tcl", "sdc", "def", "cfg", "lef", "lib", "gds", "gds.gz", "json"]
2125

2226
_EXPORTS_SENTINEL = "_orfs_design_exports_sentinel"
2327

@@ -51,6 +55,65 @@ def _export_design_files():
5155
visibility = ["//visibility:private"],
5256
)
5357

58+
def _syn_status_targets(
59+
name,
60+
platform,
61+
verilog_files,
62+
arguments,
63+
user_arguments,
64+
sources,
65+
user_sources,
66+
macros,
67+
stage_data,
68+
tags): # buildifier: disable=unused-variable
69+
"""OpenROAD-SYN status targets for one design (orfs_design extra hook).
70+
71+
Emits, always tagged "manual" (even for CI designs, so only explicit
72+
invocations such as //flow/designs/asap7:syn_test run them):
73+
74+
- a synthesis-only variant "syn" flow with SYNTH_USE_SYN=1 forced,
75+
regardless of the config.mk default: <name>_syn_synth plus — when
76+
the package has a rules-syn.json — the <name>_syn_test QoR gate
77+
and <name>_syn_update rules regenerator.
78+
- a best-effort <name>_syn_qor / <name>_yosys_qor pair whose
79+
qor.json outputs feed the syn-vs-yosys QoR comparison graph.
80+
"""
81+
syn_sources = {k: v for k, v in sources.items() if k != "RULES_JSON"}
82+
if native.glob(["rules-syn.json"], allow_empty = True):
83+
syn_sources["RULES_JSON"] = [":rules-syn.json"]
84+
orfs_flow(
85+
name = name,
86+
verilog_files = verilog_files,
87+
pdk = "//flow:" + platform,
88+
arguments = arguments | {"SYNTH_USE_SYN": "1"},
89+
user_arguments = user_arguments,
90+
sources = syn_sources,
91+
user_sources = user_sources,
92+
macros = macros,
93+
stage_data = stage_data,
94+
variant = "syn",
95+
last_stage = "synth",
96+
tags = ["manual"],
97+
test_kwargs = {"tags": ["manual"]},
98+
)
99+
for qor_variant, qor_use_syn in [("syn_qor", True), ("yosys_qor", False)]:
100+
orfs_qor(
101+
name = "%s_%s" % (name, qor_variant),
102+
use_syn = qor_use_syn,
103+
module_top = name,
104+
variant = qor_variant,
105+
verilog_files = verilog_files,
106+
pdk = "//flow:" + platform,
107+
# user_arguments are dropped by the synth-stage argument
108+
# filter; designs whose synthesis depends on user .tcl hooks
109+
# may fail their best-effort QoR run and render as FAILED.
110+
arguments = arguments,
111+
sources = {k: v for k, v in sources.items() if k != "RULES_JSON"},
112+
deps = macros,
113+
stage_data = stage_data,
114+
tags = ["manual"],
115+
)
116+
54117
def design(config = "config.mk", user_arguments = [], user_sources = [], local_arguments = []):
55118
"""Standard BUILD body for flow/designs/<platform>/<design>/.
56119
@@ -75,6 +138,7 @@ def design(config = "config.mk", user_arguments = [], user_sources = [], local_a
75138
user_sources = user_sources,
76139
local_arguments = local_arguments,
77140
blender = True,
141+
extra = _syn_status_targets,
78142
)
79143

80144
def files(group, extra_srcs = None):

0 commit comments

Comments
 (0)