Skip to main content

PyPi CI Coverage GitHub issues DOI

KLayout-PEX

KLayout-PEX is a parasitic extraction tool for KLayout. There a multiple engines supported:

  • FasterCap (requires FasterCap installation)
  • MAGIC wrapper (requires MAGIC installation)
  • 2.5D engine (under development)

Check out the documentation website for more information.

Install

pip install klayout-pex

After that, you should be able to run kpex --help.

Port labels

kpex extract --port-labels auto uses top-level labels for ports when the top cell has a label on a pin shape. Otherwise, it retains ports from labels in child cells. --port-labels top always uses top-level labels. Both preserve existing ports named by top-level text labels without pin shapes, and the substrate port. Labels in child cells still name internal nets and ports of excluded device models.

The default is auto. Supply --gds alongside --lvsdb to identify top-level labels: the LVS database has flattened them. With --lvsdb alone, auto retains hierarchical labels, and top reports an error.

Capacitance output modes

The analytical engine keeps coupled capacitance by default. Select the approximation explicitly:

Command options Capacitance written to the netlist
--2.5D --mode CC Coupled capacitance, one node per net
--2.5D --mode C Floating capacitance eliminated exactly, then inter-net coupling grounded
--2.5D --mode CC --coupling grounded Same capacitance policy as C
--2.5D --mode RC Coupled capacitance distributed onto the resistance networks
--2.5D --mode RC --coupling grounded Floating capacitance eliminated exactly, then inter-net coupling grounded at distributed nodes
--2.5D --mode R Resistance without extracted capacitance

--coupling coupled explicitly selects the existing CC or RC behavior. --mode C requires grounded if --coupling is also specified. No coupling threshold or switching multiplier is applied.

Floating conductors

Conductors without a port or retained device terminal are electrically floating. For C, their capacitance is eliminated by an exact capacitive star-mesh reduction before any coupling is grounded. For example, A ↔ F = 2 fF and F ↔ reference = 2 fF, with floating F, produce a 1 fF load from A to reference. F is removed, rather than held at reference. A floating component connected to only one retained node contributes no load there.

The log lists eliminated floating nets so an unintended disconnected rail remains visible. Ports created by labels and exclusion blocks remain observable. Explicit exclusion-marker settings retain their existing contract, including the treatment of floating metal inside a marker.

For RC, capacitor-only floating conductors are also eliminated exactly. A floating island with extracted resistance is rejected: its frequency-dependent behavior cannot generally be represented by a single capacitance. Use --coupling coupled to retain its dynamics, or --mode C to use the ideal-conductor capacitance model. All retained resistors keep their values and node connections.

Exact elimination uses the shared reduction limit of 64 neighbors per eliminated node to bound fill-in. A node still above that limit after other floating nodes are removed produces a diagnostic that recommends coupled output. The grounded modes never replace a remaining floating conductor with a ground tie.

Grounded inter-net coupling

After floating-node elimination, each inter-net pair is replaced by its full capacitance to the reference at each endpoint. For example, A ↔ B = 2 fF, A ↔ reference = 1 fF and B ↔ reference = 3 fF become 3 fF from A to reference and 5 fF from B to reference.

This preserves the reduced capacitance matrix's diagonal at each retained node with the other nodes clamped to reference. It removes inter-net transfer admittance and does not represent switching-dependent Miller effects or preserve arbitrary distributed-RC terminal impedance. Capacitance between distributed nodes of the same net stays between those nodes, including capacitance created by eliminating a floating conductor, so the internal RC dynamics are retained.

The reference is the layout's substrate net, including its distributed nodes, or VSUBS when no substrate net is available. It is not implicitly SPICE node 0. Existing capacitance to reference nodes stays on those nodes. New grounded loads use the substrate's ideal net.

The policy changes CSV, SPICE and VACASK netlists after spatial distribution and before reduction. Reduction checks compare the approximated network with its reduced version. Geometry reports and --check-device-caps continue to describe the coupled extraction.

Intentional capacitor models remain unchanged with --blackbox y. The default remains --blackbox n: if the layout contains metal capacitors whose models would be removed, grounded output reports an error before capacitance extraction and asks for --blackbox y. Bare interconnect layouts work with either setting. This prevents grounding the intended terminal coupling of a white-boxed capacitor.

These policies apply to --2.5D. They do not change MAGIC, FasterCap or FastCap2 output. Existing CC, RC and R defaults are unchanged.

Metal-capacitor models with field solvers

FasterCap and FastCap2 reject --blackbox y when the extracted netlist would retain a mapped metal-capacitor model. Their field matrix contains the intrinsic plate capacitance, which would otherwise be added in parallel with the model. Exclusion markers alone do not establish which plate and enclosure geometry belongs to that intrinsic capacitance.

Use --2.5D --blackbox y to retain the compact models and extract their external coupling. Use --blackbox n with a field solver when the intended result replaces those models with full-geometry capacitance. Field-solver runs without retained metal-capacitor models remain supported, including devices explicitly removed by --cut.

