Concepts

Technology Layers

Reference for Technology, LayerDefine, default layers, and layer override behavior.

Technology describes which named process layers a layout should use.

In laylight, it is a small configuration object with two roles:

  • hold layer definitions in a dictionary-like form
  • expose kdb.LayerInfo objects for geometry generation

This page is a reference for the current behavior.

Technology

Technology is a mapping from a layer name such as LAYER_WG to a LayerDefine.

The simplest form uses the built-in defaults:

from laylight.technology import Technology

tech = Technology()

You can also pass a dictionary to override existing layers or add new ones:

from laylight.technology import Technology

tech = Technology(
    {
        "LAYER_WG": {
            "layer_number": 100,
            "comments": "custom waveguide layer",
        },
        "LAYER_LABEL": {
            "layer_number": 200,
            "layer_datatype": 7,
            "name": "LABEL",
            "color": "#ffcc00",
        },
    }
)

LayerDefine

Each layer entry is a LayerDefine.

Required fields:

  • layer_number: the KLayout layer number
  • layer_datatype: the KLayout datatype

Optional fields:

  • name: display name for the layer
  • comments: free-form notes about the layer
  • color: optional color metadata stored in the definition

Example:

{
    "layer_number": 0,
    "layer_datatype": 0,
    "name": "WG",
    "comments": "waveguide core",
    "color": "#4f83cc",
}

Default Layers

Technology() starts with a built-in set of named layers.

Current defaults include:

  • LAYER_WG
  • LAYER_SLAB
  • LAYER_DOPING_P
  • LAYER_DOPING_PP
  • LAYER_DOPING_PPP
  • LAYER_DOPING_N
  • LAYER_DOPING_NP
  • LAYER_DOPING_NPP
  • LAYER_HT
  • LAYER_MT1
  • LAYER_VIA_MT2MT1
  • LAYER_VIA_MT2HT
  • LAYER_MT2
  • LAYER_PORT
  • LAYER_PORT_IN
  • LAYER_PORT_OUT

To inspect the dictionary form directly:

tech = Technology()

wg_define = tech["LAYER_WG"]
assert wg_define["layer_number"] == 0
assert wg_define["layer_datatype"] == 0

Reading Layers

Technology supports two read paths. They return different kinds of values.

Dictionary access

Use tech["LAYER_WG"] when you want the configuration data itself:

tech = Technology()
wg_define = tech["LAYER_WG"]

This returns a LayerDefine dictionary.

Attribute access

Use tech.LAYER_WG when you want a kdb.LayerInfo for geometry generation:

import klayout.db as kdb

tech = Technology()
layer_info: kdb.LayerInfo = tech.LAYER_WG

This is the form most device code uses when calling cell.shapes(...) or layout.layer(...).

Class-level attribute access

Technology.LAYER_WG also works.

This returns the default kdb.LayerInfo for that layer name, without applying any instance-specific overrides.

Overriding Existing Layers

When you pass an existing layer name, Technology merges your values into the default definition for that layer.

from laylight.technology import Technology

tech = Technology(
    {
        "LAYER_WG": {
            "layer_number": 100,
            "comments": "moved to a custom process layer",
        }
    }
)

assert tech["LAYER_WG"]["layer_number"] == 100
assert tech["LAYER_WG"]["layer_datatype"] == 0
assert tech["LAYER_WG"]["name"] == "WG"

In this example, only layer_number and comments change. The default layer_datatype and name stay in place.

Adding New Layers

You can introduce new layer names that are not part of the defaults.

from laylight.technology import Technology

tech = Technology(
    {
        "LAYER_LABEL": {
            "layer_number": 200,
            "layer_datatype": 7,
            "name": "LABEL",
        }
    }
)

assert tech["LAYER_LABEL"]["layer_number"] == 200
assert tech.LAYER_LABEL.datatype == 7

For a new layer, layer_number and layer_datatype must be provided.

Validation Rules

Technology validates each layer definition during construction.

It raises ValueError when:

  • a layer definition is missing layer_number
  • a layer definition is missing layer_datatype
  • a layer definition contains unsupported fields

Supported fields are only:

  • layer_number
  • layer_datatype
  • name
  • comments
  • color

Immutability

Technology is immutable after construction.

The object behaves like a read-only mapping. Methods such as item assignment, update(), pop(), and clear() raise TypeError.

If you need a different layer configuration, construct a new Technology(...) object instead of mutating an existing one.

Typical Usage

The common pattern is:

  1. create a Layout
  2. create a Technology
  3. pass the technology into devices
  4. use tech.LAYER_* when shapes need a kdb.LayerInfo
import laylight
import klayout.db as kdb

from laylight.structure.wg import WGStraight
from laylight.technology import Technology

layout = laylight.Layout()
layout.dbu = 0.001
top = layout.create_cell("TOP")
tech = Technology(
    {
        "LAYER_WG": {
            "layer_number": 100,
        }
    }
)

device = WGStraight(
    length=50,
    width=0.5,
    layout=layout,
    tech=tech,
)

laylight.Placer(device).into(top)
top.shapes(layout.layer(tech.LAYER_WG)).insert(kdb.DBox(0, 2, 10, -2))

See Also

On this page