Skip to content

fix: Cadence parts read their pins from the right section and library, and export_design refuses a pin on two nets - #331

Merged
valentinozegna merged 7 commits into
mainfrom
claude/universal-netlist-pr-verify-zdefgg
Dec 1, 2026
Merged

valentinozegna merged 7 commits into
mainfrom
claude/universal-netlist-pr-verify-zdefgg

Conversation

@valentinozegna

@valentinozegna valentinozegna commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Status: verified on the private corpus as well, and by the reporter of #327 on their own designs. Both checks listed under Testing hold.

Summary

Some Cadence designs put a part's pins on the wrong pin numbers, and then on the wrong nets or on two nets at once. export_design wrote such a design to a file that the same release refused to reload (#327). Two lookups in the .DSN reader picked the wrong definition:

  • Sections numbered -1, -2, ... A part can number its sections with dashes and still name their symbols with letters. Those sections found no pin map, and every pin took its position in the symbol as its number. On BeagleBone AI the processor (U4, AM5729) read 85 of its 760 balls. The record's section index now names the section.
  • One part name in several libraries. A design keeps one definition per part name and source library, and each placed part names its own library. The reader took the first definition under the name, or the design's Packages/ copy. A design holding R from two libraries with opposite pin maps had every resistor's pins swapped. Each part now reads its pin numbers, Pin Ignore flags and pin names from its own library.

A design that still wires one physical pin to two nets is now refused by export_design with the pins and their nets named. Queries on it answer as before.

