Skip to content

Commit 01ae01e

Browse files
committed
doroutes routing example
1 parent e299c71 commit 01ae01e

File tree

5 files changed

+212
-69
lines changed

5 files changed

+212
-69
lines changed

mycspdk/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
__version__ = "0.0.0"
2+
3+
from cspdk.si220 import PDK
4+
from doroutes.bundles import add_bundle_astar
5+
6+
from mycspdk import drc_errors as drc_errors
7+
from mycspdk import lvs_electrical as lvs_electrical
8+
from mycspdk import mzis as mzis
9+
from mycspdk import nxn as nxn
10+
11+
PDK.routing_strategies["doroute_astar"] = add_bundle_astar

mycspdk/astar_bundle_routing.pic.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# yaml-language-server: $schema=../build/schemas/bundle_routing.json
2+
instances:
3+
l1:
4+
component: straight_sc
5+
settings: {}
6+
l2:
7+
component: straight_sc
8+
settings: {}
9+
l3:
10+
component: straight_sc
11+
settings: {}
12+
l4:
13+
component: straight_sc
14+
settings: {}
15+
r1:
16+
component: straight_sc
17+
settings: {}
18+
r2:
19+
component: straight_sc
20+
settings: {}
21+
r3:
22+
component: straight_sc
23+
settings: {}
24+
r4:
25+
component: straight_sc
26+
settings: {}
27+
o1:
28+
component: straight_sc
29+
settings:
30+
width: 100
31+
length: 20
32+
o2:
33+
component: straight_sc
34+
settings:
35+
width: 20
36+
length: 20
37+
o3:
38+
component: straight_sc
39+
settings:
40+
width: 20
41+
length: 100
42+
o4:
43+
component: straight_sc
44+
settings:
45+
width: 100
46+
length: 20
47+
placements:
48+
o1:
49+
x: 50
50+
"y": -50
51+
dx: 49.121
52+
dy: 31.833
53+
rotation: 0
54+
mirror: false
55+
o2:
56+
x: 120
57+
"y": -60
58+
dx: 13.433
59+
dy: 51.943
60+
rotation: 0
61+
mirror: false
62+
l1:
63+
"y": 100
64+
l2:
65+
"y": 0
66+
l3:
67+
"y": -100
68+
l4:
69+
"y": -200
70+
r1:
71+
x: 200
72+
"y": 100
73+
r2:
74+
x: 200
75+
"y": 0
76+
r3:
77+
x: 200
78+
"y": -100
79+
r4:
80+
x: 200
81+
"y": -200
82+
o4:
83+
dx: 63.609
84+
dy: 62.556
85+
rotation: 0
86+
mirror: false
87+
o3:
88+
dx: 63.663
89+
dy: -95.996
90+
rotation: 0
91+
mirror: false
92+
connections: {}
93+
routes:
94+
my_bundle:
95+
links:
96+
r1-4,o1: l1-4,o2
97+
routing_strategy: doroute_astar
98+
settings:
99+
spacing: 2
100+
bend:
101+
component: bend_euler
102+
settings:
103+
radius: 10
104+
straight: straight
105+
layer: WG
106+
nets: []
107+
ports: {}

mycspdk/astar_bundle_routing.scm.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
transforms:
2+
s1:
3+
translation:
4+
x: -123.92189
5+
y: -71.28599
6+
z: 2.0
7+
rotation:
8+
x: 0.0
9+
y: 0.0
10+
z: 0.0
11+
w: 1.0
12+
scale:
13+
x: 1.0
14+
y: 1.0
15+
z: 1.0
16+
s2:
17+
translation:
18+
x: -118.73653
19+
y: -280.42282
20+
z: 9992.0
21+
rotation:
22+
x: 0.0
23+
y: 0.0
24+
z: 0.0
25+
w: 1.0
26+
scale:
27+
x: 1.0
28+
y: 1.0
29+
z: 1.0
30+
s3:
31+
translation:
32+
x: 270.16696
33+
y: -55.755997
34+
z: 2.0
35+
rotation:
36+
x: 0.0
37+
y: 0.0
38+
z: 0.0
39+
w: 1.0
40+
scale:
41+
x: 1.0
42+
y: 1.0
43+
z: 1.0
44+
s4:
45+
translation:
46+
x: 271.20398
47+
y: -274.21082
48+
z: 2.0
49+
rotation:
50+
x: 0.0
51+
y: 0.0
52+
z: 0.0
53+
w: 1.0
54+
scale:
55+
x: 1.0
56+
y: 1.0
57+
z: 1.0
58+
component_ports:
59+
straight_sc:
60+
o2: e
61+
o1: w