Grounding an existing SPICE netlist

netlist ground applies the same floating elimination and grounding policy without a layout or PDK:

netlist ground coupled.spice --reference sub! --out-netlist grounded.spice

The reference is required. It must be a node, port or global in the selected scope, or 0/gnd. SPICE ground aliases 0 and gnd identify the same conductor, including distributed reference nodes. By default, the command selects Cext_* and Cgrnd_* capacitors and uses Rext_* resistors to identify distributed conductors. Resistor lines stay unchanged. Intentional devices, unselected elements, directives and other subcircuits remain in the output.

For another extractor's naming scheme, supply explicit name patterns. Each option may be repeated and replaces its respective defaults. Quote patterns to prevent shell expansion:

netlist ground extracted.spice --cell amplifier --reference VSS \
  --capacitor 'Cpar_*' --resistor 'Rwire_*' --keep bias_internal

Ports, global nodes, terminals named by retained devices or sources, and --keep nodes retain their entire conductors. Other conductors are floating. Selected resistors define connectivity within each conductor. If disconnected pieces belong to the same conductor, provide a flat JSON node map, for example {"OUT.1": "OUT", "OUT.2": "OUT"}, using --net-map nodes.json. The map supplies conductor identity without shorting or renaming nodes. It cannot assign different conductors to nodes connected by selected resistors. SPICE names and patterns are case-insensitive.

Use --cell NAME when several subcircuits contain selected capacitors, or --top-level to select elements outside subcircuits. Selected elements must be numeric two-node primitives. Symbolic values, floating resistor islands and excessive floating elimination fail before writing output. The default output name is extracted_grounded.spice; the input cannot be overwritten.

Use coupled input with intentional capacitance represented by retained devices. After white-box extraction has mixed device capacitance with parasitics, postprocessing cannot distinguish them. The transformation intentionally removes inter-net transfer, so an equivalence check against the coupled input is not expected to pass. A subsequent netlist reduce check should use the grounded netlist as its reference.

VACASK conversion

netlist convert --to vacask circuit.spice writes two files:

  • circuit.inc contains the circuit, with instance parameters unchanged
  • circuit.options.inc sets the global geometry scale from .option or .options scale

Include the circuit at the top level and its options inside the testbench's existing control block:

include "circuit.inc"

control
  include "circuit.options.inc"
  analysis op1 op
endc

The scale applies to the entire simulation through compatible models, including those inside external X wrappers. A later options scale command overrides it. Do not combine fragments requiring different scales without first normalizing their model interfaces. The companion is rewritten even at the default scale=1, so reconversion cannot leave an earlier scale active.

--out-netlist derives the companion name from the chosen output path. kpex --netlist-format vacask also writes and reports both files. Numeric SPICE suffixes are converted to plain numbers because the simulators interpret some suffixes differently. Parameter expressions and model libraries remain outside the converter's supported input.

Acknowledgements

This project is funded by the JKU/SAL IWS Lab, a collaboration of Johannes Kepler University and Silicon Austria Labs.

This project had been further funded by the German project FMD-QNC (16ME0831).

This project is further funded by the European project ODE4EC-AMS, which has received funding from the Chips Joint Undertaking (Chips JU) under Grant Agreement No 101252962. Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the Chips Joint Undertaking. Neither the European Union nor the granting authority can be held responsible for them.

Johannes Kepler University: Institute for Integrated Circuits and Quantum Computing            Silicon Austria Labs

Bundesministerium für Forschung, Technologie und Raumfahrt

Co-funded by the European Union            Chips Joint Undertaking

Metadata

Release files for klayout-pex 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for klayout-pex 0.10.0
File Size Uploaded Provenance Actions
klayout_pex-0.10.0.tar.gz 682.0 kB Without provenance Details for klayout_pex-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for klayout-pex 0.10.0
File Interpreter ABI Platform Actions
klayout_pex-0.10.0-py3-none-any.whl Python 3 none any Details for klayout_pex-0.10.0-py3-none-any.whl

Total release size: 1.7 MB

Release files / klayout_pex-0.10.0.tar.gz

Download URL klayout_pex-0.10.0.tar.gz
Size 682.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5a01230d9d19e3fcbc25e0700f7423b36cefccc4725f998f7d0717244fb38ee5
BLAKE2b-256 checksum
How to use checksums
e575451fb6009800cc1189b16c24960e2b1b08daa48c7454a2c1a5f7ef53574e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / klayout_pex-0.10.0-py3-none-any.whl

Download URL klayout_pex-0.10.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
631ad580e56a17320863d06d1e9a19fee23fdbd7947b4bd6b59213f74a3df5f7
BLAKE2b-256 checksum
How to use checksums
a607d3dddb45ab7a06a3be1e959c9b5d118f40190049d37eaece0a0e16c2f72b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for klayout-pex 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page