Skip to content

Commit

Permalink
update gdsfactory
Browse files Browse the repository at this point in the history
  • Loading branch information
joamatab committed May 4, 2024
1 parent bf6e5b9 commit f2e2049
Show file tree
Hide file tree
Showing 21 changed files with 108 additions and 104 deletions.
18 changes: 15 additions & 3 deletions docs/notebooks/intro.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,51 @@
# ---
# jupyter:
# jupytext:
# custom_cell_magics: kql
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.5
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.2
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---

# %% [markdown]
# # Layout
#
# ## Layout driven flow
#
# You can import the PDK and layout any of the standard cells

# %%
import gdsfactory as gf

# %%
import sky130.components as sc
import sky130.tech as st

# %%
c = sc.sky130_fd_sc_hd__a2111o_1()
c

# %%
scene = c.to_3d()
scene.show()

# %% [markdown]
# TODO: add Parametric cells natively into gdsfactory `sky130` pdk.

# %%
c = gf.Component()
g1 = c << sc.sky130_fd_sc_hd__a2111o_1()
g2 = c << sc.sky130_fd_sc_hd__a311oi_4()
g2.move((15, 10))
c

# %%
c = gf.Component("demo_connect")
g1 = c << sc.sky130_fd_sc_hd__a2111o_1()
g2 = c << sc.sky130_fd_sc_hd__a311oi_4()
Expand All @@ -47,16 +56,19 @@
c.add(route.references)
c

# %%
scene = c.to_3d()
scene.show()

# %% [markdown]
# ## Netlist driven flow
#
# For netlist driven flow you can define circuits for place and route. You have two options:
#
# 1. in python
# 2. in YAML

