Repository navigation
Conversation
Adds OpenROAD's integrated synthesizer (sv_elaborate + synthesize,
OpenROAD #10473) as a universal "_syn" variant of every flat
design driven by design() in flow/designs/design.bzl. Relocates
and generalises the throwaway smoke target from OpenROAD #10479,
which explicitly said the proper home for this was bazel-orfs /
ORFS, not OpenROAD's test tree.
Purely additive: no existing Makefile recipe, bazel rule, design,
or target's behaviour is altered. Pieces:
- flow/scripts/synth_syn.tcl (new) -- povik's driver. Reads
LEF/Liberty/SDC via the ORFS env vars and writes 1_synth.odb +
1_synth.sdc directly, bypassing the Yosys 1_2_yosys.v ->
synth_odb.tcl chain.
- flow/Makefile gains one new phony target do-syn-synth that
invokes openroad on synth_syn.tcl. No existing recipe touched.
- patches/bazel-orfs/0002-...patch adds a parallel
orfs_openroad_synth_rule + orfs_openroad_synth macro in
bazel-orfs. OrfsInfo shape matches orfs_synth_rule, so
orfs_flow(previous_stage = {"floorplan": ":<name>_syn_synth"})
chains downstream stages unchanged. Vendored here until the
integrated syn tool stabilises and this lands upstream.
- flow/designs/design.bzl -- design() now also emits the _syn
chain for every flat design via a DESIGNS lookup + helper.
Hierarchical designs (blocks non-empty) are skipped -- the
built-in synthesizer doesn't handle BLOCKS yet. All _syn
targets are tagged manual so bazel build //... is unaffected.
End state for every flat design:
bazelisk build //flow/designs/asap7/gcd:gcd_syn_synth # OpenROAD synth
bazelisk build //flow/designs/asap7/gcd:gcd_synth # Yosys (unchanged)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reformat with tclfmt 0.7.0 — normalize line endings, replace tab
indentation with two spaces, and add spaces inside the `if { ... }`
brace expression. Pure formatting; no behavior change. Fixes the
Tclint CI job on PR The-OpenROAD-Project#4253.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Build vIdirsArgs with `[list]` + `lappend` and let `{*}` expand it
directly into elaborate_args. The previous code joined the list into
a space-separated string and re-expanded it, which would corrupt any
include directory path containing whitespace.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
There was a problem hiding this comment.
Code Review
This pull request integrates OpenROAD's built-in synthesizer into the Bazel-ORFS flow by adding a new Makefile target, Starlark rules, and the synth_syn.tcl script. Feedback on the changes includes addressing potential Tcl errors from unchecked environment variables (DONT_USE_CELLS and SYNTH_SLANG_ARGS), fixing a case-sensitivity bug in Verilog file extension checks, replacing a hardcoded design check for cva6 with a generic port check, and correcting a Starlark style violation when comparing to None.
| read_lef $lef | ||
| } | ||
| } | ||
| set_dont_use $::env(DONT_USE_CELLS) |
There was a problem hiding this comment.
If DONT_USE_CELLS is not defined in the environment, referencing $::env(DONT_USE_CELLS) directly will throw a Tcl error and halt the synthesis process. It is safer to wrap this call in a check to ensure the environment variable exists and is non-empty.
if { [env_var_exists_and_non_empty DONT_USE_CELLS] } {
set_dont_use $::env(DONT_USE_CELLS)
}
| } | ||
| } | ||
|
|
||
| lappend elaborate_args {*}$::env(SYNTH_SLANG_ARGS) |
There was a problem hiding this comment.
If SYNTH_SLANG_ARGS is not defined in the environment, referencing $::env(SYNTH_SLANG_ARGS) directly will throw a Tcl error. Using [env_var_or_empty SYNTH_SLANG_ARGS] is much safer and aligns with how other optional environment variables are handled in this script.
lappend elaborate_args {*}[env_var_or_empty SYNTH_SLANG_ARGS]
| # If the sources are solely .v files, enable Verilog compatibility | ||
| set has_non_v_files false | ||
| foreach fn $::env(VERILOG_FILES) { | ||
| if { [file extension [string trim $fn]] != ".v" } { |
There was a problem hiding this comment.
If a Verilog file has an uppercase extension (e.g., .V), [file extension] will return .V. The comparison ".V" != ".v" will evaluate to true, incorrectly marking it as a non-v file and disabling the --std=1364-2005 flag. Converting the extension to lowercase using string tolower makes this check case-insensitive and more robust.
if { [string tolower [file extension [string trim $fn]]] != ".v" } {
| if { $::env(DESIGN_NAME) == "cva6" } { | ||
| syn::remove_ports rvfi_probes_o | ||
| } |
There was a problem hiding this comment.
Hardcoding design-specific checks (like cva6) in a generic synthesis script reduces maintainability and modularity. Instead of checking the design name, check if the port rvfi_probes_o exists in the design before attempting to remove it.
if { [get_ports -quiet rvfi_probes_o] != "" } {
syn::remove_ports rvfi_probes_o
}
| does not pick them up while the OpenROAD synth tool (PR #10473) | ||
| matures. | ||
| """ | ||
| if entry == None or entry.get("blocks"): |
There was a problem hiding this comment.
According to PEP 8, comparisons to singletons like None should always be done with is or is not, never the equality operators.
if entry is None or entry.get("blocks"):
References
- PEP 8: Comparisons to singletons like None should always be done with is or is not, never the equality operators. (link)
…dules - tools/OpenROAD -> OpenROAD#10812 head (hermetic-llvm toolchain swap); ORFS root mirrors it: toolchains_llvm 20.1.8 -> BCR module llvm 0.8.11. - Mirror tools/OpenROAD's root-only single_version_overrides (abc, bison, boost.icl, gawk, tcl_lang) plus m4/sed fix releases for the same gnulib libc-header class; override patches must live in the main repo, so they are copied to patches/openroad-deps/. - Mirror the rules_pycross 3.13 environments workaround (root-honored only). - bazelisk run @bazel-orfs//:bump: 3a5ddd7 -> 970ff81; drop patch 0001 (landed upstream as bazel-orfs bfd3a1d). - Pin kepler-formal (hermetic-llvm bazel build, keplertech main) via git_override and consume bazel-orfs's lec module as bazel-orfs-lec. - Carry two new bazel-orfs patches: orfs_canon_verilog (pre-synthesis Verilog from the canonicalize RTLIL checkpoint) and the lec module expansion (build-time lec_check + instant lec_status_test + stage netlist extraction script). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
The bazel-orfs bump validates orfs_flow sources= against
variables.yaml and my LEC aggregates force-load every design package,
surfacing latent gaps:
- Declare IO_{NORTH,SOUTH,EAST,WEST}_PINS (ihp-sg13g2 pad.tcl) and
ADDITIONAL_{FAST,SLOW,TYP}_LIBS (flow/Makefile corner libs) in
variables.yaml; regenerate variables.json.
- gf180/aes{,-hybrid}: DESIGN_TYPE (private-PDK DRC hook) via
user_arguments; BC/TC/WC_ADDITIONAL_LIB_FILES make helpers via
local_arguments.
- microwatt, chameleon: VERILOG_FILES_BLACKBOX is source-typed, route
through user_sources instead of local_arguments.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Every design gets manual-tagged equivalence checks that run at build time (cached lec_check actions) with instant verdict tests: - <n>_lec_synth: canonicalized RTL (yosys canonicalize checkpoint -> <n>_canon_v) vs the yosys netlist, SEC via kepler-formal's pre-synthesis .v support. kepler-formal never parses raw (System)Verilog, so a failure implicates synthesis, not canonicalization. - <n>_lec_<stage>: adjacent-pair gate-level LEC synth<->floorplan<-> place<->cts<->route<->final on netlists written from each stage odb (physical-only cells removed; -hier for OPENROAD_HIERARCHICAL). - <n>_syn_lec_synth (flat designs): OpenROAD built-in synth netlist vs the same canonicalized RTL. - //flow:lec_check + //flow:lec_test aggregates; single-corner <pdk>_lec_libs liberty sets; README documents build-then-test and --jobs throttling. - _emit_syn_variant: split user/local config.mk vars out of DESIGNS entries so variables.yaml validation only sees ORFS variables. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
First real kepler-formal runs on gcd/asap7 surfaced two issues with the canonicalized-RTL gold: - format: verilog uses naja's structural netlist parser, which rejects behavioral constructs (reg declarations, always blocks). Add a format attr to lec_check and use sv2v for the pre-synthesis checks: gold goes through the SystemVerilog (slang) frontend, gate through the netlist parser. - yosys write_verilog renders $pmux as a Verilog function, which naja's lowering rejects in continuous assigns. pmuxtree in orfs_canon_verilog lowers $pmux to plain mux trees first. With these, gcd pre-synthesis SEC passes: 'No difference was found. SEC proved equivalence at k = 3', 100% checked-output coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
The legacy engine was inconclusive on uart after 28 minutes at k=32; pdr proves the same check at k=1 in seconds. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
yosys write_verilog emits memory/ROM init as 'initial' blocks, which kepler-formal's naja lowering rejects (aes sbox/rcon ROMs, ibex decoder table). memory_map lowers ROMs to logic and memories to FF arrays — the same fate synthesis gives them — so the pre-synthesis gold stays within the supported subset. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
SYNTH_WRAPPED_OPERATORS keeps unused adder-architecture modules in the
yosys netlist, leaving kepler-formal's top inference with multiple
roots ('No top design was found' on ibex, mock-alu). The
OpenROAD-written netlist from 1_synth.odb has only the linked design,
also covers the ODB import, and matches every later stage's gate side.
With this, mock-alu pre-synthesis SEC passes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
aes proved 'equivalence' with 0.78% output coverage (128/129 outputs skipped as design0 multi-driver connectivity) — a PASS that skips most outputs is much weaker than a full proof, so lec_check now records the coverage line in the .status artifact and lec_status_test accepts the annotated verdict. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
@nanocoh @maliberty I asked Claude to take kepler-formal for a spin on ORFS. @nanocoh To take this forward, someone has to slug through the results on the kepler-formal side, probably fix a few things in kepler-formal. Also, there's pre-requisite work that needs to land like LLVM hermetic toolchain. Closing for now, out of sight out of mind. |
Draft / experimental — not ready for review.
Wires kepler-formal LEC into the ORFS bazel flow as per-design, per-stage equivalence checks.
Rides on:
tools/OpenROADsubmodule points at the PR head, so CI submodule clones may trip until it merges..vsupport (RTL-vs-gate SEC viasv2v)._synvariant work from flow: add OpenROAD built-in synth as _syn variant of every flat design #4253 (carried here; closed unmerged).What this does
bazelisk run @bazel-orfs//:bump(3a5ddd7 → 970ff81, patch 0001 dropped — landed upstream) + OpenROAD submodule → PR 10812 head; ORFS root switchestoolchains_llvm→ hermetic-llvm to match, mirroring the root-onlysingle_version_overrides (abc/bison/boost.icl/gawk/tcl_lang, plusm4/sedfix releases for the same gnulib class) and the rules_pycross workaround.MODULE.bazel(git_override, no submodule use); bazel-orfs'slecmodule consumed asbazel-orfs-lecwith an expansion patch carried inpatches/bazel-orfs/(to be upstreamed): build-timelec_check+ instantlec_status_test+lec()macro + generic stage-netlist extraction, andorfs_canon_verilog(canonicalize RTLIL → pre-synthesis Verilog).bazelisk build //flow:lec_check --jobs=N) so verdicts+logs cache;<design>_lec_<stage>_testtargets only assert the recorded verdict — instant, no test timeouts (33 tests over the verified designs run in ~0s each).sv2v,pdrengine), then adjacent-pair gate LEC synth↔floorplan↔place↔cts↔route↔final on OpenROAD-written netlists (physical-only cells removed)..v(yosys canonicalize checkpoint →proc; pmuxtree; memory_collect; memory_map; write_verilog), so kepler never parses raw (System)Verilog edge cases — a failure implicates synthesis, not canonicalization._synvariant) netlist against the same gold.OPENROAD_HIERARCHICAL=1) designs (ibex, mock-alu, …) exercise-hierread/write throughout.Usage
Results (asap7)
All 33 built checks report PASS; the per-stage gate-level chain is clean on every design tried, including the
-hierones.Notable findings — summary
legacySEC engine is not usable in practice: inconclusive on uart after 28 min at k=32;pdrproves the same check at k=1 in seconds. pdr is the default here.$pmux-as-function (pmuxtree),initial-block ROM/reg init (memory_map), and multi-root top inference (use the OpenROAD-written1_synth.odbnetlist as gate side).*io_out_REG*) and ibex (elaboration); riscv32i's base partitioned yosys synth is broken at the new bazel-orfs pin.No kepler-formal source patches ended up necessary for the basic asap7 designs — every blocker was either avoidable in gold preparation or is a genuine finding for upstream.
Findings — detail
kepler-formal (gaps to feed back upstream):
format: verilognetlist parser rejects behavioral RTL (reg [0:0] x;→ parse error). The pre-synthesis path must usesv2v(slang frontend for gold). Wired accordingly.write_verilogrenders$pmuxas a function. Dodged withpmuxtreeinorfs_canon_verilog.initialblocks unsupported (onlyalways*lowered): yosys emits ROM/memory init asinitial(aes sbox/rcon, ibex decoder). Dodged withmemory_map— ROMs become logic, memories FF arrays, same fate synthesis gives them.SYNTH_WRAPPED_OPERATORSkeeps unused adder-architecture variants in1_2_yosys.v(ibex, mock-alu). No explicit-top option exists forverilogmode (only SV flists have--sv_design*_top). Dodged by using the OpenROAD-written netlist from1_synth.odbas gate side (linking drops unused modules) — arguably better anyway: it also covers the ODB import and matches all later stages.legacy) SEC engine is weak: inconclusive on uart at k=32 after 28 min;pdrproves the same check at k=1 in seconds.pdris now the default for the pre-synthesis checks here.lec_checknow records the coverage line in the.statusartifact next to the verdict. Root-causing the multi-driver extraction on the canonicalized gold is the top kepler-formal item this PR surfaces.OpenROAD built-in synth (
_synvariant; pre-existing, not LEC bugs):8. mock-alu: design SDC
*io_out_REG*wildcard doesn't resolve after built-in synthesis (Error: Could not find *io_out_REG*) — register naming differs from yosys.9. ibex:
sv_elaboratefails ([ERROR SYN-0001] Elaboration failed, synth_syn.tcl:58).Infrastructure fallout fixed along the way:
sources=against variables.yaml and the LEC aggregates force-load every design package: declaredIO_{NORTH,SOUTH,EAST,WEST}_PINSandADDITIONAL_{FAST,SLOW,TYP}_LIBSin variables.yaml (real ORFS/platform variables that were missing); routedDESIGN_TYPE,BC/TC/WC_ADDITIONAL_LIB_FILES,VERILOG_FILES_BLACKBOXthroughuser_arguments/user_sources/local_argumentsin the affected design BUILDs;_emit_syn_variantnow splits user/local config.mk vars likeorfs_designdoes.sedfailed to compile under hermetic-llvm (gnulib libc-header shadowing, BCR #7642);sed@4.9.bcr.5carries the fix.load_json_filerepository rule does not re-fetch whenvariables.yamlchanges (repository_ctx.pathwithout a read); neededbazelisk fetch --force. Upstream bazel-orfs bug.¹ PASS with most outputs skipped by extraction limitations — see finding 6.
² ³ Built-in synth (
_syn) fails before LEC runs — findings 8/9.⁴ riscv32i's base yosys flow fails at the new bazel-orfs pin before any LEC: partitioned synthesis dies with
per-module checkpoint missing: partition_magcompare2c_canonical.rtlil(parallel_synth.mk:31 do-yosys-partition) — bazel-orfs parallel-synth issue, independent of this PR's wiring.🤖 Generated with Claude Code