Skip to main content

A simple LVS (Layout vs. Schematic) tool for GDSFactory

Project description

Elvis 0.2.1

Layout vs. Schematic (LVS) for GDSFactory.

User documentation: doplaydo.github.io/elvis

Development setup

# Build the Rust crates
cargo build --release

# Build and install the Python package locally
maturin develop

Crates

  • gf-netlist - GDSFactory netlist schema (input .pic.yml format)
  • elvis-netlist - Extracted netlist schema (simplified subset for LVS)
  • elvis-rdb - KLayout Report Database (lyrdb) format
  • elvis-core - Core extraction and LVS functionality
  • elvis-cli - Command-line interface
  • elvis-python - Python bindings via PyO3

How it works

Netlist Extraction

Elvis extracts connectivity information from GDS files through a multi-step process:

1. Parsing GDS Structure

The GDS file contains a hierarchy of cells (structures). Elvis identifies the top cell - the cell that is not instantiated by any other cell. This is the design being verified.

GDS File
├── top_cell (not referenced by others → this is extracted)
│   ├── instance: mmi (references mmi1x2 cell)
│   ├── instance: wg_in (references straight cell)
│   └── instance: wg_out1 (references straight cell)
├── mmi1x2 (component cell)
├── straight (component cell)
└── bend_euler (component cell)

2. Extracting Port Metadata

kfactory/gdsfactory stores port information in GDS PROPATTR records with a specific format:

kfactory:ports:0')={'name'=>'o1','port_type'=>'optical','trans'=>[trans:r180 -35500,625]}

Elvis parses these properties to extract:

  • name: Port identifier (e.g., o1, o2)
  • position: X, Y coordinates in database units
  • orientation: Rotation angle (0, 90, 180, 270)
  • port_type: Optional type (e.g., optical, electrical)

3. Instance Name Resolution

Each cell reference (SREF) in the GDS becomes an instance. The instance name is determined by:

  1. Explicit name: From GDS property with attr=0 (if present)
  2. Generated name: {cell_name}_{x}_{y}[_r{rotation}][_m] as fallback

The generated name includes rotation and mirror suffixes to ensure uniqueness when multiple instances of the same cell exist at the same position with different transforms.

4. Port Transformation

Each instance's ports are transformed from local (cell) coordinates to global (layout) coordinates:

Global Position = Instance Position + Rotate(Local Position, Instance Rotation)
Global Orientation = Local Orientation + Instance Rotation (± mirror)

5. Connection Detection

Two ports are considered connected when ALL of the following conditions are met:

Condition Requirement
Position Within tolerance (default: 1nm)
Orientation Facing opposite directions (180 +/- 1)
Port type Same type, or either type is unknown
Instance On different instances (no self-connections)
        ┌─────────┐           ┌───────┐
        │  mmi    │  o2 ←→ o1 │  wg   │
        │         │─────●─────│       │
        └─────────┘  180°  0° └───────┘
                   Connected: same position, opposite orientation

The port type check ensures that only compatible ports connect:

  • opticaloptical: Connected
  • electricalelectrical: Connected
  • opticalelectrical: Not connected (will appear as open)
  • unknownanything: Connected (permissive fallback)

LVS Algorithm

Elvis uses a graph-based connectivity comparison where 2-port routing instances are removed from the net-comparisons.

The Problem with Naive Comparison

A direct comparison would fail on any routed design:

Schematic (what the designer specified):
┌──────────┐      ┌──────────┐
│ splitter │──────│ arm_top  │
└──────────┘      └──────────┘
     2 instances, 1 net

Layout (after auto-routing):
┌──────────┐   ┌──────┐   ┌────────┐   ┌──────┐   ┌──────────┐
│ splitter │───│ bend │───│straight│───│ bend │───│ arm_top  │
└──────────┘   └──────┘   └────────┘   └──────┘   └──────────┘
     5 instances, 4 nets

Naive LVS: FAILED - 3 extra instances, 3 extra nets

The Solution: Graph-Based Tracing

Elvis treats the layout as a connectivity graph and traces through 2-port components (which act as "wires") to find connections between reference instances (components from the schematic).

Key insight: A 2-port component (like a waveguide or bend) doesn't change connectivity - it just extends a path. Only components with 3+ ports (like splitters, couplers) are true circuit elements that define the topology.

Algorithm Steps

Step 1: Identify Reference Instances

Reference instances are those that appear in the schematic. These are the "real" components we care about - they define the circuit topology.

reference_instances = {name for name in schematic.instances}
# e.g., {"splitter", "arm_top", "arm_bottom", "combiner"}

Step 2: Build Connectivity Graph

