Die assembly#

With gdsfactory you can easily go from a simple Component, to a Component with many components inside.

In the same way that you need to Layout for DRC (Design Rule Check) clean devices, you have to layout obeying the Design for Test (DFT) and Design for Packaging rules.

Design for test#

To measure your chips after fabrication you need to decide your test configurations. This includes Design For Testing Rules like:

  • Individual input and output fibers versus fiber array. You can use add_fiber_array for easier testing and higher throughput, or add_fiber_single for the flexibility of single fibers.

  • Fiber array pitch (127um or 250um) if using a fiber array.

  • Pad pitch for DC and RF high speed probes (100, 125, 150, 200um). Probe configuration (GSG, GS …)

  • Test layout for DC, RF and optical fibers.

from functools import partial

import json
import gdsfactory as gf
from gdsfactory.generic_tech import get_generic_pdk
from gdsfactory.labels.ehva import add_label_ehva
from gdsfactory.labels.add_label_yaml import add_label_json

Pack#

Lets start with a resistance sweep, where you change the resistance width to measure sheet resistance.

sweep = [gf.components.resistance_sheet(width=width) for width in [1, 10, 50]]
m = gf.pack(sweep)
c = m[0]
c.plot()
../_images/fa5cbfdbc2b6733c3b2f1e51f3ce8761d163d8009390308eb4e8626b56bb5a57.png

Then we add spirals with different lengths to measure waveguide propagation loss. You can use both fiber array or single fiber.

from toolz import compose
from functools import partial
import gdsfactory as gf

gf.config.rich_output()

c = gf.components.spiral(length=100)
c.info["measurement"] = "optical_loopback2"
c = add_label_json(c)
c.plot()

../_images/709b6d7df16f1694ce34ad739f38896bc6fefbe2af3e55e802c9d51b76fa7359.png
c.info

Info(length=1200, measurement='optical_loopback2')
spiral = gf.components.spiral()
spiral.plot()

../_images/709b6d7df16f1694ce34ad739f38896bc6fefbe2af3e55e802c9d51b76fa7359.png
spiral_te = gf.routing.add_fiber_array(gf.components.spiral)
spiral_te.plot()

../_images/16fa0b21ed4845b8c3dbc562602f7861f0d012a645cc47f5285b77157386afdb.png
# which is equivalent to
spiral_te = gf.compose(
    gf.routing.add_fiber_array,
    gf.components.spiral,
)
c = spiral_te(length=100)
c.plot()

../_images/16fa0b21ed4845b8c3dbc562602f7861f0d012a645cc47f5285b77157386afdb.png
spiral_te = gf.compose(
    gf.routing.add_fiber_array,
    gf.components.spiral,
)
sweep = [spiral_te(length=length) for length in [100, 200, 300]]
m = gf.pack(sweep)
c = m[0]
c.plot()

../_images/460be936c5d1b9e57add17c021657dffc041601aa59d6c0180f591a189a07f26.png
from toolz import compose
from functools import partial
import gdsfactory as gf

c = gf.components.spiral(length=200)
c.info["measurement"] = "optical_loopback2"
c = gf.labels.add_label_json(c)
c.show()
c.plot()

../_images/cc946f77ae8f32fcd6cfc72aa2b1d13c8e6c57185c09b79b84f0a8545d871ec6.png
def add_label_json(component):
    """Add label json and component.info)"""
    component.info["measurement"] = "optical_loopback2"
    component = gf.labels.add_label_json(component)
    return component
sweep = [
    add_label_json(gf.components.spiral(length=length)) for length in [100, 200, 300]
]
m = gf.pack(sweep)
c = m[0]
c.show()
c.plot()

../_images/1a14649066d23dc1c76d64435585267a92db88e4bfea3676077b231f70cb81cc.png

You can also add some physical labels that will be fabricated. For example you can add prefix S at the north-center of each spiral using text_rectangular which is DRC clean and anchored on nc (north-center)

text_metal = partial(gf.components.text_rectangular_multi_layer, layers=("M1",))

m = gf.pack(sweep, text=text_metal, text_anchors=("cw",), text_prefix="s")
c = m[0]
c.show()
c.plot()

../_images/6d344014ed17dc2b4f960e740dba4843e2a392a77c6769b58525959cad9b4330.png

Grid#

You can also pack components with a constant spacing.

g = gf.grid(sweep)
g.plot()

../_images/8723c559c745d78798b56735f4441fcffa23453fd86be0ec54efd6844c404ad5.png
gh = gf.grid(sweep, shape=(1, len(sweep)))
gh.plot()

../_images/7c05c4b4c4307907862ca17f7cdeec20bb9d47cf0fa6b55d7924771b0326ae5d.png
gh_ymin = gf.grid(sweep, shape=(len(sweep), 1), align_x="xmin")
gh_ymin.plot()

