Metadata-Version: 2.4
Name: klayout-pex
Version: 0.9.0
Summary: Parasitic Extraction Tool for KLayout
License-Expression: GPL-3.0-or-later
License-File: LICENSE
Keywords: electronic,pex,parasitic,extraction,vlsi,eda,ic,spice,klayout,analog,fsic,gds,FasterCap,magic
Author: Martin Köhler
Author-email: info@martinjankoehler.com
Requires-Python: >=3.12,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Manufacturing
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
Requires-Dist: cairosvg (>=2.7.1)
Requires-Dist: klayout (>=0.30.12)
Requires-Dist: matplotlib (>=3.10.1)
Requires-Dist: packaging (>=24.0)
Requires-Dist: protobuf (>=6.33.5)
Requires-Dist: rich (>=13.9.4)
Requires-Dist: rich-argparse (>=1.6.0)
Project-URL: Bug Tracker, https://github.com/iic-jku/klayout-pex/issues
Project-URL: Homepage, https://iic-jku.github.io/klayout-pex-website/
Project-URL: Repository, https://github.com/iic-jku/klayout-pex.git
Description-Content-Type: text/markdown

<!--
--------------------------------------------------------------------------------
SPDX-FileCopyrightText: 2024-2025 Martin Jan Köhler and Harald Pretl
Johannes Kepler University, Institute for Integrated Circuits.

This file is part of KPEX 
(see https://github.com/iic-jku/klayout-pex).

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: GPL-3.0-or-later
--------------------------------------------------------------------------------
-->
[![PyPi](https://img.shields.io/pypi/v/klayout-pex)](https://pypi.org/project/klayout-pex/)
[![CI](https://github.com/iic-jku/klayout-pex/actions/workflows/ci-cd.yml/badge.svg?branch=main&event=push)](https://github.com/iic-jku/klayout-pex/actions/workflows/ci-cd.yml?query=branch%3Amain)
[![Coverage](https://img.shields.io/badge/coverage-report-blue.svg)](https://iic-jku.github.io/klayout-pex/pycov/)
[![GitHub issues](https://img.shields.io/badge/issue_tracking-github-blue.svg)](https://github.com/iic-jku/klayout-pex/issues)
[![DOI](https://zenodo.org/badge/897408519.svg)](https://doi.org/10.5281/zenodo.17822625)

# KLayout-PEX

KLayout-PEX is a parasitic extraction tool for [KLayout](https://klayout.org).
There a multiple engines supported:
  - FasterCap (requires [FasterCap](https://github.com/iic-jku/FasterCap) installation)
  - MAGIC wrapper (requires [MAGIC](https://github.com/RTimothyEdwards/magic) installation)
  - 2.5D engine (**under development**)

Check out the [documentation website](https://iic-jku.github.io/klayout-pex-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.

## 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:

```text
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](https://research.jku.at/de/projects/jku-lit-sal-intelligent-wireless-systems-lab-iws-lab/), a collaboration of [Johannes Kepler University](https://jku.at) and [Silicon Austria Labs](https://silicon-austria-labs.com).

This project had been further funded by the German project [FMD-QNC (16ME0831)](https://www.elektronikforschung.de/projekte/fmd-qnc).

This project is further funded by the European project [ODE4EC-AMS](https://ode4ec.eu/projects/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.

<p align="center">
  <a href="https://iic.jku.at" target="_blank">
    <img src="https://github.com/iic-jku/klayout-pex-website/raw/main/figures/funding/iic-jku.svg" alt="Johannes Kepler University: Institute for Integrated Circuits and Quantum Computing" width="300"/>
  </a>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <a href="https://silicon-austria-labs.com" target="_blank">
    <img src="https://github.com/iic-jku/klayout-pex-website/raw/main/figures/funding/silicon-austria-labs-logo.svg" alt="Silicon Austria Labs" width="300"/>
  </a>
</p>

<p align="center">
  <a href="https://www.elektronikforschung.de/projekte/fmd-qnc" target="_blank">
    <img src="https://github.com/iic-jku/klayout-pex-website/raw/main/figures/funding/bfmtr-bund-de-logo.svg" alt="Bundesministerium für Forschung, Technologie und Raumfahrt" width="300">
  </a>
</p>

<p align="center">
  <a href="https://ode4ec.eu/projects/ams/" target="_blank">
    <img src="https://github.com/iic-jku/klayout-pex-website/raw/main/figures/funding/eu-cofunded.svg" alt="Co-funded by the European Union" width="300"/>
  </a>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <a href="https://www.chips-ju.europa.eu" target="_blank">
    <img src="https://github.com/iic-jku/klayout-pex-website/raw/main/figures/funding/chips-ju.png" alt="Chips Joint Undertaking" width="300"/>
  </a>
</p>

