Skip to content

Commit e365e6a

Browse files
authored
Merge pull request #149 from gdsfactory/feat/consolidate-tags-on-decorator
refactor: consolidate cell tags onto @gf.cell decorator
2 parents d119d9c + 4f57916 commit e365e6a

27 files changed

Lines changed: 211 additions & 248 deletions

ihp/cells/antennas.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ def dantenna_schematic(
131131
guardRingDistance: float = 1.0,
132132
) -> DSchematic:
133133
s = DSchematic()
134-
s.info["tags"] = ["IHP", "diode", "antenna"]
135134
s.info["symbol"] = "diode"
136135
s.info["ports"] = [
137136
{"name": "1", "side": "top", "type": "electric"},
@@ -153,7 +152,7 @@ def dantenna_schematic(
153152
return s
154153

155154

156-
@gf.cell(schematic_function=dantenna_schematic, tags={"type": "antennas"})
155+
@gf.cell(schematic_function=dantenna_schematic, tags=["IHP", "diode", "antenna"])
157156
def dantenna(
158157
width: float = 0.78,
159158
length: float = 0.78,
@@ -269,7 +268,6 @@ def dpantenna_schematic(
269268
guardRingDistance: float = 1.0,
270269
) -> DSchematic:
271270
s = DSchematic()
272-
s.info["tags"] = ["IHP", "diode", "antenna"]
273271
s.info["symbol"] = "diode"
274272
s.info["ports"] = [
275273
{"name": "1", "side": "top", "type": "electric"},
@@ -291,7 +289,7 @@ def dpantenna_schematic(
291289
return s
292290

293291

294-
@gf.cell(schematic_function=dpantenna_schematic, tags={"type": "antennas"})
292+
@gf.cell(schematic_function=dpantenna_schematic, tags=["IHP", "diode", "antenna"])
295293
def dpantenna(
296294
width: float = 0.78,
297295
length: float = 0.78,

ihp/cells/bjt_transistors.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def npn13G2_schematic(
4848
CMetY2: float = 0,
4949
) -> DSchematic:
5050
s = DSchematic()
51-
s.info["tags"] = ["IHP", "bjt", "npn"]
5251
s.info["symbol"] = "npn"
5352
s.info["ports"] = [
5453
{"name": "BN", "side": "top", "type": "electric"},
@@ -79,7 +78,7 @@ def npn13G2_schematic(
7978
return s
8079

8180

82-
@gf.cell(schematic_function=npn13G2_schematic, tags={"type": "bjt_transistors"})
81+
@gf.cell(schematic_function=npn13G2_schematic, tags=["IHP", "bjt", "npn"])
8382
def npn13G2(
8483
baspolyx: float = 0.3,
8584
bipwinx: float = 0.07,
@@ -781,7 +780,6 @@ def npn13G2L_schematic(
781780
Nx: int = 1,
782781
) -> DSchematic:
783782
s = DSchematic()
784-
s.info["tags"] = ["IHP", "bjt", "npn"]
785783
s.info["symbol"] = "npn"
786784
s.info["ports"] = [
787785
{"name": "BN", "side": "top", "type": "electric"},
@@ -810,7 +808,7 @@ def npn13G2L_schematic(
810808
return s
811809

812810

813-
@gf.cell(schematic_function=npn13G2L_schematic, tags={"type": "bjt_transistors"})
811+
@gf.cell(schematic_function=npn13G2L_schematic, tags=["IHP", "bjt", "npn"])
814812
def npn13G2L(
815813
emitter_length: float = 1,
816814
emitter_width: float = 0.07,
@@ -1374,7 +1372,6 @@ def npn13G2V_schematic(
13741372
Nx: int = 1,
13751373
) -> DSchematic:
13761374
s = DSchematic()
1377-
s.info["tags"] = ["IHP", "bjt", "npn"]
13781375
s.info["symbol"] = "npn"
13791376
s.info["ports"] = [
13801377
{"name": "BN", "side": "top", "type": "electric"},
@@ -1403,7 +1400,7 @@ def npn13G2V_schematic(
14031400
return s
14041401

14051402

1406-
@gf.cell(schematic_function=npn13G2V_schematic, tags={"type": "bjt_transistors"})
1403+
@gf.cell(schematic_function=npn13G2V_schematic, tags=["IHP", "bjt", "npn"])
14071404
def npn13G2V(
14081405
emitter_length: float = 1,
14091406
emitter_width: float = 0.12,
@@ -2073,7 +2070,6 @@ def contactArray(
20732070

20742071
def pnpMPA_schematic(length: float = 2, width: float = 0.7) -> DSchematic:
20752072
s = DSchematic()
2076-
s.info["tags"] = ["IHP", "bjt", "pnp"]
20772073
s.info["symbol"] = "pnp"
20782074
s.info["ports"] = [
20792075
{"name": "E", "side": "bottom", "type": "electric"},
@@ -2097,7 +2093,7 @@ def pnpMPA_schematic(length: float = 2, width: float = 0.7) -> DSchematic:
20972093
return s
20982094

20992095

2100-
@gf.cell(schematic_function=pnpMPA_schematic, tags={"type": "bjt_transistors"})
2096+
@gf.cell(schematic_function=pnpMPA_schematic, tags=["IHP", "bjt", "pnp"])
21012097
def pnpMPA(length: float = 2, width: float = 0.7) -> gf.Component:
21022098
"""Returns the IHP pnpMPA BJT transistor as a gdsfactory Component.
21032099

ihp/cells/bondpads.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def bondpad_schematic(
3131
) -> DSchematic:
3232
_shape_map = {"octagon": 0, "square": 1, "circle": 2}
3333
s = DSchematic()
34-
s.info["tags"] = ["IHP", "bondpad"]
3534
s.info["symbol"] = "pad"
3635
s.info["ports"] = [{"name": "PAD", "side": "top", "type": "electric"}]
3736
s.info["models"] = [
@@ -53,7 +52,7 @@ def bondpad_schematic(
5352
return s
5453

5554

56-
@gf.cell(schematic_function=bondpad_schematic, tags={"type": "bondpads"})
55+
@gf.cell(schematic_function=bondpad_schematic, tags=["IHP", "bondpad"])
5756
def bondpad(
5857
shape: Literal["octagon", "square", "circle"] = "octagon",
5958
diameter: float = 80.0,
@@ -136,7 +135,7 @@ def bondpad(
136135
return c
137136

138137

139-
@gf.cell(tags={"type": "bondpads"})
138+
@gf.cell(tags=["IHP", "bondpad", "array"])
140139
def bondpad_array(
141140
n_pads: int = 4,
142141
pad_pitch: float = 100.0,

ihp/cells/capacitors.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def cmom_extractor(
5959
return total_cap * (1 + fringe_field_factor)
6060

6161

62-
@gf.cell(tags={"type": "capacitors"})
62+
@gf.cell(tags=["IHP", "capacitor", "mom"])
6363
def cmom(
6464
nfingers: int = 1,
6565
length: float = 4.0,
@@ -319,7 +319,6 @@ def cmim_schematic(
319319
length: float = 6.0,
320320
) -> DSchematic:
321321
s = DSchematic()
322-
s.info["tags"] = ["IHP", "capacitor", "mim"]
323322
s.info["symbol"] = "capacitor"
324323
s.info["ports"] = [
325324
{"name": "MINUS", "side": "left", "type": "electric"},
@@ -341,7 +340,7 @@ def cmim_schematic(
341340
return s
342341

343342

344-
@gf.cell(schematic_function=cmim_schematic, tags={"type": "capacitors"})
343+
@gf.cell(schematic_function=cmim_schematic, tags=["IHP", "capacitor", "mim"])
345344
def cmim(
346345
width: float = 6.0,
347346
length: float = 6.0,
@@ -563,7 +562,6 @@ def rfcmim_schematic(
563562
length: float = 7.0,
564563
) -> DSchematic:
565564
s = DSchematic()
566-
s.info["tags"] = ["IHP", "capacitor", "mim", "rf"]
567565
s.info["symbol"] = "capacitor"
568566
s.info["ports"] = [
569567
{"name": "BN", "side": "bottom", "type": "electric"},
@@ -587,7 +585,7 @@ def rfcmim_schematic(
587585
return s
588586

589587

590-
@gf.cell(schematic_function=rfcmim_schematic, tags={"type": "capacitors"})
588+
@gf.cell(schematic_function=rfcmim_schematic, tags=["IHP", "capacitor", "mim", "rf"])
591589
def rfcmim(
592590
width: float = 7.0,
593591
length: float = 7.0,

ihp/cells/containers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
__all__ = ["add_pads_top", "pack_doe", "pack_doe_grid"]
1717

1818

19-
@gf.cell(tags={"type": "containers"})
19+
@gf.cell(tags=["IHP", "container"])
2020
def add_pads_top(
2121
component: ComponentSpec = "straight",
2222
port_names: Strs | None = None,
@@ -89,7 +89,7 @@ def add_pads_top(
8989
)
9090

9191

92-
@gf.cell(tags={"type": "containers"})
92+
@gf.cell(tags=["IHP", "container"])
9393
def pack_doe(
9494
doe: ComponentSpec,
9595
settings: dict[str, tuple[Any, ...]],
@@ -132,7 +132,7 @@ def pack_doe(
132132
)
133133

134134

135-
@gf.cell(tags={"type": "containers"})
135+
@gf.cell(tags=["IHP", "container"])
136136
def pack_doe_grid(
137137
doe: ComponentSpec,
138138
settings: dict[str, tuple[Any, ...]],

ihp/cells/fet_transistors.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ def nmos_schematic(
515515
m: int = 1,
516516
) -> DSchematic:
517517
s = DSchematic()
518-
s.info["tags"] = ["IHP", "mos", "lv"]
519518
s.info["symbol"] = "nmos"
520519
s.info["ports"] = [
521520
{"name": "D", "side": "top", "type": "electric"},
@@ -546,7 +545,7 @@ def nmos_schematic(
546545
return s
547546

548547

549-
@gf.cell(schematic_function=nmos_schematic, tags={"type": "fet_transistors"})
548+
@gf.cell(schematic_function=nmos_schematic, tags=["IHP", "mos", "lv"])
550549
def nmos(
551550
width: float = 0.15,
552551
length: float = 0.13,
@@ -591,7 +590,6 @@ def pmos_schematic(
591590
m: int = 1,
592591
) -> DSchematic:
593592
s = DSchematic()
594-
s.info["tags"] = ["IHP", "mos", "lv"]
595593
s.info["symbol"] = "pmos"
596594
s.info["ports"] = [
597595
{"name": "D", "side": "top", "type": "electric"},
@@ -617,7 +615,7 @@ def pmos_schematic(
617615
return s
618616

619617

620-
@gf.cell(schematic_function=pmos_schematic, tags={"type": "fet_transistors"})
618+
@gf.cell(schematic_function=pmos_schematic, tags=["IHP", "mos", "lv"])
621619
def pmos(
622620
width: float = 0.15,
623621
length: float = 0.13,
@@ -662,7 +660,6 @@ def nmos_hv_schematic(
662660
m: int = 1,
663661
) -> DSchematic:
664662
s = DSchematic()
665-
s.info["tags"] = ["IHP", "mos", "hv"]
666663
s.info["symbol"] = "nmos"
667664
s.info["ports"] = [
668665
{"name": "D", "side": "top", "type": "electric"},
@@ -688,7 +685,7 @@ def nmos_hv_schematic(
688685
return s
689686

690687

691-
@gf.cell(schematic_function=nmos_hv_schematic, tags={"type": "fet_transistors"})
688+
@gf.cell(schematic_function=nmos_hv_schematic, tags=["IHP", "mos", "hv"])
692689
def nmos_hv(
693690
width: float = 0.60,
694691
length: float = 0.45,
@@ -733,7 +730,6 @@ def pmos_hv_schematic(
733730
m: int = 1,
734731
) -> DSchematic:
735732
s = DSchematic()
736-
s.info["tags"] = ["IHP", "mos", "hv"]
737733
s.info["symbol"] = "pmos"
738734
s.info["ports"] = [
739735
{"name": "D", "side": "top", "type": "electric"},
@@ -759,7 +755,7 @@ def pmos_hv_schematic(
759755
return s
760756

761757

762-
@gf.cell(schematic_function=pmos_hv_schematic, tags={"type": "fet_transistors"})
758+
@gf.cell(schematic_function=pmos_hv_schematic, tags=["IHP", "mos", "hv"])
763759
def pmos_hv(
764760
width: float = 0.30,
765761
length: float = 0.40,

ihp/cells/inductors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def snap_to_grid(p, grid: float = 0.005):
1111
return round(p / grid) * grid
1212

1313

14-
@gf.cell(tags={"type": "inductors"})
14+
@gf.cell(tags=["IHP", "inductor"])
1515
def inductor2(
1616
width: float = 2.0,
1717
space: float = 2.1,
@@ -305,7 +305,7 @@ def inductor2(
305305
return c
306306

307307

308-
@gf.cell(tags={"type": "inductors"})
308+
@gf.cell(tags=["IHP", "inductor"])
309309
def inductor3(
310310
width: float = 2.0,
311311
space: float = 2.1,

ihp/cells/passives.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def svaricap_schematic(
2323
nf: int = 1,
2424
) -> DSchematic:
2525
s = DSchematic()
26-
s.info["tags"] = ["IHP", "varicap", "hv"]
2726
s.info["symbol"] = "varicap"
2827
s.info["ports"] = [
2928
{"name": "BN", "side": "top", "type": "electric"},
@@ -49,7 +48,7 @@ def svaricap_schematic(
4948
return s
5049

5150

52-
@gf.cell(schematic_function=svaricap_schematic, tags={"type": "passives"})
51+
@gf.cell(schematic_function=svaricap_schematic, tags=["IHP", "varicap", "hv"])
5352
def svaricap(
5453
width: float = 1.0,
5554
length: float = 1.0,
@@ -219,7 +218,6 @@ def esd_nmos_schematic(
219218
nf: int = 10,
220219
) -> DSchematic:
221220
s = DSchematic()
222-
s.info["tags"] = ["IHP", "esd", "lv"]
223221
s.info["symbol"] = "nmos"
224222
s.info["ports"] = [
225223
{"name": "VDD", "side": "top", "type": "electric"},
@@ -241,7 +239,7 @@ def esd_nmos_schematic(
241239
return s
242240

243241

244-
@gf.cell(schematic_function=esd_nmos_schematic, tags={"type": "passives"})
242+
@gf.cell(schematic_function=esd_nmos_schematic, tags=["IHP", "esd", "lv"])
245243
def esd_nmos(
246244
width: float = 50.0,
247245
length: float = 0.5,
@@ -420,7 +418,6 @@ def ptap1_schematic(
420418
cols: int = 1,
421419
) -> DSchematic:
422420
s = DSchematic()
423-
s.info["tags"] = ["IHP", "tap", "p-type"]
424421
s.info["symbol"] = "tap"
425422
s.info["ports"] = [
426423
{"name": "P1", "side": "top", "type": "electric"},
@@ -442,7 +439,7 @@ def ptap1_schematic(
442439
return s
443440

444441

445-
@gf.cell(schematic_function=ptap1_schematic, tags={"type": "passives"})
442+
@gf.cell(schematic_function=ptap1_schematic, tags=["IHP", "tap", "p-type"])
446443
def ptap1(
447444
width: float = 1.0,
448445
length: float = 1.0,
@@ -562,7 +559,6 @@ def ntap1_schematic(
562559
cols: int = 1,
563560
) -> DSchematic:
564561
s = DSchematic()
565-
s.info["tags"] = ["IHP", "tap", "n-type"]
566562
s.info["symbol"] = "tap"
567563
s.info["ports"] = [
568564
{"name": "P1", "side": "top", "type": "electric"},
@@ -584,7 +580,7 @@ def ntap1_schematic(
584580
return s
585581

586582

587-
@gf.cell(schematic_function=ntap1_schematic, tags={"type": "passives"})
583+
@gf.cell(schematic_function=ntap1_schematic, tags=["IHP", "tap", "n-type"])
588584
def ntap1(
589585
width: float = 1.0,
590586
length: float = 1.0,
@@ -708,7 +704,7 @@ def ntap1(
708704
return c
709705

710706

711-
@gf.cell(tags={"type": "passives"})
707+
@gf.cell(tags=["IHP", "sealring"])
712708
def sealring(
713709
width: float = 200.0,
714710
height: float = 200.0,
@@ -891,7 +887,7 @@ def sealring(
891887
return c
892888

893889

894-
@gf.cell(tags={"type": "passives"})
890+
@gf.cell(tags=["IHP", "guardring"])
895891
def guard_ring(
896892
width: float = 0.5,
897893
guardRingSpacing: float = 0.14,

0 commit comments

Comments
 (0)