../_images/cfa2113be425531168d4526aeb0795c88c8e6e0e11299c917bb25f06e6d9ca32.png

You can also add text labels to each element of the sweep

gh_ymin = gf.grid_with_text(
    sweep, shape=(len(sweep), 1), align_x="xmax", text=text_metal
)
gh_ymin.plot()

../_images/99481651d25774eadaa0c2beadfe672d7d2fa3d1d8218532ebc1588a48cd64ea.png

You have 2 ways of defining a mask:

  1. in python

  2. in YAML

1. Component in python#

You can define a Component top cell reticle or die using grid and pack python functions.

text_metal3 = partial(gf.components.text_rectangular_multi_layer, layers=((49, 0),))
grid = partial(gf.grid_with_text, text=text_metal3)
pack = partial(gf.pack, text=text_metal3)

gratings_sweep = [
    gf.components.grating_coupler_elliptical(taper_angle=taper_angle)
    for taper_angle in [20, 30, 40]
]
gratings = grid(gratings_sweep, text=None)
gratings.plot()

../_images/da690ea6c0bbb8e1ed7339312e2be35361d04d53941ac768eed9f8fa4a2d5170.png
gratings_sweep = [
    gf.components.grating_coupler_elliptical(taper_angle=taper_angle)
    for taper_angle in [20, 30, 40]
]
gratings_loss_sweep = [
    gf.components.grating_coupler_loss_fiber_array(grating_coupler=grating)
    for grating in gratings_sweep
]
gratings = grid(
    gratings_loss_sweep, shape=(1, len(gratings_loss_sweep)), spacing=(40, 0)
)
gratings.plot()

../_images/baff3871f5b76000d12882351800d8183a878190193d4a9eabbac75aabcc3ee3.png
sweep_resistance = [
    gf.components.resistance_sheet(width=width) for width in [1, 10, 50]
]
resistance = gf.pack(sweep_resistance)[0]
resistance.plot()

../_images/fa5cbfdbc2b6733c3b2f1e51f3ce8761d163d8009390308eb4e8626b56bb5a57.png
spiral_te = gf.compose(
    gf.routing.add_fiber_array,
    gf.components.spiral,
)
sweep_spirals = [spiral_te(length=length) for length in [100, 200, 300]]
spirals = gf.pack(sweep_spirals)[0]
spirals.plot()

../_images/adf0a14d048c27616ba32e7278c46c680c2e9230eec729d733d104fa1fa53b07.png
mask = gf.pack([spirals, resistance, gratings])[0]
mask.plot()

../_images/3588439da41f62cb30dae91d747a1e94f935bff78a4936cdf1b9f62370b201c2.png

As you can see you can define your mask in a single line.

For more complex mask, you can also create a new cell to build up more complexity

@gf.cell
def mask():
    c = gf.Component()
    c << gf.pack([spirals, resistance, gratings])[0]
    c << gf.components.seal_ring(c)
    return c


c = mask()
c.plot()

../_images/b60506ea08f50879d878bd9d2941f019c9d4557ebfdfab83ccf558d96f375b13.png

2. Component in YAML#

You can also define your component in YAML format thanks to gdsfactory.read.from_yaml

You need to define:

  • instances

  • placements

  • routes (optional)

and you can leverage:

  1. pack_doe

  2. pack_doe_grid

2.1 pack_doe#

pack_doe places components as compact as possible.

c = gf.read.from_yaml(
    """
name: mask_grid

instances:
  rings:
    component: pack_doe
    settings:
      doe: ring_single
      settings:
        radius: [30, 50, 20, 40]
        length_x: [1, 2, 3]
      do_permutations: True
      function:
        function: add_fiber_array
        settings:
            fanout_length: 200

  mzis:
    component: pack_doe
    settings:
      doe: mzi
      settings:
        delta_length: [10, 100]
      function: add_fiber_array

placements:
  rings:
    xmin: 50

  mzis:
    xmin: rings,east
"""
)

c.plot()

../_images/c8ab341ab3a2ceef6743e6621fcc76ca10a4fb24004b79e25470a04f1e3dd2ba.png

2.2 pack_doe_grid#

pack_doe_grid places each component on a regular grid

c = gf.read.from_yaml(
    """
name: mask_compact

instances:
  rings:
    component: pack_doe
    settings:
      doe: ring_single
      settings:
        radius: [30, 50, 20, 40]
        length_x: [1, 2, 3]
      do_permutations: True
      function:
        function: add_fiber_array
        settings:
            fanout_length: 200


  mzis:
    component: pack_doe_grid
    settings:
      doe: mzi
      settings:
        delta_length: [10, 100]
      do_permutations: True
      spacing: [10, 10]
      function: add_fiber_array

placements:
  rings:
    xmin: 50

  mzis:
    xmin: rings,east
"""
)
c.plot()

