Skip to content

Circuit From Netlist

Imports

import gdsfactory as gf
from cspdk.si220 import PDK
from doroutes import add_bundle_astar

PDK.activate()
PDK.routing_strategies["doroute_astar"] = add_bundle_astar

Yaml Netlist

yaml = """
instances:
  mzi1:
    component: mzi_sc
    settings: {}
  mzi2:
    component: mzi_sc
    settings:
      delta_length: 20
connections: {}
routes:
  bundle:
    links:
      mzi1,o2: mzi2,o1
    routing_strategy: 'doroute_astar'
    settings:
        spacing: 1.0
        bend: 
            component: bend_euler
            settings:
                radius: 5
        straight: straight
        layers: 
            - WG
nets: []
ports:
  o1: mzi1,o1
  o2: mzi2,o2
  o3: mzi2,o3
placements:
  mzi1:
    mirror: 0
    rotation: 0
    x: 0
    y: 0
  mzi2:
    dx: 100
    dy: 100
    mirror: 0
    rotation: 0
    x: mzi1,o2
    y: 0
"""

Build

c = gf.read.from_yaml(yaml)
c
API key for superuser found.

png

yaml2 = """
instances:
  s1:
    component: straight_sc
    settings: {}
  s2:
    component: straight_sc
    settings: {}
  s3:
    component: straight_sc
    settings: {}
  s4:
    component: straight_sc
    settings: {}
connections: {}
routes:
  my_bundle:
    links:
      s3-4,o1: s1-2,o2
    routing_strategy: 'doroute_astar'
    settings:
        spacing: 1.0
        bend: 
            component: bend_euler
            settings:
                radius: 5
        straight: straight
        layers: 
            - WG
nets: []
ports: {}
placements:
  s1:
    y: 100
  s2:
    y: -100
  s3:
    x: 200
    y: 100
  s4:
    x: 200
    y: -100
"""
c = gf.read.from_yaml(yaml2)
c.show()
c
API key for superuser found.

png