Skip to content

fix(lec): keep public wire names for equiv_make cut-points - #274

Open
Emin017 wants to merge 4 commits into
mainfrom
emin/fix-lec-keep-publich-wire
Open

Emin017 wants to merge 4 commits into
mainfrom
emin/fix-lec-keep-publich-wire

Conversation

@Emin017

@Emin017 Emin017 commented Sep 9, 2026

Copy link
Copy Markdown
Member

What Changed

  • opt_clean -purge in normalize_design stripped internal public wire names, so equiv_make only created port-level $equiv cells and induction had no internal cut-points: every output stayed unproven (pm32: 65/65). Drop -purge so find_same_wires matches internal nets across gold/gate; pm32 now proves 202/202 equiv cells and the flow continues past LEC.

Scope

Select the areas touched by this PR:

  • CLI - command behavior, Typer command surface, output formats, or workspace commands.
  • Flow/runtime - workspace lifecycle, EngineFlow, step execution, logs, metrics, or artifacts.
  • EDA integration - Yosys, ECC-Tools, DreamPlace, KLayout, PDKs, or native/runtime wrappers.
  • Build/package - Nix, PyInstaller, wheels, uv.lock, or release artifacts.
  • CI/release - GitHub Actions, version checks, changelog, or release automation.
  • Tests/docs only

Runtime And Packaging Impact

  • No runtime or packaging impact
  • CLI output or machine-readable contract changed
  • Workspace layout, flow state, or artifact paths changed
  • Native toolchain or wrapper behavior changed
  • ecc-tools or ecc-dreamplace dependency changed
  • PyInstaller, Nix, or release artifact changed

Notes:

Validation

List the commands you ran. Mark checks that are not applicable as N/A.

  • uv run pytest test/
  • uv run ruff check chipcompiler test
  • uv run ruff format --check chipcompiler test
  • PyInstaller smoke: ecc --help, ecc --version, ecc version --json
  • Nix smoke: nix run .#cli -- --help
  • Manual flow smoke: ecc run
  • Other:

Skipped checks and reason:

Checklist

  • I kept the change scoped to ECC.
  • I updated docs or user-facing CLI text where behavior changed.
  • I included lockfile or version metadata updates when dependencies changed.
  • I documented any submodule updates and why they are needed.
  • I did not include local caches, virtual environments, or generated build outputs.
  • I explained skipped validation and remaining risk.

opt_clean -purge in normalize_design stripped internal public wire
names, so equiv_make only created port-level $equiv cells and
induction had no internal cut-points: every output stayed unproven
(pm32: 65/65). Drop -purge so find_same_wires matches internal nets
across gold/gate; pm32 now proves 202/202 equiv cells and the flow
continues past LEC.
@Emin017 Emin017 added this to the 0.1.0-alpha.13 milestone Sep 9, 2026
@Emin017 Emin017 added the bug Something isn't working label Sep 9, 2026
Newer yosys synthesis names FF D-input nets after the register
(<name>_reg_p_D), so equiv_make's find_same_wires pairs them across
gold/gate. They are not equivalent: the golden FF keeps its clock enable
while dfflibmap emulates it with a mux in the gate D cone, and such
false cut-points stay unproven (pm32 on yosys 0.68: 104 unproven).
True D-net matches on plain FFs are likewise unprovable once QN-output
cells remove the Q-wire names. Hide D-input nets of all FF/latch cells
from matching; FF equivalence is carried by the Q-output wire matches.

Verified with the 0.1.0-alpha.12 bundle on pm32: yosys 0.62 and
oss-cad-suite 2026-08-27 (0.68+132) both prove 171/171.
Newer yosys dfflibmap prefers inverted-output (QN) variants on area
ties; the functional Q net is then renamed through the output inverter
and the mapped netlist loses the FF output wire names that yosys LEC
uses as induction cut-points. Exclude QN-only cells from the first
dfflibmap pass (discovered generically from dfflibmap -info output);
FF types without a Q-output alternative are still mapped by the second
pass.

Verified with the 0.1.0-alpha.12 bundle on pm32: yosys 0.62 and
oss-cad-suite 2026-08-27 (0.68+132) both pass synthesis LEC.
Name-based cut-point matching depends on yosys' incidental net naming,
which changes between versions (0.62 vs 0.68 differed on both FF D-net
and Q-net names). Synthesis now records an explicit contract: for every
flip-flop (stable instance name from rename -wire), the Q-output net
name at golden-write time and at final-netlist time, written to
lec_cutpoints.txt next to the golden netlist. Recording runs on a
flattened throwaway copy (design -push-copy/-pop) so names match the
LEC script's normalized view.

run_lec.tcl replays the pairs with equiv_add before opt_clean -purge
(which may merge aliased wires). yosys_lec.builder derives the sidecar
path from the golden netlist path and selects the golden column per
step: postRouteLec's golden side is the mapped netlist, so it reads the
gate column.

Verified on pm32 and NPC (RISC-V CPU) with yosys 0.62 and
oss-cad-suite 2026-08-27 (0.68+132): all four prove fully, and a golden
netlist with all 106 internal cut-point names artificially drifted
still proves 171/171 via the contract.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Synthesis LEC fails with unproven $equiv cells on equivalent netlists (v0.1.0-alpha.12)

1 participant