mycspdk/lvs_electrical.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -67,46 +67,3 @@ def pads_shorted(pad=cells.pad, cross_section="metal_routing") -> gf.Component:
6767
c, bl.ports["e2"], tl.ports["e4"], cross_section=cross_section
6868
)
6969
return c
70-
71-
72-
@gf.cell
73-
def demo_astar_optical() -> gf.Component:
74-
c = gf.Component()
75-
cross_section_name = "xs_sc"
76-
port_prefix = "o"
77-
bend = gf.components.bend_euler
78-
79-
cross_section = gf.get_cross_section(cross_section_name, radius=5)
80-
w = gf.components.straight(cross_section=cross_section)
81-
left = c << w
82-
right = c << w
83-
right.rotate(90) # type: ignore[arg-type]
84-
right.move((168, 63))
85-
86-
obstacle = gf.components.rectangle(size=(250, 3), layer="PAD")
87-
obstacle1 = c << obstacle
88-
obstacle2 = c << obstacle
89-
obstacle3 = c << obstacle
90-
obstacle4 = c << obstacle
91-
obstacle4.rotate(90) # type: ignore[arg-type]
92-
obstacle1.ymin = 50
93-
obstacle1.xmin = -10
94-
obstacle2.xmin = 35
95-
obstacle3.ymin = 42
96-
obstacle3.xmin = 72.23 # type: ignore
97-
obstacle4.xmin = 200
98-
obstacle4.ymin = 55
99-
port1 = left.ports[f"{port_prefix}1"]
100-
port2 = right.ports[f"{port_prefix}2"]
101-
102-
gf.routing.route_astar(
103-
component=c,
104-
port1=port1,
105-
port2=port2,
106-
cross_section=cross_section,
107-
resolution=15,
108-
distance=12,
109-
avoid_layers=("PAD",),
110-
bend=bend,
111-
)
112-
return c

pyproject.toml

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,29 @@ build-backend = "setuptools.build_meta"
33
requires = ["setuptools", "pip", "build", "wheel"]
44

55
[project]
6-
authors = [{name = "GDSFactory", email = "[email protected]"}]
7-
classifiers = [
8-
"Programming Language :: Python :: 3.12"
9-
]
10-
dependencies = ["cspdk==0.13.0"]
6+
authors = [{ name = "GDSFactory", email = "[email protected]" }]
7+
classifiers = ["Programming Language :: Python :: 3.12"]
118
description = "My cspdk demo project"
129
keywords = ["eda", "photonics", "python", "cspdk", "cornerstone"]
13-
license = {file = "LICENSE"}
10+
license = { file = "LICENSE" }
1411
name = "mycspdk"
1512
readme = "README.md"
1613
requires-python = "~=3.12.0"
1714
version = "0.0.0"
15+
dependencies = [
16+
"cspdk==0.13.0",
17+
"doroutes>=0.0.1",
18+
"gdsfactoryplus>=0.35.4",
19+
]
1820

1921
[project.optional-dependencies]
20-
dev = ["pre-commit", "ruff", "tbump", "ruff", "uv"]
22+
dev = [
23+
"pre-commit",
24+
"ruff",
25+
"ruff",
26+
"tbump",
27+
"uv",
28+
]
2129

2230
[tool.codespell]
2331
ignore-words-list = "te, te/tm, te, ba, fpr, fpr_spacing, ro, nd, donot, schem"
@@ -38,29 +46,29 @@ reportUnusedExpression = false
3846

3947
[tool.ruff]
4048
ignore = [
41-
"B008", # do not perform function calls in argument defaults
42-
"B028", # stacklevel
49+
"B008", # do not perform function calls in argument defaults
50+
"B028", # stacklevel
4351
"B904",
44-
"B905", # `zip()` without an explicit `strict=` parameter
45-
"C408", # C408 Unnecessary `dict` call (rewrite as a literal)
46-
"C901", # too complex
47-
"D100", # public module docstrings
48-
"D101", # public class docstrings
49-
"D102", # public method docstrings
50-
"D103", # public function docstrings
51-
"D104", # public package docstrings
52-
"E501" # line too long, handled by black
52+
"B905", # `zip()` without an explicit `strict=` parameter
53+
"C408", # C408 Unnecessary `dict` call (rewrite as a literal)
54+
"C901", # too complex
55+
"D100", # public module docstrings
56+
"D101", # public class docstrings
57+
"D102", # public method docstrings
58+
"D103", # public function docstrings
59+
"D104", # public package docstrings
60+
"E501", # line too long, handled by black
5361
]
5462
select = [
55-
"B", # flake8-bugbear
56-
"C", # flake8-comprehensions
57-
"D", # pydocstyle
58-
"E", # pycodestyle errors
59-
"F", # pyflakes
60-
"I", # isort
61-
"T10", # flake8-debugger
63+
"B", # flake8-bugbear
64+
"C", # flake8-comprehensions
65+
"D", # pydocstyle
66+
"E", # pycodestyle errors
67+
"F", # pyflakes
68+
"I", # isort
69+
"T10", # flake8-debugger
6270
"UP", # pyupgrade
63-
"W" # pycodestyle warnings
71+
"W", # pycodestyle warnings
6472
]
6573

6674
[tool.ruff.pydocstyle]

0 commit comments

Comments
 (0)