Skip to content

Add kfnetlist parser and bump to 0.18.0#114

Merged
flaport merged 1 commit into
gdsfactory:mainfrom
ThomasPluck:feat/kfnetlist-parser
May 18, 2026
Merged

Add kfnetlist parser and bump to 0.18.0#114
flaport merged 1 commit into
gdsfactory:mainfrom
ThomasPluck:feat/kfnetlist-parser

Conversation

@ThomasPluck
Copy link
Copy Markdown
Contributor

Summary

  • Adds parse_kfnetlist() and parse_kfnetlist_recursive() to sax.parsers for converting kfnetlist netlists into SAX format
  • Accepts kfnetlist Netlist objects, to_dict() dicts, and to_json() strings
  • Handles array instances (maps kfnetlist's 1-based ia/ib PortArrayRef to SAX's 0-based <i.j> convention)
  • Handles multi-member nets by decomposing into SAX connections + ports
  • Supports hierarchical designs via parse_kfnetlist_recursive() (natural match for kfnetlist.extract.extract() output)
  • Bumps version from 0.17.0 → 0.18.0

Test plan

  • 33 new tests covering:
    • Parsing from object, dict, JSON (all three input formats)
    • Instance conversion (component, settings, array, 1x1 array elision)
    • Connection mapping (internal connections, external ports, MZI topology)
    • Array port references (collapsed PortRef, explicit PortArrayRef, 2D arrays)
    • Recursive netlist parsing (from dicts, JSON, kfnetlist objects)
    • End-to-end circuit simulation (MZI matches native SAX netlist, straight chain, 1-port, settings)
    • JSON/dict round-trips
    • Edge cases (empty netlist, no nets, settings value preservation)
  • All 147 tests pass (33 new + 114 existing, zero regressions)

🤖 Generated with Claude Code

New `parse_kfnetlist` and `parse_kfnetlist_recursive` functions convert
kfnetlist Netlist objects (or their dict/JSON representations) into SAX
RecursiveNetlist format. Handles instance settings, array instances with
PortArrayRef-to-<i.j> index mapping, and multi-member net decomposition
into SAX connections + ports. Includes 33 tests covering format
equivalence, end-to-end circuit simulation, and parity with native SAX
netlists. Bumps version to 0.18.0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@flaport flaport merged commit e718bf3 into gdsfactory:main May 18, 2026
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.

2 participants