Skip to content

import_gdsii: Add cut_by and wrap_around to the layer stack - #57

Merged
dnltz merged 3 commits into
aesc-silicon:mainfrom
jeffhsu3:upstream/layer-cut-wrap
Sep 29, 2026
Merged

dnltz merged 3 commits into
aesc-silicon:mainfrom
jeffhsu3:upstream/layer-cut-wrap

Conversation

@jeffhsu3

@jeffhsu3 jeffhsu3 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Adds two optional layer-stack fields. Both are motivated by transistor layers, but neither is specific to a PDK.

cut_by

A list of layers subtracted from this layer before it is extruded. The layer is built from region - cut, so the removed area is genuinely absent from the mesh rather than covered up by something drawn on top of it.

wrap_around

Names a reference layer that this layer wraps down around instead of being extruded flat. The layer still caps the reference over its own z range, and a second slab carries the walls down beside the reference to z_extend below it:

    z+height ┌──────────────┐  ← cap (the layer's own polygons)
             │              │
         z   ├──┬────────┬──┤
             │  │        │  │  ← walls (layer NOT reference)
   fin top   │  │  fin   │  │
   fin bot   │  └────────┘  │
  wrap_z_bot └──┘        └──┘

That is what makes a FinFET gate read correctly. Without it the gate floats above the fins with them poking up through it.

You mentioned that transistor layers currently carry a very small offset to avoid render artifacts — ihp-sg13g2.yaml has Activ at z: -0.3995 and GatPoly at z: -0.399, half a nanometre apart. wrap_around is meant to be a version of that for the gate/reference case, since the two layers then no longer share a z range at all. I have not touched any existing config here; if it is useful I can look at whether any of them could drop their offset. This is one possible way to implement the fin/gates for ASAP7.

Implementation

_build_mesh now takes a list of z-slabs and welds them into a single mesh, and _slab_geometry holds what used to be its body. That is what keeps wrap_around cheap: the walls reuse the same hole triangulation and boundary-edge walls as the cap, from import_gdsii: Build the extruded layers with numpy. A layer with neither field is one slab and follows exactly the path it did before.

Testing

I exercised both fields on sky130 through a custom config rather than only on ASAP7 — poly wrapping diff and cut by licon. The wrap produces the expected three z levels, a layer with neither field still produces two, and no poly vertex lands inside a licon shape. Meshes come out with no degenerate faces and no loose vertices. tox passes. Need to double check gate cut on ASAP7 though as its still listed in the layer window.

🤖 Generated with Claude Code

@jeffhsu3
jeffhsu3 requested a review from dnltz as a code owner September 3, 2026 17:33
@jeffhsu3
jeffhsu3 force-pushed the upstream/layer-cut-wrap branch 2 times, most recently from 9a0a708 to b5be55d Compare September 3, 2026 17:37
@dnltz

dnltz commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

@jeffhsu3 - please remove Claude-Session and your Signed-off-by should have your full name, not a nickname. I will review later :)

@jeffhsu3

jeffhsu3 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks sorry!

@dnltz dnltz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I locally tested it and it looks great. Thanks!

Image

Claude found one bug and has one suggestion. Can you take a look at them?

Comment thread import_gdsii/__init__.py Resolved
Comment thread import_gdsii/__init__.py Resolved
@jeffhsu3
jeffhsu3 force-pushed the upstream/layer-cut-wrap branch from 6b98a2e to 72517f9 Compare September 25, 2026 18:34

@dnltz dnltz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Can you please delete the Claude-Session line from your commit? It's not visible to anyone except you and shouldn't be committed.

jeffhsu3 and others added 3 commits September 28, 2026 15:12
Some layers are not a flat slab of their own polygons. A gate cut removes
part of a gate, and a FinFET gate does not sit on top of its fins but
wraps down around them, so a plain extrusion leaves the fins sticking
through it.

Two optional layer-stack fields cover both:

* cut_by lists layers subtracted from this layer before it is extruded.
* wrap_around names a reference layer. The layer still caps the reference
  over its own z range, and a second slab carries the walls down beside
  the reference to z_extend below it, giving the Omega cross-section.

Building the layer as a list of slabs is what makes wrap_around cheap:
_build_mesh now welds several z ranges into one mesh and _slab_geometry
holds what used to be its body, so the walls reuse the same hole
triangulation and boundary walls as the cap.

Both fields work for any PDK, including a custom config.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: jeffhsu3 <jeffhsu3@gmail.com>
Signed-off-by: jeffhsu3 <jeffhsu3@gmail.com>
Signed-off-by: jeffhsu3 <jeffhsu3@gmail.com>
@jeffhsu3
jeffhsu3 force-pushed the upstream/layer-cut-wrap branch from 72517f9 to 637877f Compare September 28, 2026 22:13
@dnltz

dnltz commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@jeffhsu3 thank you!

@dnltz
dnltz merged commit bd3d523 into aesc-silicon:main Sep 29, 2026
2 checks passed
@jeffhsu3
jeffhsu3 deleted the upstream/layer-cut-wrap branch October 10, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants