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.

New calibration runs require FasterCap 6.4.0 or later for its numerical corrections. Ordinary extraction warns when an older version is used. Existing 6.3 numerical reports remain collectable with their recorded solver version and original precision. Recompute calibration measurements with the corrected solver before using them to fit coefficients.

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.

Devices without simulation mappings

Netlist export stops by default when a retained LVS device has no model mapping in the technology data. To extract parasitics while keeping these devices for later model integration, opt in explicitly:

kpex extract --pdk sky130A --gds design.gds --2.5D --mode CC --unmapped-devices keep

keep uses KLayout's native LVS representation, including the class name as the model name, terminal connections and the parameters emitted by its native writer. For native resistors and capacitors, this includes their primary resistance or capacitance but can omit secondary geometry parameters. Custom device classes become subcircuit calls. The log and netlist warn about unmapped devices. Supply compatible models yourself, checking the device type, terminal order, parameters and units: the retained representation is not necessarily directly simulatable.

Existing valid mappings still apply. Invalid existing mappings remain errors, and the option does not bypass extraction or connectivity checks. --unmapped-devices error explicitly selects the default. This controls netlists written by KPEX, not MAGIC's own netlist writer.

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.

Technology and corner terminology

The technology catalog separates independently sourced inputs. Their combination is explicit; a matching name alone does not establish correlated process variation.

Term Meaning in KPEX
Process stack Conductor and dielectric geometry and material parameters used to construct the field-solver model
Resistance parameters Sheet-resistance and per-contact/per-cut values, with any explicitly specified dimensional corrections
Capacitance model Equations or coefficient tables relating geometry to capacitance, with their stated assumptions and range of validity
Extraction corner An identified set of extraction parameters representing a specified process condition
Sensitivity analysis Deliberately varying selected parameters while holding others fixed, without assuming a correlated process corner
Technology scenario The KPEX catalog's explicit selection of resistance, capacitance, process-stack and optional device-reference datasets

Source review establishes where parameters came from and whether they apply to the selected process option. Numerical checks assess the implemented calculation under their test conditions. Neither alone establishes agreement with silicon measurements. The catalog records remaining assumptions and unsupported geometry explicitly.

Terminology references: OpenRCX extraction and process corners, SKY130 material dimensions, and GF180MCU electrical parameters.

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.11.1

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.11.1
File Size Uploaded Provenance Actions
klayout_pex-0.11.1.tar.gz 721.1 kB Without provenance Details for klayout_pex-0.11.1.tar.gz

Built distribution (wheel)

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

Total release size: 1.8 MB

Release files / klayout_pex-0.11.1.tar.gz

Download URL klayout_pex-0.11.1.tar.gz
Size 721.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4ca7b50de44980c6b6d96ab953030e384c7f23dab36e55f1e66dcace66ca5952
BLAKE2b-256 checksum
How to use checksums
7f3b03274274c0e4a5ef29042d7c15efe49c96f97d4bb16424b528fc362e89c8
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.11.1-py3-none-any.whl

Download URL klayout_pex-0.11.1-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
72852110d618379ee762a5a495c181b34b9e885f890802d6fabe6e19a2057f95
BLAKE2b-256 checksum
How to use checksums
f0e8f2989c5432a78c9064ca76aa6495997ecc96c2041da4c6a1e4d4b7530e8d
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.11.1

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.11.1 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