kfnetlist
kfnetlist is a standalone, Rust-backed netlist schema for kfactory and netlist tooling.
It provides a fast, type-safe data model for circuit connectivity — instances, nets, ports, and arrays — with full JSON/dict serialization and Pydantic v2 integration. The core is implemented in Rust via PyO3 and has zero runtime Python dependencies.
-
Getting Started
Install kfnetlist and build your first netlist in under 5 minutes.
-
Core Concepts
Understand the Netlist data model, port types, and serialization.
-
Extraction
Extract hierarchical netlists, detect shorts and opens, parse L2N results.
-
Guides
LVS verification, equivalent ports, open detection, and common patterns.
Key Features
- Rust core —
Netlist,Net, and port types implemented in Rust for speed and memory safety - Zero runtime dependencies — the base package has no Python dependencies
- Full serialization —
to_json()/from_json()andto_dict()/from_dict()on every type - Pydantic v2 support — all types implement
__get_pydantic_core_schema__ - Equivalent ports — fold electrically-equivalent ports into canonical names for netlist comparison
- Instance flattening — merge sub-cell instances into the parent, reconnecting touching nets
- Port checking —
PortCheckbitmask andcheck_connection()for geometric port-pair comparison - Netlist extraction — extract hierarchical netlists from kfactory/klayout cells
- L2N parsing — convert klayout
LayoutToNetlistresults to JSON-serializable dicts - Short detection — find geometric polygon overlaps between distinct nets
- Open detection — find unconnected ports, singleton nets, and missing nets vs. a reference
- Connectivity verification — complete LVS workflow combining open detection, net comparison, and short detection
Relationship to kfactory
kfnetlist is the netlist data model that kfactory uses internally. It is published as a separate package so that:
- Tools that only need netlist manipulation do not have to depend on kfactory or klayout
- The netlist schema can evolve on its own release cadence
- Downstream projects can consume netlists without pulling in a full layout framework
For end-to-end examples of netlist extraction using kfactory, see the kfactory schematics documentation.