From e1f66af19269a55c4332ddd203830b75dbc0a568 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 28 Jun 2026 19:24:35 +0100 Subject: [PATCH 1/3] Add design plan for std-cell origin tracking (&nf) Follow-on to PR #487. Documents the verified gap (the &nf standard-cell mapper is not vOrigins-instrumented, and LibreLane's classic abc/BLIF channel loses AIG object identity), and scopes the minimal ABC change: instrument &nf via a Gia_ManOriginsDupNf helper mirroring Gia_ManOriginsDupIf, reusing the existing "y"-extension emission. Co-developed-by: Claude Code v2.1.195 (claude-opus-4-8) --- STDCELL_ORIGIN_TRACKING_PLAN.md | 149 ++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 STDCELL_ORIGIN_TRACKING_PLAN.md diff --git a/STDCELL_ORIGIN_TRACKING_PLAN.md b/STDCELL_ORIGIN_TRACKING_PLAN.md new file mode 100644 index 0000000000..a1bf543ea7 --- /dev/null +++ b/STDCELL_ORIGIN_TRACKING_PLAN.md @@ -0,0 +1,149 @@ +# Plan: Origin tracking through standard-cell mapping (`&nf`) + +Status: **draft / design** — follow-on to PR #487 (per-object origin tracking, `vOrigins`). +Branch: `origin-tracking-stdcell` (base: `origin-tracking-clean`). + +## Goal + +Make `\src` provenance survive **standard-cell** technology mapping so that an +ASIC flow (e.g. LibreLane → sky130/gf180) can label each mapped gate with the +RTL source location it came from. + +PR #487 + the yosys `src-retention-y-ext` branch already deliver this for the +**FPGA / LUT** path: yosys writes XAIGER, ABC propagates `vOrigins` through the +LUT mapper (`&if`) and optimization, ABC writes the `"y"` extension, and yosys +applies `\src` to `$lut` cells. Validated end-to-end by +`tests/techmap/abc9_src_retention_full.sh` (100% of LUTs tagged). + +The standard-cell path is **not** covered. This plan closes the ABC-side gap and +scopes the companion yosys work. + +## Verified current state (why std-cell doesn't work today) + +1. **`&nf` (the std-cell mapper, `src/aig/gia/giaNf.c`) is not origin-instrumented.** + `grep -c Origin src/aig/gia/giaNf.c` = 0. PR #487 instrumented the LUT + mappers (`giaIf.c`, `giaJf.c`, `giaLf.c`) and the optimization passes + (`giaAig.c` dc2/dch, `giaMfs.c`, `giaBalAig.c`, `giaHash.c`, `giaDup.c` `&st`, + …) but never the `&nf` cell mapper. + +2. **The emission channel already exists.** `Gia_AigerWriteS` (`giaAiger.c:1876`) + writes `vOrigins` as the variable-length `"y"` extension. If a mapped GIA + carries `vOrigins`, `&write` emits them for free. + +3. **The LUT instrumentation template is small and local.** + `Gia_ManOriginsDupIf(pNew, p, pIfMan)` (`giaDup.c:458`) walks the `If_Man_t` + objects, and for each source object `i` with origins, unions them into the + mapped object `Abc_Lit2Var(pIfObj->iCopy)` of `pNew`. An `&nf` analogue needs + the equivalent source→mapped-node correspondence from `Nf_Man_t`. + +4. **LibreLane's std-cell flow uses the classic `abc` pass over BLIF, not XAIGER.** + yosys `passes/techmap/abc.cc:1017`: `read_blif input.blif;