../_images/2cc26bdfd3f9583a7215feaf0dc7967797ace91ef598b1b9e739aaa439359c53.png

Automated testing exposing all ports#

You can promote all the ports that need to be tested to the top level component and then write a CSV test manifest.

This is the recommended way for measuring components that have electrical and optical port.

from gdsfactory.generic_tech.cells import add_fiber_array_optical_south_electrical_north

test_info_spirals = dict(
    doe="spirals_sc",
    measurement="optical_loopback4",
    analysis="optical_loopback4_spirals",
)
test_info_mzi_heaters = dict(
    doe="mzis_heaters",
    analysis="mzi_heater",
    measurement="optical_loopback4_heater_sweep",
)
test_info_ring_heaters = dict(
    doe="ring_heaters",
    analysis="ring_heater",
    measurement="optical_loopback2_heater_sweep",
)


def sample_reticle() -> gf.Component:
    """Returns MZI with TE grating couplers."""

    mzis = [
        gf.components.mzi2x2_2x2_phase_shifter(length_x=length, auto_rename_ports=False)
        for length in [100, 200, 300]
    ]
    rings = [
        gf.components.ring_single_heater(length_x=length_x) for length_x in [10, 20, 30]
    ]

    spirals_te = [
        gf.routing.add_fiber_array(
            gf.components.spiral(
                length=length,
            )
        )
        for length in [0, 100, 200]
    ]
    mzis_te = [
        add_fiber_array_optical_south_electrical_north(
            component=mzi,
            electrical_port_names=("top_l_e2", "top_r_e2"),
        )
        for mzi in mzis
    ]
    rings_te = [
        add_fiber_array_optical_south_electrical_north(
            component=ring,
            electrical_port_names=("l_e2", "r_e2"),
        )
        for ring in rings
    ]

    for component in mzis_te:
        component.info.update(test_info_mzi_heaters)

    for component in rings_te:
        component.info.update(test_info_ring_heaters)

    for component in spirals_te:
        component.info.update(test_info_spirals)

    components = mzis_te + rings_te + spirals_te
    return gf.pack(components)[0]


c = sample_reticle()
c.show()
c.plot()

../_images/eeee7840430188c275bfdb3e9ec09dc100a2d0cc6f9496d54ae983d04dd69a9e.png
c.pprint_ports()
┏━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ name         width  orientation  layer  center                       port_type   ┃
┡━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ 0_e4_1_1    │ 80.0  │ 270.0       │ M3    │ (285.52, 255.05)            │ electrical  │
│ 0_e4_1_2    │ 80.0  │ 270.0       │ M3    │ (385.52, 255.05)            │ electrical  │
│ 1_e4_1_1    │ 80.0  │ 270.0       │ M3    │ (285.52, 595.0500000000001) │ electrical  │
│ 1_e4_1_2    │ 80.0  │ 270.0       │ M3    │ (385.52, 595.0500000000001) │ electrical  │
│ 2_e4_1_1    │ 80.0  │ 270.0       │ M3    │ (285.52, 935.0500000000001) │ electrical  │
│ 2_e4_1_2    │ 80.0  │ 270.0       │ M3    │ (385.52, 935.0500000000001) │ electrical  │
│ 3_e4_1_1    │ 80.0  │ 270.0       │ M3    │ (158.52, 1275.05)           │ electrical  │
│ 3_e4_1_2    │ 80.0  │ 270.0       │ M3    │ (258.52, 1275.05)           │ electrical  │
│ 4_e4_1_1    │ 80.0  │ 270.0       │ M3    │ (575.46, 1275.05)           │ electrical  │
│ 4_e4_1_2    │ 80.0  │ 270.0       │ M3    │ (675.46, 1275.05)           │ electrical  │
│ 5_e4_1_1    │ 80.0  │ 270.0       │ M3    │ (829.46, 255.05)            │ electrical  │
│ 5_e4_1_2    │ 80.0  │ 270.0       │ M3    │ (929.46, 255.05)            │ electrical  │
│ 6_o1        │ 10.0  │ 270.0       │ WG    │ (815.962, 374.391)          │ vertical_te │
│ 6_o2        │ 10.0  │ 270.0       │ WG    │ (942.962, 374.391)          │ vertical_te │
│ 6_loopback1 │ 10.0  │ 270.0       │ WG    │ (688.962, 374.112)          │ vertical_te │
│ 6_loopback2 │ 10.0  │ 270.0       │ WG    │ (1069.962, 374.112)         │ vertical_te │
│ 7_o1        │ 10.0  │ 270.0       │ WG    │ (815.96, 547.97)            │ vertical_te │
│ 7_o2        │ 10.0  │ 270.0       │ WG    │ (942.96, 547.97)            │ vertical_te │
│ 7_loopback1 │ 10.0  │ 270.0       │ WG    │ (688.96, 547.691)           │ vertical_te │
│ 7_loopback2 │ 10.0  │ 270.0       │ WG    │ (1069.96, 547.691)          │ vertical_te │
│ 8_o1        │ 10.0  │ 270.0       │ WG    │ (815.96, 720.801)           │ vertical_te │
│ 8_o2        │ 10.0  │ 270.0       │ WG    │ (942.96, 720.801)           │ vertical_te │
│ 8_loopback1 │ 10.0  │ 270.0       │ WG    │ (688.96, 721.272)           │ vertical_te │
│ 8_loopback2 │ 10.0  │ 270.0       │ WG    │ (1069.96, 721.272)          │ vertical_te │
└─────────────┴───────┴─────────────┴───────┴─────────────────────────────┴─────────────┘
df = gf.labels.get_test_manifest(c)
df