# %% [markdown]
# ## Spice simulations
#
# You can use `PySpice` for running simulations.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ classifiers = [
"Operating System :: OS Independent"
]
dependencies = [
"gdsfactory==7.16.0",
"gdsfactory==7.25.1",
"PySpice"
]
description = "skywater130 pdk"
Expand Down
20 changes: 16 additions & 4 deletions sky130/pcells/mimcap_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def mimcap_1(
m3_layer: LayerSpec = (70, 20),
via3_size: Float2 = (0.2, 0.2),
via3_layer: LayerSpec = (70, 44),
via3_enclosure: Float2 = (0.09, 0.09),
via3_spacing: Float2 = (0.2, 0.2), # (0.2,0.35),
m4_spacing: float = 0.3,
m4_r_length: float = 0.4,
Expand All @@ -24,6 +23,20 @@ def mimcap_1(
mim cap between metal 3 and 4
Args:
m3_layer: metal 3 layer.
via3_size: via3 size.
via3_layer: via3 layer.
via3_spacing: via3 spacing.
m4_spacing: metal 4 spacing.
m4_r_length: metal 4 right length.
m4_layer: metal 4 layer.
m4_length: metal 4 length.
m4_width: metal 4 width.
capm_layer: cap metal layer.
m4_enclosure: metal 4 enclosure.
capm_enclosure: cap metal enclosure.
.. plot::
:include-source:
Expand All @@ -34,7 +47,6 @@ def mimcap_1(
m3_layer=(70, 20),
via3_size=(0.2, 0.2),
via3_layer=(70, 44),
via3_enclosure=(0.09, 0.09),
via3_spacing=(0.2, 0.2),
m4_spacing=0.3,
m4_r_length=0.4,
Expand Down Expand Up @@ -74,7 +86,7 @@ def mimcap_1(

rect_m4_l = gf.components.rectangle(size=(m4_length, m4_width), layer=m4_layer)
m4_l = c.add_ref(rect_m4_l)
m4_l.connect("e3", destination=m3.ports["e1"])
m4_l.connect("e3", destination=m3.ports["e1"], allow_layer_mismatch=True)
m4_l.movex(m4_length + capm_enclosure[0] + m4_enclosure[0] + en[0] / 2)

# generate capm
Expand All @@ -83,7 +95,7 @@ def mimcap_1(
layer=capm_layer,
)
capm = c.add_ref(rect_capm)
capm.connect("e3", destination=m4_l.ports["e1"])
capm.connect("e3", destination=m4_l.ports["e1"], allow_layer_mismatch=True)
capm.movex(m4_length + m4_enclosure[0])

# generat3 via3
Expand Down
21 changes: 17 additions & 4 deletions sky130/pcells/mimcap_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def mimcap_2(
m4_layer: LayerSpec = (71, 20),
via4_size: Float2 = (0.8, 0.8),
via4_layer: LayerSpec = (71, 44),
via4_enclosure: Float2 = (0.32, 0.32),
via4_spacing: Float2 = (0.8, 0.8),
m5_spacing: float = 1.6,
m5_r_length: float = 1.6,
Expand All @@ -22,6 +21,21 @@ def mimcap_2(
) -> gf.Component:
"""Return mim cap between metal 4 and 5.
Args:
m4_layer: metal 4 layer.
via4_size: via4 size.
via4_layer: via4 layer.
via4_spacing: via4 spacing.
m5_spacing: metal 5 spacing.
m5_r_length: metal 5 right length.
m5_layer: metal 5 layer.
m5_length: metal 5 length.
m5_width: metal 5 width.
capm2_layer: cap metal 2 layer.
m5_enclosure: metal 5 enclosure.
capm2_enclosure: cap metal 2 enclosure.
.. plot::
:include-source:
Expand Down Expand Up @@ -57,7 +71,7 @@ def mimcap_2(

rect_m5_l = gf.components.rectangle(size=(m5_length, m5_width), layer=m5_layer)
m5_l = c.add_ref(rect_m5_l)
m5_l.connect("e3", destination=m4.ports["e1"])
m5_l.connect("e3", destination=m4.ports["e1"], allow_layer_mismatch=True)
m5_l.movex(m5_length + capm2_enclosure[0] + m5_enclosure[0] + en[0] / 2)

# generate capm2
Expand All @@ -66,7 +80,7 @@ def mimcap_2(
layer=capm2_layer,
)
capm2 = c.add_ref(rect_capm2)
capm2.connect("e3", destination=m5_l.ports["e1"])
capm2.connect("e3", destination=m5_l.ports["e1"], allow_layer_mismatch=True)
capm2.movex(m5_length + m5_enclosure[0])

# generat3 via4
Expand Down Expand Up @@ -108,7 +122,6 @@ def mimcap_2(
via3_arr2.movey(
(m4_width - en[1] / 2 - nr2 * via4_size[1] - (nr2 - 1) * via4_spacing[1]) / 2
)

return c


Expand Down
5 changes: 2 additions & 3 deletions sky130/pcells/nmos.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def nmos(
sdm_spacing: float = 0.13,
psdm_layer: LayerSpec = (94, 20),
li_width: float = 0.17,
li_spacing: float = 0.17,
li_layer: LayerSpec = (67, 20),
li_enclosure: float = 0.08,
mcon_layer: LayerSpec = (67, 44),
Expand Down Expand Up @@ -318,7 +317,7 @@ def nmos(
# generaing p+ bulk tie and its contact and mcon and m1
rect_dp = gf.components.rectangle(size=(sd_width, gate_width), layer=diffp_layer)
diff_p = c.add_ref(rect_dp)
diff_p.connect("e1", destination=diff_n.ports["e3"])
diff_p.connect("e1", destination=diff_n.ports["e3"], allow_layer_mismatch=True)
diff_p.movex(diff_spacing + sdm_spacing)

cont_arr4 = c.add_array(rect_c, rows=nr, columns=nc, spacing=con_sp)
Expand Down Expand Up @@ -386,7 +385,7 @@ def nmos(
layer=psdm_layer,
)
psdm = c.add_ref(rect_pm)
psdm.connect("e1", destination=diff_n.ports["e3"])
psdm.connect("e1", destination=diff_n.ports["e3"], allow_layer_mismatch=True)
psdm.movex(diff_spacing + sdm_spacing - sdm_enclosure[0])

# generating pwell
Expand Down
5 changes: 2 additions & 3 deletions sky130/pcells/nmos_5v.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def nmos_5v(
hvntm_layer: LayerSpec = (125, 20),
hvntm_enclosure: Float2 = (0.185, 0.185),
li_width: float = 0.17,
li_spacing: float = 0.17,
li_layer: LayerSpec = (67, 20),
li_enclosure: float = 0.08,
mcon_layer: LayerSpec = (67, 44),
Expand Down Expand Up @@ -279,7 +278,7 @@ def nmos_5v(
# generaing p+ bulk tie and its contact and mcon and m1
rect_dp = gf.components.rectangle(size=(sd_width, gate_width), layer=diffp_layer)
diff_p = c.add_ref(rect_dp)
diff_p.connect("e1", destination=diff_n.ports["e3"])
diff_p.connect("e1", destination=diff_n.ports["e3"], allow_layer_mismatch=True)
diff_p.movex(diff_spacing + sdm_spacing)

cont_arr4 = c.add_array(rect_c, rows=nr, columns=nc, spacing=con_sp)
Expand Down Expand Up @@ -346,7 +345,7 @@ def nmos_5v(
layer=psdm_layer,
)
psdm = c.add_ref(rect_pm)
psdm.connect("e1", destination=diff_n.ports["e3"])
psdm.connect("e1", destination=diff_n.ports["e3"], allow_layer_mismatch=True)
psdm.movex(diff_spacing + sdm_spacing - sdm_enclosure[0])

# generating pwell
Expand Down
35 changes: 15 additions & 20 deletions sky130/pcells/npn_W1L1.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@ def npn_W1L1(
contact_layer: LayerSpec = (66, 44),
contact_enclosure: Float2 = (0.06, 0.06),
pwell_layer: LayerSpec = (64, 13),
dnwell_enclosure: Float2 = (0.4, 0.4),
dnwell_layer: LayerSpec = (64, 18),
sdm_enclosure: Float2 = (0.125, 0.125),
nsdm_layer: LayerSpec = (93, 44),
sdm_spacing: float = 0.13,
psdm_layer: LayerSpec = (94, 20),
npn_layer: LayerSpec = (82, 20),
li_width: float = 0.17,
li_spacing: float = 0.17,
li_layer: LayerSpec = (67, 20),
li_enclosure: float = 0.08,
mcon_layer: LayerSpec = (67, 44),
Expand Down Expand Up @@ -171,10 +167,10 @@ def npn_W1L1(
B_in = c_B.add_ref(rect_B_in)
B_out = c_B.add_ref(rect_B_out)

B_in.connect("e1", destination=E.ports["e1"])
B_in.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
B_in.movex(E_width + np_spacing)

B_out.connect("e1", destination=E.ports["e1"])
B_out.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
B_out.movex(E_width + np_spacing + B_width)

c.add_ref(gf.geometry.boolean(A=B_out, B=B_in, operation="A-B", layer=tap_layer))
Expand All @@ -199,10 +195,10 @@ def npn_W1L1(
pmB_in = c_B.add_ref(rect_pmB_in)
pmB_out = c_B.add_ref(rect_pmB_out)

pmB_in.connect("e1", destination=E.ports["e1"])
pmB_in.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
pmB_in.movex(E_width + np_spacing - sdm_enclosure[0])

pmB_out.connect("e1", destination=E.ports["e1"])
pmB_out.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
pmB_out.movex(E_width + np_spacing + B_width + sdm_enclosure[1])

c.add_ref(
Expand Down Expand Up @@ -265,7 +261,7 @@ def npn_W1L1(
li_m1_b_in = c_B.add_ref(rect_in)
li_m1_b_out = c_B.add_ref(rect_out)

li_m1_b_in.connect("e1", destination=E.ports["e1"])
li_m1_b_in.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
li_m1_b_in.movex(
(
E_width
Expand All @@ -276,7 +272,7 @@ def npn_W1L1(
- (1 - i) * li_enclosure
)

li_m1_b_out.connect("e1", destination=E.ports["e1"])
li_m1_b_out.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
li_m1_b_out.movex(
(
E_width
Expand Down Expand Up @@ -435,10 +431,10 @@ def npn_W1L1(
C_in = c_C.add_ref(rect_C_in)
C_out = c_C.add_ref(rect_C_out)

C_in.connect("e1", destination=E.ports["e1"])
C_in.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
C_in.movex(E_width + 2.25 * np_spacing + B_width)

C_out.connect("e1", destination=E.ports["e1"])
C_out.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
C_out.movex(E_width + 2.25 * np_spacing + B_width + C_width)

c.add_ref(gf.geometry.boolean(A=C_out, B=C_in, operation="A-B", layer=tap_layer))
Expand Down Expand Up @@ -471,10 +467,10 @@ def npn_W1L1(
nmC_in = c_C.add_ref(rect_nmC_in)
nmC_out = c_C.add_ref(rect_nmC_out)

nmC_in.connect("e1", destination=E.ports["e1"])
nmC_in.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
nmC_in.movex(E_width + 2.25 * np_spacing + B_width - sdm_enclosure[0])

nmC_out.connect("e1", destination=E.ports["e1"])
nmC_out.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
nmC_out.movex(E_width + 2.25 * np_spacing + B_width + C_width + sdm_enclosure[0])

c.add_ref(
Expand Down Expand Up @@ -538,7 +534,7 @@ def npn_W1L1(
li_m1_c_in = c_C.add_ref(rect_in)
li_m1_c_out = c_C.add_ref(rect_out)

li_m1_c_in.connect("e1", destination=E.ports["e1"])
li_m1_c_in.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
li_m1_c_in.movex(
E_width
+ 2.25 * np_spacing
Expand All @@ -548,7 +544,7 @@ def npn_W1L1(
- (1 - i) * li_enclosure
)

li_m1_c_out.connect("e1", destination=E.ports["e1"])
li_m1_c_out.connect("e1", destination=E.ports["e1"], allow_layer_mismatch=True)
li_m1_c_out.movex(
E_width
+ 2.25 * np_spacing
Expand Down Expand Up @@ -727,7 +723,7 @@ def npn_W1L1(
layer=pwell_layer,
)
pwell = c.add_ref(rect_pwell)
pwell.connect("e1", destination=B_out.ports["e3"])
pwell.connect("e1", destination=B_out.ports["e3"], allow_layer_mismatch=True)
pwell.movex(B_out.xmax - B_out.xmin + diff_enclosure[0])

# generating deep nwell
Expand All @@ -740,7 +736,7 @@ def npn_W1L1(
layer=dnwell_layer,
)
dnwell = c.add_ref(rect_dnw)
dnwell.connect("e1", destination=C_out.ports["e3"])
dnwell.connect("e1", destination=C_out.ports["e3"], allow_layer_mismatch=True)
dnwell.movex(C_out.xmax - C_out.xmin + diff_enclosure[0])

# generating npn identifier
Expand All @@ -750,9 +746,8 @@ def npn_W1L1(
size=(C_out.xmax - C_out.xmin, C_out.ymax - C_out.ymin), layer=npn_layer
)
)
npn.connect("e1", destination=C_out.ports["e3"])
npn.connect("e1", destination=C_out.ports["e3"], allow_layer_mismatch=True)
npn.movex(C_out.xmax - C_out.xmin)

return c


Expand Down
Loading

0 comments on commit f2e2049

Please sign in to comment.