Skip to content

Commit

Permalink
Merge pull request #22 from gdsfactory/simpler_routing
Browse files Browse the repository at this point in the history
simplify routing
  • Loading branch information
joamatab authored Apr 19, 2024
2 parents 93f6903 + baec3aa commit 8e911a0
Show file tree
Hide file tree
Showing 12 changed files with 395 additions and 282 deletions.
6 changes: 2 additions & 4 deletions cspdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from cspdk.cells import _bend, _straight, _taper
from cspdk.config import PATH
from cspdk.models import get_models
from cspdk.routing import get_routing_strategies
from cspdk.tech import LAYER, LAYER_STACK, LAYER_VIEWS
from cspdk.tech import LAYER, LAYER_STACK, LAYER_VIEWS, routing_strategies

_models = get_models()
_cells = get_cells(cells)
Expand All @@ -19,7 +18,6 @@
}
)
_cross_sections = get_cross_sections(tech)
_routing_strategies = get_routing_strategies()
PDK = Pdk(
name="cornerstone",
cells=_cells,
Expand All @@ -28,7 +26,7 @@
layer_stack=LAYER_STACK,
layer_views=LAYER_VIEWS,
models=_models,
routing_strategies=_routing_strategies,
routing_strategies=routing_strategies,
)
PDK.activate()

Expand Down
3 changes: 3 additions & 0 deletions cspdk/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,9 @@ def crossing_sc() -> gf.Component:
return c


array = gf.components.array


if __name__ == "__main__":
# c = die_sc()
c = crossing_sc()
Expand Down
2 changes: 2 additions & 0 deletions cspdk/klayout/d25/Cornerstone.lyd25
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<text>

core = input(3, 0)
slab = input(5, 0)
nitride = input(203, 0)
nitride_etch = input(204, 0)
heater = input(39, 0)
Expand All @@ -26,6 +27,7 @@ metal = input(41, 0)


z(core, zstart: 0.0, zstop: 0.2, name: 'core: si 3/0', )
z(slab, zstart: 0.0, zstop: 0.1, name: 'slab: si 5/0', )
z(nitride, zstart: 0.0, zstop: 0.3, name: 'nitride: sin 203/0', )
z(nitride_etch, zstart: 0.0, zstop: 0.3, name: 'nitride_etch: sin 204/0', )
z(heater, zstart: 1.1, zstop: 1.8, name: 'heater: TiN 39/0', )
Expand Down
190 changes: 0 additions & 190 deletions cspdk/klayout/tech/layers.lyp

This file was deleted.

86 changes: 0 additions & 86 deletions cspdk/routing.py

This file was deleted.

2 changes: 1 addition & 1 deletion cspdk/samples/circuit_simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from cspdk import PDK

if __name__ == "__main__":
c = cspdk.cells.mzi_sc(delta_length=100)
c = cspdk.cells.mzi_sc(delta_length=10)
c.show()
c.plot_netlist()
netlist = c.get_netlist()
Expand Down
32 changes: 32 additions & 0 deletions cspdk/samples/circuit_simulations_with_routing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import gdsfactory as gf
import jax.numpy as jnp
import matplotlib.pyplot as plt
import sax

import cspdk
from cspdk import PDK

if __name__ == "__main__":
c = gf.Component()
mzi1 = c << cspdk.cells.mzi_sc(delta_length=10)
mzi2 = c << cspdk.cells.mzi_sc(delta_length=100)
mzi2.move((200, 200))
route = cspdk.tech.get_route_sc(mzi1.ports["o2"], mzi2.ports["o1"])
c.add(route.references)
c.add_port(name="o1", port=mzi1.ports["o1"])
c.add_port(name="o2", port=mzi2.ports["o2"])
c.show()
c.plot_netlist_flat()
netlist = c.get_netlist_recursive()
models = PDK.models
circuit, _ = sax.circuit(netlist, models=models) # type: ignore
wl = jnp.linspace(1.5, 1.6, 256)

S = circuit(wl=wl)
plt.figure(figsize=(14, 4))
plt.title("MZI")
plt.plot(1e3 * wl, jnp.abs(S["o1", "o2"]) ** 2) # type: ignore
plt.xlabel("λ [nm]")
plt.ylabel("T")
plt.grid(True)
plt.show()
18 changes: 18 additions & 0 deletions cspdk/samples/get_route.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""`get_route` returns a Manhattan route between two ports. """

import gdsfactory as gf

import cspdk

if __name__ == "__main__":
c = gf.Component("sample_connect")
mmi1 = c << cspdk.cells.mmi1x2_nc()
mmi2 = c << cspdk.cells.mmi1x2_nc()
mmi2.move((500, 50))

route = cspdk.tech.get_route_nc(
mmi1.ports["o3"],
mmi2.ports["o1"],
)
c.add(route.references)
c.show()
Loading

0 comments on commit 8e911a0

Please sign in to comment.