cell measurement measurement_settings analysis analysis_settings doe
0 0_e4_1_1 None None None None None
1 0_e4_1_2 None None None None None
2 1_e4_1_1 None None None None None
3 1_e4_1_2 None None None None None
4 2_e4_1_1 None None None None None
5 2_e4_1_2 None None None None None
6 3_e4_1_1 None None None None None
7 3_e4_1_2 None None None None None
8 4_e4_1_1 None None None None None
9 4_e4_1_2 None None None None None
10 5_e4_1_1 None None None None None
11 5_e4_1_2 None None None None None
12 6_o1 None None None None None
13 6_o2 None None None None None
14 6_loopback1 None None None None None
15 6_loopback2 None None None None None
16 7_o1 None None None None None
17 7_o2 None None None None None
18 7_loopback1 None None None None None
19 7_loopback2 None None None None None
20 8_o1 None None None None None
21 8_o2 None None None None None
22 8_loopback1 None None None None None
23 8_loopback2 None None None None None
df.to_csv("test_manifest.csv")
def sample_reticle_grid() -> gf.Component:
    """Returns sample reticle with grid packer."""
    from gdsfactory.generic_tech.cells import (
        add_fiber_array_optical_south_electrical_north,
    )

    mzis = [
        gf.components.mzi2x2_2x2_phase_shifter(length_x=length, auto_rename_ports=False)
        for length in [100, 200, 300]
    ]
    rings = [
        gf.components.ring_single_heater(length_x=length_x) for length_x in [10, 20, 30]
    ]

    spirals_te = [
        gf.routing.add_fiber_array(
            gf.components.spiral(
                length=length,
            )
        )
        for length in [0, 100, 200]
    ]
    mzis_te = [
        add_fiber_array_optical_south_electrical_north(
            component=mzi,
            electrical_port_names=["top_l_e2", "top_r_e2"],
        )
        for mzi in mzis
    ]
    rings_te = [
        add_fiber_array_optical_south_electrical_north(
            component=ring,
            electrical_port_names=["l_e2", "r_e2"],
        )
        for ring in rings
    ]

    for component in mzis_te:
        component.info.update(test_info_mzi_heaters)

    for component in rings_te:
        component.info.update(test_info_ring_heaters)

    for component in spirals_te:
        component.info.update(test_info_spirals)

    components = mzis_te + rings_te + spirals_te
    return gf.grid(components)


c = sample_reticle_grid()
c.plot()

../_images/4212811db443e74ec07f260fcc763eb74130992a475579439d0266b05641a129.png
df = gf.labels.get_test_manifest(c)
df

cell measurement measurement_settings analysis analysis_settings doe
0 0_0_e4_1_1 None None None None None
1 0_0_e4_1_2 None None None None None
2 1_0_e4_1_1 None None None None None
3 1_0_e4_1_2 None None None None None
4 2_0_e4_1_1 None None None None None
5 2_0_e4_1_2 None None None None None
6 3_0_e4_1_1 None None None None None
7 3_0_e4_1_2 None None None None None
8 4_0_e4_1_1 None None None None None
9 4_0_e4_1_2 None None None None None
10 5_0_e4_1_1 None None None None None
11 5_0_e4_1_2 None None None None None
12 6_0_o1 None None None None None
13 6_0_o2 None None None None None
14 6_0_loopback1 None None None None None
15 6_0_loopback2 None None None None None
16 7_0_o1 None None None None None
17 7_0_o2 None None None None None
18 7_0_loopback1 None None None None None
19 7_0_loopback2 None None None None None
20 8_0_o1 None None None None None
21 8_0_o2 None None None None None
22 8_0_loopback1 None None None None None
23 8_0_loopback2 None None None None None
df.to_csv("test_manifest.csv")

You can see a test manifest example here