Create a graph from the layout where:

  • Nodes are (instance, port) pairs
  • Edges connect ports that are physically connected
Layout connectivity graph:
(splitter,o2) ─── (bend_1,o1)
(bend_1,o2) ─── (straight_1,o1)
(straight_1,o2) ─── (bend_2,o1)
(bend_2,o2) ─── (arm_top,o1)

Step 3: Classify Traversable Instances

An instance is traversable if:

  1. It has exactly 2 ports (it's a "wire-like" component)
  2. It is NOT a reference instance (not in the schematic)
def is_traversable(instance):
    return port_count[instance] == 2 and instance not in reference_instances

Reference instances are never traversable - they are endpoints where tracing stops.

Step 4: Trace Through 2-Port Intermediates

For each connection in the schematic, verify it exists in the layout by tracing through traversable instances:

def trace_to_endpoint(start_instance, start_port):
    current = get_connected_port(start_instance, start_port)

    while is_traversable(current.instance):
        # Find the other port on this 2-port instance
        other_port = get_other_port(current.instance, current.port)
        # Follow the connection from that port
        current = get_connected_port(current.instance, other_port)

    return current  # Returns the endpoint (a reference instance)

Example trace:

Start: (splitter, o2)
  → connected to (bend_1, o1)
  → bend_1 is traversable, other port is o2
  → (bend_1, o2) connected to (straight_1, o1)
  → straight_1 is traversable, other port is o2
  → (straight_1, o2) connected to (bend_2, o1)
  → bend_2 is traversable, other port is o2
  → (bend_2, o2) connected to (arm_top, o1)
  → arm_top is NOT traversable (it's a reference instance)
End: (arm_top, o1) ✓

Step 5: Mark Valid Intermediates

All 2-port instances encountered on valid paths are marked as valid intermediates. These won't trigger "missing in schematic" errors.

Valid intermediates: {bend_1, straight_1, bend_2}
These exist in layout but not schematic - that's OK, they're routing.

Step 6: Check for Extra Connections

Also verify that the layout doesn't have extra connections between reference instances that aren't in the schematic (topological shorts).

Array Instance Support

GDS array references (AREF) are expanded into individual instances with <col.row> naming (e.g., pads<0.0>, pads<1.0>). Schematic array instances are likewise expanded during netlist conversion, so both sides use the same naming convention.

Visual Example

SCHEMATIC:
                    ┌─────────┐
              ┌─────┤ arm_top ├─────┐
              │     └─────────┘     │
        ┌─────┴─────┐         ┌─────┴─────┐
   ───○─┤ splitter  │         │ combiner  ├─○───
        └─────┬─────┘         └─────┬─────┘
              │     ┌─────────┐     │
              └─────┤ arm_bot ├─────┘
                    └─────────┘

   4 reference instances, 4 nets

LAYOUT (with routing):
                         ╭───────────────────╮
                    ┌────┤ arm_top           ├────┐
                    │    └───────────────────┘    │
              ╭─────╯                             ╰─────╮
              │  (bends and straights)                  │
        ┌─────┴─────┐                            ┌──────┴────┐
   ───○─┤ splitter  │                            │ combiner  ├─○───
        └─────┬─────┘                            └─────┬─────┘
              │  (bends and straights)                 │
              ╰─────╮                             ╭────╯
                    │    ┌───────────────────┐    │
                    └────┤ arm_bot           ├────┘
                         └───────────────────┘

   64 instances total (4 reference + 60 routing), 64 nets

LVS RESULT: PASSED
   - All 4 schematic connections verified through routing
   - 60 routing instances are valid intermediates

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

elvis_lvs-0.2.1-cp314-cp314-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.14Windows x86-64

elvis_lvs-0.2.1-cp314-cp314-manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

elvis_lvs-0.2.1-cp314-cp314-manylinux_2_28_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

elvis_lvs-0.2.1-cp314-cp314-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

elvis_lvs-0.2.1-cp313-cp313-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.13Windows x86-64

elvis_lvs-0.2.1-cp313-cp313-manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

elvis_lvs-0.2.1-cp313-cp313-manylinux_2_28_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

elvis_lvs-0.2.1-cp313-cp313-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

elvis_lvs-0.2.1-cp312-cp312-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.12Windows x86-64

elvis_lvs-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

elvis_lvs-0.2.1-cp312-cp312-manylinux_2_28_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

elvis_lvs-0.2.1-cp312-cp312-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file elvis_lvs-0.2.1-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: elvis_lvs-0.2.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for elvis_lvs-0.2.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3c9ebc0c5d30dfd09cc7732d97e622b51150a01bc349d704d58a5285650b8978
MD5 1688f7cbe90ff0e77e710ddf8089b0c5
BLAKE2b-256 19f008183aa682f0f38cfdc647c98675fa428912a55d40858216d78a9fa0a160

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp314-cp314-win_amd64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elvis_lvs-0.2.1-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for elvis_lvs-0.2.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0aff9b5a8335ca35de7642186d55fab76f1fdc6f17523ab7cbdbbd213e343ba5
MD5 9777628594dc1d5073b5d01a88225978
BLAKE2b-256 92d6a993bd9df3eb79675e5073454f1ab3bf43f3ffe628bb9913e14681c00175

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp314-cp314-manylinux_2_28_x86_64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elvis_lvs-0.2.1-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for elvis_lvs-0.2.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 02e0a3ad99d7b7e33d5b6952508fb52dec7c7ad3e50412162dc161d6afcfc111
MD5 b09e02be3d3053a0ca39bb886d874bb5
BLAKE2b-256 c7756faedb7c847ebb9ba0c9e10bd1f5269d31f61e2f227e00a9e68fbe2b16e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp314-cp314-manylinux_2_28_aarch64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elvis_lvs-0.2.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for elvis_lvs-0.2.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ac177a73b8da615722cbef6f60d1f9407376f2ee36e596a92c3dadcfc4398346
MD5 d4316783d895e68010d5cf8ca3a8a62a
BLAKE2b-256 0f29dfc6cbc9329229b632f7acf7f32829845759e30f985ba986d78d1847cca4

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elvis_lvs-0.2.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: elvis_lvs-0.2.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for elvis_lvs-0.2.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0a90ee64130bf87c6d86212a1493cdf70deb6429d12514f53d867f28af6db261
MD5 03a184d52e87f98ec161802b6530832a
BLAKE2b-256 0deed629c7f07d8ac7121df650923ab2f41fe7e6808beef9af1ce13fe2a9307c

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp313-cp313-win_amd64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elvis_lvs-0.2.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for elvis_lvs-0.2.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 754b16d98c260c22f811bc2da3ae0ae7595818db689560b85370952dfbda81dd
MD5 00df824e5c0da392a03597aec481607e
BLAKE2b-256 ba75e389d943080146c85813a5cec1621711b4a0aadf8d65f4b3a4470aed7b10

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elvis_lvs-0.2.1-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for elvis_lvs-0.2.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 68774f4c62f98e6d6b1d4eac41602c3c732783ba5b039111230ff20c86e82ace
MD5 804af61209d4bad4675069f70bf53a48
BLAKE2b-256 2455a7f6c8c43da9ede03081bcbd4d6e982e4d5f29ed4c89f8c805930ea7efbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp313-cp313-manylinux_2_28_aarch64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elvis_lvs-0.2.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for elvis_lvs-0.2.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 38aaff4f1d8548d827f1b6fb73cd13442d2b2e1aa23af1035db55f7d3a36d453
MD5 95540a13c279a4f3f1d98447fa28f031
BLAKE2b-256 300cc49254ada90f469dc697a86d80abbd323e7d51b7f47a9f042119bd1ec3b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elvis_lvs-0.2.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: elvis_lvs-0.2.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for elvis_lvs-0.2.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b3ec4c6db2b5de51c6e4b232151cd524022490787c01035ca833f2823574a5ea
MD5 376abebe579b78a252a693c75d2a32d6
BLAKE2b-256 e0d0698d8711bd2b01ba996180b23bd905c7f49caa461b314ac7cd4130a4a0b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp312-cp312-win_amd64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elvis_lvs-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for elvis_lvs-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 98daac2465ae70ec8bba1d48487f5975929076732faae88c701d86fd3505cd56
MD5 79311a2e4f0dc12f69d2749d096bab04
BLAKE2b-256 dbcd675908027918d2c7084e123693fd15d40d299232bcbd8d73e68bf43ee185

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elvis_lvs-0.2.1-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for elvis_lvs-0.2.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8c8876d86fc9b8b870b164122fdef1ce0fd07e8b7c0e29efbcdd9a5ce3bb3e2e
MD5 36a021070c255d018eb0948d711475f5
BLAKE2b-256 56c45053108c239ec82fa30fbd377795cc3639c2061e280fb7c84221a9d2962c

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp312-cp312-manylinux_2_28_aarch64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elvis_lvs-0.2.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for elvis_lvs-0.2.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c695edc42177c6ecef39bd1324f29aa24c6ed10cae5ac08be3d789427e6589c
MD5 e806914350f12da9f6d50b054f10b732
BLAKE2b-256 b6a7548a8063588049e5f7b1c1db0e5a6aadc5a5a0d270b8969351d63a7f8bd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for elvis_lvs-0.2.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on doplaydo/elvis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page