Changes

  • pin-resolver.ts: a symbol suffix that names no stored pin map resolves by the record's section index; a suffix that names a map still wins.
  • structures.ts, cache-parser.ts, dsn-parser.ts, pin-resolver.ts, component-builder.ts: the placed part's library reference is read, the Cache is indexed per source library, and pin maps and pin names come from the part's own library first.
  • cli/export-design.ts: refuses a netlist with a pin on several nets, naming up to ten pins, and writes nothing.
  • scripts/dsn-definition-check.ts with test/integration/cadence-definitions.test.ts: every placed pin checked against the package and view the file itself names for the part. It needs no export, so it runs on any design.
  • Decision tables: section-pin-map extended, new part-definition.
  • Fixtures (test: add beaglebone-ai and digital-convertor, two Cadence designs that tell a part's sections and libraries apart test-fixtures#18, merged): beaglebone-ai with the netlist of its board, digital-convertor with Capture's own export. test/integration/cadence-references.test.ts compares against both; it fails 4 of 5 on main.
  • Goldens: two new; the two OpenCellular goldens change in pin names on 6 parts, to the names the schematic PDF prints for U33 and U7146.
  • docs/cadence-dsn-format.md: the library join recorded as verified, three claims moved to Refuted, three open questions added.
Design Reference main This branch
BeagleBone AI its board's netlist, 3,135 pins 2,460 match 3,124 match
DIGITAL_CONVERTOR Capture's export, 42 nodes 24 match 42 match
PROIECT_TIE1 Capture's export, 19 nets 3 match 19 match
PROIECT-PCB Capture's export, 30 nets 24 match 30 match

BeagleBone AI's 11 other pins are processor balls on three 1.8 V rails that the board joins and the schematic names apart, as its PDF prints them. The last two designs are public and carry no license, so they are evidence in the spec and stay out of the fixtures.

Related Issues

Closes #327

Refs #328, which stopped the same failure by throwing in the net assembler. Here the refusal sits in export_design, so a design stays readable by every query tool, and the two lookups are fixed where they go wrong.

Decision tables

Behavior change to section-pin-map, and a new table part-definition. Both are in docs/decision-tables/dsn-net-assignment/: the new table is part-definition.csv, with its rules in part-definition.rules.md.

Reproduction: BeagleBone-AI.dsn U4 section C is the instance AM57XC.Normal with section index 2, its pin map stored under AM57X-3. No cell covered it: the table assumed a suffix always names a stored map. The wrong outcome was no map, so pin DDR1_RST was reported as U4.1; the board has it on U4.AG21. The cell is unit_suffix = unmapped, section_index = in-range, sections listed, and its outcome is the section at its index.

$ table.py diff section-pin-map.spec.json <main>.csv section-pin-map.csv
| # | When | Outcome | Next | Cells |
|---|---|---|---|---|
| 1 | unit_suffix = unmapped; section_index = out-of-range / unknown | (new cell) -> no map |  | 18 |
| 2 | unit_suffix = yes; section_index = in-range / out-of-range | n/a -> the section its suffix names |  | 18 |
| 3 | unit_suffix = unmapped; section_index = in-range; sections_listed_under = source / stripped | (new cell) -> the section at its index |  | 6 |
| 4 | unit_suffix = unmapped; sections_listed_under = none | (new cell) -> no map |  | 3 |
| else | everything else | same |  | |

45 of 81 cells changed

$ table.py verify section-pin-map.spec.json section-pin-map.csv section-pin-map.rules.json
81 cells checked, 0 mismatches

$ table.py verify part-definition.spec.json part-definition.csv part-definition.rules.json
12 cells checked, 0 mismatches

How the cells are decided

AGENTS.md (Accuracy and evidence, merged in #332) sets the rule: the vendor's files decide a cell, never a person.

  • A cell is decided when every real placed part that falls in it resolves each pin to the record the file itself names for the part.
  • A cell no real part reaches stays a draft.

scripts/dsn-definition-check.ts reads each part's package by name and library, its section by the cell of its view and then the section index, and its view by name and library, and compares every pin's number, Pin Ignore flag and name with the parser's. Over the 21 fixture designs and 640 public designs: 64,244 placed parts, 220,197 pins, 0 differences.

Table Cell Outcome Real parts Designs
section-pin-map suffix names no map, index in range, sections listed, no A map the section at its index 79 4
section-pin-map suffix names a map, index in range, sections listed, A map the section its suffix names 616 56
section-pin-map suffix names a map, index in range, sections listed, no A map the section its suffix names 134 12
section-pin-map no suffix, index in range, sections listed, A map the section at its index 1,032 143
section-pin-map no suffix, index in range, sections listed, no A map the section at its index 64 5
part-definition own library defines the part, no stream, no other library its own library's definition 50,406 596
part-definition own library defines the part, no stream, another library too its own library's definition 8,234 126
part-definition own library defines the part, Packages/ stream holds it its own library's definition 3,085 134
part-definition own library defines the part, stream and another library too its own library's definition 2,519 94

These 9 cells are decided. The other 76 cells of section-pin-map and 8 of part-definition stay drafts, since no real part reaches them. The one exception is 7 parts of a single design that name no library, which leaves nothing to check them against.

Fixtures:

$ node --import tsx scripts/dsn-definition-check.ts test/fixtures/cadence
21 designs read (1 files not read), 10888 placed parts, 39751 pins
0 designs differ; 0 pins have no number in the file; 0 parts name no library or have no package in theirs

section-pin-map: parts and designs per cell reached
      191    14  yes,in-range,source,source
       70     6  no,in-range,source,source
       25     1  unmapped,in-range,source,none
       24     2  no,in-range,source,none
        4     1  yes,in-range,source,none

part-definition: parts and designs per cell reached
     9247    21  defines the part | none | none
     1368     9  defines the part | none | defines the part
      259    15  defines the part | holds the part | none
       14     5  defines the part | holds the part | defines the part

Public designs (754 .dsn files from public repositories):

640 designs read (114 files not read), 53356 placed parts, 180446 pins
0 designs differ; 469 pins have no number in the file; 7 parts name no library or have no package in theirs

section-pin-map: parts and designs per cell reached
      962   137  no,in-range,source,source
      425    42  yes,in-range,source,source
      130    11  yes,in-range,source,none
       54     3  unmapped,in-range,source,none
       40     3  no,in-range,source,none
       20     5  a single-device map under the name

part-definition: parts and designs per cell reached
    41159   575  defines the part | none | none
     6866   117  defines the part | none | defines the part
     2826   119  defines the part | holds the part | none
     2505    89  defines the part | holds the part | defines the part
        7     1  not named | none | defines the part

The check reports each bug when its fix is removed. These are excerpts of its output on the fixtures:

=== section-index fallback removed
beaglebone-ai/BeagleBone-AI.dsn: 675 differ

=== own-library lookup removed
BeagleBoard-xM/SCH/BeagleBoard-xM_ORCAD.DSN: 1 differ
  P06_PMIC_PERIPH Y3 QUARTZ-32KHz-CM200S_0.Normal pin 2: name 3, the file has 2
digital-convertor/DIGITAL_CONVERTOR.DSN: 36 differ
  digitalconvertor R1 R.Normal pin 1: number 1, the file has 2
opencellular-sdr-reused-refdes/OC_CONNECT1_SDR_REV_C_REUSED_REFDES.DSN: 14 differ
  PAGE 17 : USB3 SWITCH U721 CBTL02043B_0.Normal pin 6: name AO_N, the file has A0_N

That check shows the parser follows the file's own links. Capture's exports show those links are the ones Capture uses:

  • The join. Every node of a pstxnet.dat names its instance, library and view (INS350@ANALOG.R.NORMAL). On the 61 designs whose export corresponds to the design, all 28,015 nodes name the library the part's record names.
  • The outcome. On the 54 public designs that ship an export, nets with the export's pins go from 1,341 to 1,392 of 1,706, pin numbers from 6,622 to 6,626 of 6,629, pin names from 2,935 to 2,957 of 3,158. 38 of those exports hold every net and part of their design: none loses a net, a pin number or a pin name, and 4 reach all their nets (PROIECT_TIE1, PROIECT-PCB, PROIECT_APD_SCHEMATIC_ANALOG from 4.2%, LIDARPROJECT from 95.7%). One export scores lower on pin names, PROIECT1: it is of another revision, and none of its 135 nodes names an instance of the design.
  • The section index. The only export for a lettered section of a dash-numbered part is BeagleBone AI's board netlist: 3,124 of 3,135 pins.

Replay: net-assignment.table.test.ts, 120 tests passing.

Verification

Verdict: PASS. Built the packaged binary from this branch (scripts/build-binary.sh host <dir>/universal-netlist packaged, Bun 1.4.4) beside one built from main, and drove the CLI and the MCP server over stdio.

CLI, the main build against this branch. Sections 1 to 3 use the new fixtures; section 4 uses two public designs outside the fixtures (LABCOMM_PROJECTON.DSN, SCR-236.dsn):

### 1. query_component U4 on BeagleBone AI (board netlist: DDR1_RST is U4.AG21, 760 balls)
-- main: pins 367 | DDR1_RST is pin ['1 on net F2_GPIO4_1'] | first keys ['1', '2', '3', '4']
-- branch: pins 760 | DDR1_RST is pin ['AG21 on net DDR1_RST'] | first keys ['W22', 'V23', 'W19', 'W23']
### 2. export_design on BeagleBone AI, then reload the written file
-- main: export exit 0; reload: {"error":"bbai-main.netlist.json: net 'NC' lists U4.74, but U4.74 is on 'AG6_GPIO3_10'"}
-- branch: export exit 0; reload: 50 nets, first ['1V8_PHY_HDMI', '1V8_PHY_LDO3', '1V8_PHY_LDO4']
### 3. DIGITAL_CONVERTOR R9 (Capture export: R9.1 on GND)
-- main: {'1': 'N00651', '2': 'GND'}
-- branch: {'1': 'GND', '2': 'N00651'}
-- branch export + reload of DIGITAL_CONVERTOR: export exit 0; reload: {'1': 'GND', '2': 'N00651'}
### 4. Off the happy path: a pin wired to two nets (not fixable by the parser)
-- main export: exit 0; reload: {"error":"l-main.netlist.json: net '+10V' lists U10.4, but U10.4 is on 'N5769'"}
-- branch export: {"error":"U10.4 is on 2 nets (+10V, N5769); U10.11 is on 2 nets (-10V, N5793). A Universal Netlist gives each pin one net, so this design cannot be exported until each pin is wired to one net."}
 exit 1 | file written: no
-- branch export SCR-236: {"error":"U9.14 is on IN_VCC and also left unconnected; U9.7 is on GND_PT_IN and also left unconnected; U11.14 is on IN_VCC and also left unconnected; U11.7 is on GND_PT_IN and also left unconnected. A Universal Netlist gives each pin one net, so this design cannot be exported until each pin is wired to one net."}
 exit 1 | file written: no
-- branch queries still answer: {'1': 'N03773', '2': 'N03756', '3': 'GND', '4': 'N5769', '5': 'GND', '6': 'N03794'}
-- branch, unknown part: {"error":"Component 'R99' not found in design 'DIGITAL_CONVERTOR'. Use list_components() or search_components_by_refdes() to find available components."}
 exit 1
-- branch, reused refdes still refused first: {"error":"R4003 is used by 2 different parts, on pages PAGE 25 : REG_12V_3P7V_LDO_3P3V; U9
 exit 1

MCP over stdio, this branch:

initialize -> {'name': 'netlist-mcp-server', 'version': '0.0.0-development'}
tools/list -> 15 tools; export_design offered: False
query_component U4 -> isError False | pins 760 | DDR1_RST: ['AG21 on DDR1_RST'] | AG6: AG6_GPIO3_10
query_xnet_by_pin_name U4.AG21 -> isError False | {"design_variant": "<Default>", "starting_point": "U4.AG21", "net": "DDR1_RST", "total_components": 4, "unique_configurations": 3, "components_by_mpn": [{"total_count": 2, "mpn": "D2516EC4BXGGB", "manufacturer": "KINGSTON", "descr
query_xnet_by_pin_name U4.1 (an ordinal main invented) -> isError False | {"error": "Pin 'U4.1' not found. Component U4 has pins: [A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A2
query_component R9 -> isError False | {'1': 'GND', '2': 'N00651'}
query_component R99 -> isError False | {"error": "Component 'R99' not found in design 'DIGITAL_CONVERTOR'. Use list_components() or search_components_by_refdes

A later commit moves the definitions block of the design parser into readPartDefinitions, unchanged. The binary rebuilt after it gives the same netlist hash as the build above on four fixtures, and the same answers:

U4 (branch, rebuilt): pins 760 | DDR1_RST is pin ['AG21 on net DDR1_RST']
R9: {'1': 'GND', '2': 'N00651'}
export + reload BeagleBone AI: export exit 0; reload pins 760
two-net design: {"error":"U10.4 is on 2 nets (+10V, N5769); U10.11 is on 2 nets (-10V, N5793). A Universal Netlist gives each pin one ne
 exit 1 | file written: no
identical to the build verified before the refactor: True True True True 

Beyond the binary: 774 .dsn files (the 20 earlier fixture designs and 754 from public repositories) were parsed on main and on this branch. 659 parse on both, and 53 netlists change. Designs that list a pin under two nets go from 15 to 10; the 10 that remain are described in the spec's open questions (§11), with Capture's own design-check messages for them.

Testing

  • Added/updated tests
  • npm run type-check passes
  • npm run lint passes
  • npm test passes, with one exception local to the container it ran in: 3,268 passed and 1 failed. The failure is src/service/cache.test.ts "answers a miss, and does not throw, when the directory cannot be written". It fails the same way on main there, because the container runs as root and a read-only directory stays writable. CI's build passes.

Run on the private corpus before merge:

  • node --import tsx scripts/dsn-definition-check.ts <corpus>: no design should differ
  • node --import tsx scripts/dsn-vs-dat-coverage.ts <corpus>: no design with a corresponding export should lose a net, a pin number or a pin name against main

Checklist

  • Code follows project style guidelines
  • Self-reviewed the code
  • Added documentation if needed

🤖 Generated with Claude Code

https://claude.ai/code/session_01CX9foYVQXcQCGbXw6hXDGn

…ction and the right library

Two lookups picked the wrong definition, and a pin then landed on the wrong
net, or on two.

A section whose symbol name ends in a letter while its part numbers the
sections -1, -2, ... found no pin map, and every pin took its position in the
symbol as its number. BeagleBone AI's processor read 85 of its 760 balls. The
record's section index now names the section.

A part's definition was the first one cached under its name. The Cache keeps
one per source library and each placed part names its own, so a design holding
R from two libraries with opposite pin maps had its resistors' pins swapped.
Capture's exports follow the part's own library, also over the Packages/ copy.

Both are checked against outside references: BeagleBone AI against the netlist
of its board, the digital convertor against Capture's export.

Refs #327

Claude-Session: https://claude.ai/code/session_01CX9foYVQXcQCGbXw6hXDGn
… writing a file it cannot reload

A schematic can wire one physical pin to two nets, which Capture's design
check reports as an error. The parsed netlist lists the pin under both, and
exporting it wrote a Universal Netlist that the reader then rejected. The
export now names the pins and their nets and writes nothing; queries on the
design answer as before.

Fixes #327

Claude-Session: https://claude.ai/code/session_01CX9foYVQXcQCGbXw6hXDGn
The beaglebone-ai and digital-convertor fixtures are on test-fixtures main
(IntelligentElectron/test-fixtures#18), with the same content the branch
commit had.

Claude-Session: https://claude.ai/code/session_01CX9foYVQXcQCGbXw6hXDGn
…, and decide the table cells real files reach

A placed part names its package, library, view and section, and the file holds
the package and view it means. scripts/dsn-definition-check.ts walks those
links directly and compares each pin's number, Pin Ignore flag and name with
what the parser resolves. Over the fixtures and 640 public designs it finds
no difference on 220,197 pins; with either lookup fix removed it reports the
pins that fix corrects. The fixture test runs it on every Cadence fixture.

The cells of section-pin-map and part-definition that real parts reach are
decided on that check and on Capture's exports. The cells no real part
reaches stay drafts.

readPartDefinitions is the definitions block of the design parser, moved
out unchanged so the check reads the same index the parser builds.

Refs #327

Claude-Session: https://claude.ai/code/session_01CX9foYVQXcQCGbXw6hXDGn
…maintainer

A vendor format is a fact, so a reading of it is proven or not yet proven, and
no reading is a choice for a person. AGENTS.md now says so: an agent decides
from real vendor data, records what is unproven as an open question, and uses
decision tables as its own instrument for covering every case. A cell is
decided when every real case in it is verified, and stays a draft until then.

Claude-Session: https://claude.ai/code/session_01CX9foYVQXcQCGbXw6hXDGn
The test parses a 2.8 MB Cadence design through the command line, which takes
several seconds, and it ran under the default 5 s limit. It timed out on a CI
runner after passing twice.

Claude-Session: https://claude.ai/code/session_01CX9foYVQXcQCGbXw6hXDGn
@valentinozegna
valentinozegna merged commit 12f337c into main Dec 1, 2026
3 checks passed
@valentinozegna
valentinozegna deleted the claude/universal-netlist-pr-verify-zdefgg branch December 1, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export/reload inconsistency: conflicting physical pin assignments produce unreadable JSON

1 participant