Skip to content

Commit

Permalink
Merge pull request #181 from mabrains/pcells_fixes
Browse files Browse the repository at this point in the history
Fixing some issues in pcells with latest gf version
  • Loading branch information
atorkmabrains authored Oct 25, 2023
2 parents 02a6555 + b23e591 commit 38d30af
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 154 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,4 @@ cython_debug/
.vscode/
*.lyrdb
run_*_regr/
pcells_run_*/
3 changes: 1 addition & 2 deletions cells/klayout/pymacros/cells/draw_cap_mim.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def draw_cap_mim(

c.write_gds("mim_cap_temp.gds")
layout.read("mim_cap_temp.gds")
cell_name = "mim_cap_dev"
os.remove("mim_cap_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)
4 changes: 1 addition & 3 deletions cells/klayout/pymacros/cells/draw_cap_mos.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ def draw_cap_mos(
# generating contacts

if deepnwell == 0 and gr_imp == layer["nplus"]:
print("here")

nwell_rect = c.add_ref(
gf.components.rectangle(
Expand Down Expand Up @@ -524,7 +523,6 @@ def draw_cap_mos(

c.write_gds("cap_mos_temp.gds")
layout.read("cap_mos_temp.gds")
cell_name = "cap_mos_dev"
os.remove("cap_mos_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)
18 changes: 6 additions & 12 deletions cells/klayout/pymacros/cells/draw_diode.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,9 @@ def draw_diode_nd2ps(

c.write_gds("diode_nd2ps_temp.gds")
layout.read("diode_nd2ps_temp.gds")
cell_name = "diode_nd2ps_dev"
os.remove("diode_nd2ps_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


def draw_diode_pd2nw(
Expand Down Expand Up @@ -697,10 +696,9 @@ def draw_diode_pd2nw(

c.write_gds("diode_pd2nw_temp.gds")
layout.read("diode_pd2nw_temp.gds")
cell_name = "diode_pd2nw_dev"
os.remove("diode_pd2nw_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


def draw_diode_nw2ps(
Expand Down Expand Up @@ -838,10 +836,9 @@ def draw_diode_nw2ps(

c.write_gds("diode_nw2ps_temp.gds")
layout.read("diode_nw2ps_temp.gds")
cell_name = "diode_nw2ps_dev"
os.remove("diode_nw2ps_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


def draw_diode_pw2dw(
Expand Down Expand Up @@ -1275,10 +1272,9 @@ def draw_diode_pw2dw(

c.write_gds("diode_pw2dw_temp.gds")
layout.read("diode_pw2dw_temp.gds")
cell_name = "diode_pw2dw_dev"
os.remove("diode_pw2dw_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


def draw_diode_dw2ps(
Expand Down Expand Up @@ -1677,10 +1673,9 @@ def draw_diode_dw2ps(

c.write_gds("diode_dw2ps_temp.gds")
layout.read("diode_dw2ps_temp.gds")
cell_name = "diode_dw2ps_dev"
os.remove("diode_dw2ps_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


def draw_sc_diode(
Expand Down Expand Up @@ -2073,7 +2068,6 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component:

c.write_gds("sc_diode_temp.gds")
layout.read("sc_diode_temp.gds")
cell_name = "sc_diode_dev"
os.remove("sc_diode_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)
26 changes: 7 additions & 19 deletions cells/klayout/pymacros/cells/draw_fet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,6 @@ def bulk_m1_check(bulk_con_area, m1_area, c_inst, bulk_con):
bulk_m1.ymin = bulk_con.ymin - (bulk_m1.size[1] - bulk_con.size[1]) / 2


# @gf.cell
def draw_nfet(
layout,
l_gate: float = 0.28,
Expand Down Expand Up @@ -1289,7 +1288,7 @@ def draw_nfet(
sd_l = sd_l_con

# gds components to store a single instance and the generated device
c = gf.Component("sky_nfet_dev")
c = gf.Component("nfet_dev")

c_inst = gf.Component("dev_temp")

Expand Down Expand Up @@ -1425,7 +1424,6 @@ def draw_nfet(
y_range=(rect_pc.ymin, rect_pc.ymax),
base_layer=layer["poly2"],
metal_level=1,
li_enc_dir="H",
)
c_pl_con = c_pc.add_ref(poly_con)

Expand Down Expand Up @@ -1712,11 +1710,9 @@ def draw_nfet(
# creating layout and cell in klayout
c.write_gds("nfet_temp.gds")
layout.read("nfet_temp.gds")
cell_name = "sky_nfet_dev"
os.remove("nfet_temp.gds")

return layout.cell(cell_name)
# return c
return layout.cell(c.name)


@gf.cell
Expand Down Expand Up @@ -1823,7 +1819,6 @@ def pfet_deep_nwell(
return c


# @gf.cell
def draw_pfet(
layout,
l_gate: float = 0.28,
Expand Down Expand Up @@ -1907,7 +1902,7 @@ def draw_pfet(
sd_l = sd_l_con

# gds components to store a single instance and the generated device
c = gf.Component("sky_pfet_dev")
c = gf.Component("pfet_dev")

c_inst = gf.Component("dev_temp")

Expand Down Expand Up @@ -2043,7 +2038,6 @@ def draw_pfet(
y_range=(rect_pc.ymin, rect_pc.ymax),
base_layer=layer["poly2"],
metal_level=1,
li_enc_dir="H",
)
c_pl_con = c_pc.add_ref(poly_con)

Expand Down Expand Up @@ -2342,12 +2336,12 @@ def draw_pfet(
# bulk guardring

# creating layout and cell in klayout

c.write_gds("pfet_temp.gds")
layout.read("pfet_temp.gds")
cell_name = "sky_pfet_dev"
os.remove("pfet_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


def draw_nfet_06v0_nvt(
Expand Down Expand Up @@ -2416,7 +2410,7 @@ def draw_nfet_06v0_nvt(
sd_l = sd_l_con

# gds components to store a single instance and the generated device
c = gf.Component("sky_nfet_nvt_dev")
c = gf.Component("nfet_nvt_dev")

c_inst = gf.Component("dev_temp")

Expand Down Expand Up @@ -2554,7 +2548,6 @@ def draw_nfet_06v0_nvt(
y_range=(rect_pc.ymin, rect_pc.ymax),
base_layer=layer["poly2"],
metal_level=1,
li_enc_dir="H",
)
c_pc.add_ref(poly_con)

Expand Down Expand Up @@ -2977,11 +2970,6 @@ def draw_nfet_06v0_nvt(

c.write_gds("nfet_nvt_temp.gds")
layout.read("nfet_nvt_temp.gds")
cell_name = "sky_nfet_nvt_dev"
os.remove("nfet_nvt_temp.gds")

return layout.cell(cell_name)


if __name__ == "__main__":
pass
return layout.cell(c.name)
22 changes: 8 additions & 14 deletions cells/klayout/pymacros/cells/draw_res.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ def draw_metal_res(
)

# creating layout and cell in klayout

c.write_gds("res_temp.gds")
layout.read("res_temp.gds")
cell_name = "res_dev"
os.remove("res_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


@gf.cell
Expand Down Expand Up @@ -476,10 +476,9 @@ def draw_nplus_res(

c.write_gds("res_temp.gds")
layout.read("res_temp.gds")
cell_name = "res_dev"
os.remove("res_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


def draw_pplus_res(
Expand Down Expand Up @@ -561,10 +560,9 @@ def draw_pplus_res(

c.write_gds("res_temp.gds")
layout.read("res_temp.gds")
cell_name = "res_dev"
os.remove("res_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


@gf.cell
Expand Down Expand Up @@ -770,10 +768,9 @@ def draw_npolyf_res(

c.write_gds("res_temp.gds")
layout.read("res_temp.gds")
cell_name = "res_dev"
os.remove("res_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


def draw_ppolyf_res(
Expand Down Expand Up @@ -846,10 +843,9 @@ def draw_ppolyf_res(

c.write_gds("res_temp.gds")
layout.read("res_temp.gds")
cell_name = "res_dev"
os.remove("res_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


def draw_ppolyf_u_high_Rs_res(
Expand Down Expand Up @@ -1060,10 +1056,9 @@ def draw_ppolyf_u_high_Rs_res(

c.write_gds("res_temp.gds")
layout.read("res_temp.gds")
cell_name = "res_dev"
os.remove("res_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)


def draw_well_res(
Expand Down Expand Up @@ -1237,7 +1232,6 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component:

c.write_gds("res_temp.gds")
layout.read("res_temp.gds")
cell_name = "res_dev"
os.remove("res_temp.gds")

return layout.cell(cell_name)
return layout.cell(c.name)
4 changes: 2 additions & 2 deletions cells/klayout/pymacros/cells/fet.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def transformation_from_shape_impl(self):
return pya.Trans(self.shape.bbox().center())

def produce_impl(self):
instance = draw_nfet(
nfet_instance = draw_nfet(
layout=self.layout,
l_gate=self.l_gate,
w_gate=self.w_gate,
Expand All @@ -187,7 +187,7 @@ def produce_impl(self):
patt_lbl=self.patt_lbl,
)
write_cells = pya.CellInstArray(
instance.cell_index(),
nfet_instance.cell_index(),
pya.Trans(pya.Point(0, 0)),
pya.Vector(0, 0),
pya.Vector(0, 0),
Expand Down
Loading

0 comments on commit 38d30af

Please sign in to comment.