From 9f89a378c5e47ed88f46f8c987f0e782e2edbb7a Mon Sep 17 00:00:00 2001 From: Joaquin Matres <4514346+joamatab@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:52:05 -0700 Subject: [PATCH] update to gdsfactory8 --- .pre-commit-config.yaml | 46 -- gf180/__init__.py | 2 +- gf180/cap_mim.py | 26 +- gf180/cap_mos.py | 128 ++-- gf180/cells/klayout/pymacros/cells/bjt.py | 4 +- gf180/cells/klayout/pymacros/cells/cap_mim.py | 4 +- gf180/cells/klayout/pymacros/cells/cap_mos.py | 16 +- gf180/cells/klayout/pymacros/cells/diode.py | 24 +- .../klayout/pymacros/cells/draw_cap_mim.py | 26 +- .../klayout/pymacros/cells/draw_cap_mos.py | 128 ++-- .../klayout/pymacros/cells/draw_diode.py | 612 +++++++-------- .../cells/klayout/pymacros/cells/draw_fet.py | 696 +++++++++--------- .../cells/klayout/pymacros/cells/draw_res.py | 282 +++---- gf180/cells/klayout/pymacros/cells/efuse.py | 4 +- gf180/cells/klayout/pymacros/cells/fet.py | 12 +- gf180/cells/klayout/pymacros/cells/res.py | 48 +- .../klayout/pymacros/cells/via_generator.py | 28 +- gf180/diode.py | 626 ++++++++-------- gf180/fet.py | 584 ++++++++------- gf180/guardring.py | 58 +- gf180/layers.py | 7 +- gf180/res.py | 224 +++--- gf180/via_generator.py | 36 +- pyproject.toml | 2 +- .../alter_interdig_alter_in_a0369a3e.gds | Bin 0 -> 3048 bytes .../labels_gen_labels_gen_L_f6da3bfa.gds | Bin 0 -> 874 bytes .../nfet_deep_nwell_nfet_de_970c9e54.gds | Bin 0 -> 840 bytes .../pfet_deep_nwell_pfet_de_aa0915e5.gds | Bin 0 -> 2548 bytes .../via_generator_via_gener_cc16eff4.gds | Bin 0 -> 2540 bytes 29 files changed, 1826 insertions(+), 1797 deletions(-) create mode 100644 tests/gds_ref/alter_interdig_alter_in_a0369a3e.gds create mode 100644 tests/gds_ref/labels_gen_labels_gen_L_f6da3bfa.gds create mode 100644 tests/gds_ref/nfet_deep_nwell_nfet_de_970c9e54.gds create mode 100644 tests/gds_ref/pfet_deep_nwell_pfet_de_aa0915e5.gds create mode 100644 tests/gds_ref/via_generator_via_gener_cc16eff4.gds diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 68b9211..62037fb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,49 +25,3 @@ repos: rev: 953faa6870f6663ac0121ab4a800f1ce76bca31f hooks: - id: shellcheck - - # - repo: https://github.com/pre-commit/mirrors-mypy - # rev: "v1.0.1" - # hooks: - # - id: mypy - # exclude: ^(docs/|example-plugin/|tests/fixtures) - # additional_dependencies: - # - "pydantic" - - - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: d2425a62376c2197448cce2f825d5a0c3926b862 - hooks: - - id: pretty-format-toml - args: [--autofix] - - # - repo: https://github.com/aristanetworks/j2lint.git - # rev: 742a25ef5da996b9762f167ebae9bc8223e8382e - # hooks: - # - id: j2lint - # types: [file] - # files: \.(j2|yml|yaml)$ - # args: [--extensions, "j2,yml,yaml", --ignore, jinja-statements-delimiter, jinja-statements-indentation, --] - # exclude: .github/.* - - repo: https://github.com/codespell-project/codespell - rev: 38bc4a97f6e22827e86526148efa38f1044a97f8 - hooks: - - id: codespell - additional_dependencies: - - tomli - - # - repo: https://github.com/kynan/nbstripout - # rev: e4c5b4dcbab4afa0b88b7a9243db42b1a8d95dde - # hooks: - # - id: nbstripout - # files: ".ipynb" - # - repo: https://github.com/pre-commit/pygrep-hooks - # rev: 7b4409161486c6956bb3206ce96db5d56731b1b9 # Use the ref you want to point at - # hooks: - # - id: python-use-type-annotations - # - repo: https://github.com/PyCQA/bandit - # rev: fe1361fdcc274850d4099885a802f2c9f28aca08 - # hooks: - # - id: bandit - # args: [--exit-zero] - # # ignore all tests, not just tests data - # exclude: ^tests/ diff --git a/gf180/__init__.py b/gf180/__init__.py index 908ef60..ce002ce 100644 --- a/gf180/__init__.py +++ b/gf180/__init__.py @@ -106,7 +106,7 @@ PDK = Pdk( name="gf180", cells=cells, - layers=dict(LAYER), + layers=LAYER, layer_views=LAYER_VIEWS, # layer_stack=LAYER_STACK, ) diff --git a/gf180/cap_mim.py b/gf180/cap_mim.py index c430709..5782a53 100644 --- a/gf180/cap_mim.py +++ b/gf180/cap_mim.py @@ -83,14 +83,14 @@ def cap_mim( size=(m_up.size[0], m_up.size[1]), layer=layer["fusetop"] ) ) - fusetop.xmin = m_up.xmin - fusetop.ymin = m_up.ymin + fusetop.dxmin = m_up.dxmin + fusetop.dymin = m_up.dymin mim_l_mk = c.add_ref( gf.components.rectangle(size=(fusetop.size[0], l_mk_w), layer=layer["mim_l_mk"]) ) - mim_l_mk.xmin = fusetop.xmin - mim_l_mk.ymin = fusetop.ymin + mim_l_mk.dxmin = fusetop.dxmin + mim_l_mk.dymin = fusetop.dymin m_dn = c.add_ref( gf.components.rectangle( @@ -98,38 +98,38 @@ def cap_mim( layer=bottom_layer, ) ) - m_dn.xmin = m_up.xmin - bot_enc_top - m_dn.ymin = m_up.ymin - bot_enc_top + m_dn.dxmin = m_up.dxmin - bot_enc_top + m_dn.dymin = m_up.dymin - bot_enc_top cap_mk = c.add_ref( gf.components.rectangle( size=(m_dn.size[0], m_dn.size[1]), layer=layer["cap_mk"] ) ) - cap_mk.xmin = m_dn.xmin - cap_mk.ymin = m_dn.ymin + cap_mk.dxmin = m_dn.dxmin + cap_mk.dymin = m_dn.dymin # generating labels if label == 1: c.add_label( top_label, - position=(m_up.xmin + (m_up.size[0] / 2), m_dn.xmin + (m_dn.size[1] / 2)), + position=(m_up.dxmin + (m_up.size[0] / 2), m_dn.dxmin + (m_dn.size[1] / 2)), layer=up_label_layer, ) c.add_label( bot_label, position=( - m_dn.xmin + (m_dn.size[0] / 2), - m_dn.ymin + (m_up.ymin - m_dn.ymin) / 2, + m_dn.dxmin + (m_dn.size[0] / 2), + m_dn.dymin + (m_up.dymin - m_dn.dymin) / 2, ), layer=bot_label_layer, ) # generating vias via = via_generator( - x_range=(m_up.xmin, m_up.xmax), - y_range=(m_up.ymin, m_up.ymax), + x_range=(m_up.dxmin, m_up.dxmax), + y_range=(m_up.dymin, m_up.dymax), via_enclosure=via_enc, via_layer=via_layer, via_size=via_size, diff --git a/gf180/cap_mos.py b/gf180/cap_mos.py index b4730bf..81e7f8c 100644 --- a/gf180/cap_mos.py +++ b/gf180/cap_mos.py @@ -45,13 +45,13 @@ def cap_mos_inst( size=(cmp.size[0], cmp.size[1]), layer=layer["mos_cap_mk"] ) ) - cap_mk.xmin = cmp.xmin - cap_mk.ymin = cmp.ymin + cap_mk.dxmin = cmp.dxmin + cap_mk.dymin = cmp.dymin c_inst.add_array( component=via_stack( - x_range=(cmp.xmin, cmp.xmin + con_w), - y_range=(cmp.ymin, cmp.ymax), + x_range=(cmp.dxmin, cmp.dxmin + con_w), + y_range=(cmp.dymin, cmp.dymax), base_layer=layer["comp"], metal_level=1, ), @@ -69,19 +69,19 @@ def cap_mos_inst( layer=implant_layer, ) ) - imp_rect.xmin = cmp.xmin - implant_enc[0] - imp_rect.ymin = cmp.ymin - implant_enc[1] + imp_rect.dxmin = cmp.dxmin - implant_enc[0] + imp_rect.dymin = cmp.dymin - implant_enc[1] poly = c_inst.add_ref( gf.components.rectangle(size=(lc, pl_l), layer=layer["poly2"]) ) - poly.xmin = cmp.xmin + cmp_ext - poly.ymin = cmp.ymin - pl_ext + poly.dxmin = cmp.dxmin + cmp_ext + poly.dymin = cmp.dymin - pl_ext pl_con_el = via_stack( - x_range=(poly.xmin, poly.xmax), - y_range=(poly.ymin, poly.ymin + con_w), + x_range=(poly.dxmin, poly.dxmax), + y_range=(poly.dymin, poly.dymin + con_w), base_layer=layer["poly2"], metal_level=1, ) @@ -99,8 +99,8 @@ def cap_mos_inst( c_inst.add_label( g_label, position=( - pl_con.xmin + (pl_con.size[0] / 2), - pl_con.ymin + (pl_con_el.size[1] / 2), + pl_con.dxmin + (pl_con.size[0] / 2), + pl_con.dymin + (pl_con_el.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -110,8 +110,8 @@ def cap_mos_inst( size=(pl_con.size[0], pl_con.size[1]), layer=layer["metal1"] ) ) - pl_m1.xmin = pl_con.xmin - pl_m1.ymin = pl_con.ymin + pl_m1.dxmin = pl_con.dxmin + pl_m1.dymin = pl_con.dymin return c_inst @@ -204,22 +204,22 @@ def cap_mos( columns=2, spacing=(m1_w + cmp_w - 2 * cmp_ed_w, 0), ) - cmp_m1_v.xmin = cmp_m1_xmin - (m1_w - (cmp_m1_xmax - cmp_m1_xmin)) - cmp_m1_v.ymax = cmp_m1_ymax + cmp_m1_v.dxmin = cmp_m1_xmin - (m1_w - (cmp_m1_xmax - cmp_m1_xmin)) + cmp_m1_v.dymax = cmp_m1_ymax cmp_m1_h = c.add_ref( gf.components.rectangle(size=(cmp_m1_v.size[0], m1_w), layer=layer["metal1"]) ) - cmp_m1_h.xmin = cmp_m1_v.xmin - cmp_m1_h.ymax = cmp_m1_v.ymin + cmp_m1_h.dxmin = cmp_m1_v.dxmin + cmp_m1_h.dymax = cmp_m1_v.dymin # sd labels generation if label == 1: c.add_label( sd_label, position=( - cmp_m1_h.xmin + (cmp_m1_h.size[0] / 2), - cmp_m1_h.ymin + (cmp_m1_h.size[1] / 2), + cmp_m1_h.dxmin + (cmp_m1_h.size[0] / 2), + cmp_m1_h.dymin + (cmp_m1_h.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -236,8 +236,8 @@ def cap_mos( layer=layer["dualgate"], ) ) - dg.xmin = c_inst.xmin - dg_enc_cmp - dg.ymin = c_inst.ymin - dg_enc_poly + dg.dxmin = c_inst.dxmin - dg_enc_cmp + dg.dymin = c_inst.dymin - dg_enc_poly cmp_polys = c_inst.get_polygons(by_spec=layer["comp"]) cmp_xmin = np.min(cmp_polys[0][:, 0]) @@ -256,8 +256,8 @@ def cap_mos( layer=layer["nwell"], ) ) - nwell.xmin = cmp_xmin - np_enc_cmp - nwell.ymin = cmp_ymin - np_enc_gate + nwell.dxmin = cmp_xmin - np_enc_cmp + nwell.dymin = cmp_ymin - np_enc_gate else: lvpwell = c.add_ref( gf.components.rectangle( @@ -269,8 +269,8 @@ def cap_mos( ) ) - lvpwell.xmin = cmp_xmin - np_enc_cmp - lvpwell.ymin = cmp_ymin - np_enc_gate + lvpwell.dxmin = cmp_xmin - np_enc_cmp + lvpwell.dymin = cmp_ymin - np_enc_gate if deepnwell == 1: if type == "cap_nmos": @@ -284,8 +284,8 @@ def cap_mos( ) ) - lvp_rect.xmin = c_inst.xmin - lvpwell_enc_ncmp - lvp_rect.ymin = c_inst.ymin - lvpwell_enc_ncmp + lvp_rect.dxmin = c_inst.dxmin - lvpwell_enc_ncmp + lvp_rect.dymin = c_inst.dymin - lvpwell_enc_ncmp dn_rect = c.add_ref( gf.components.rectangle( @@ -297,8 +297,8 @@ def cap_mos( ) ) - dn_rect.xmin = lvp_rect.xmin - dn_enc_lvpwell - dn_rect.ymin = lvp_rect.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvp_rect.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvp_rect.dymin - dn_enc_lvpwell else: dn_rect = c.add_ref( @@ -311,33 +311,35 @@ def cap_mos( ) ) - dn_rect.xmin = c_inst.xmin - dnwell_enc_pcmp - dn_rect.ymin = c_inst.ymin - dnwell_enc_pcmp + dn_rect.dxmin = c_inst.dxmin - dnwell_enc_pcmp + dn_rect.dymin = c_inst.dymin - dnwell_enc_pcmp if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * grw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * grw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * grw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * grw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - grw, rect_pcmpgr_in.ymin - grw)) + rect_pcmpgr_out.dmove( + (rect_pcmpgr_in.dxmin - grw, rect_pcmpgr_in.dymin - grw) + ) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -350,31 +352,33 @@ def cap_mos( psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * comp_pp_enc, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * comp_pp_enc, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * comp_pp_enc, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + comp_pp_enc, - rect_pcmpgr_in.ymin + comp_pp_enc, + rect_pcmpgr_in.dxmin + comp_pp_enc, + rect_pcmpgr_in.dymin + comp_pp_enc, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * comp_pp_enc, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * comp_pp_enc, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + + 2 * comp_pp_enc, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - comp_pp_enc, - rect_pcmpgr_out.ymin - comp_pp_enc, + rect_pcmpgr_out.dxmin - comp_pp_enc, + rect_pcmpgr_out.dymin - comp_pp_enc, ) ) c.add_ref( @@ -388,10 +392,10 @@ def cap_mos( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -402,10 +406,10 @@ def cap_mos( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -415,10 +419,10 @@ def cap_mos( c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -429,10 +433,10 @@ def cap_mos( c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -457,7 +461,7 @@ def cap_mos( layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - grw, rect_pcmpgr_in.ymin - grw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - grw, rect_pcmpgr_in.dymin - grw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, diff --git a/gf180/cells/klayout/pymacros/cells/bjt.py b/gf180/cells/klayout/pymacros/cells/bjt.py index a3152df..2fd8ec7 100644 --- a/gf180/cells/klayout/pymacros/cells/bjt.py +++ b/gf180/cells/klayout/pymacros/cells/bjt.py @@ -67,7 +67,7 @@ def parameters_from_shape_impl(self): pass def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation pass @@ -134,7 +134,7 @@ def parameters_from_shape_impl(self): pass def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation pass diff --git a/gf180/cells/klayout/pymacros/cells/cap_mim.py b/gf180/cells/klayout/pymacros/cells/cap_mim.py index d6ce131..bacb596 100644 --- a/gf180/cells/klayout/pymacros/cells/cap_mim.py +++ b/gf180/cells/klayout/pymacros/cells/cap_mim.py @@ -85,9 +85,9 @@ def parameters_from_shape_impl(self): self.lc = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): option = os.environ["GF_PDK_OPTION"] diff --git a/gf180/cells/klayout/pymacros/cells/cap_mos.py b/gf180/cells/klayout/pymacros/cells/cap_mos.py index b2419c9..1a04a3a 100644 --- a/gf180/cells/klayout/pymacros/cells/cap_mos.py +++ b/gf180/cells/klayout/pymacros/cells/cap_mos.py @@ -89,9 +89,9 @@ def parameters_from_shape_impl(self): self.lc = self.layout.get_info(self.lcayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): np_instance = draw_cap_mos( @@ -173,9 +173,9 @@ def parameters_from_shape_impl(self): self.lc = self.layout.get_info(self.lcayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): np_instance = draw_cap_mos( @@ -255,9 +255,9 @@ def parameters_from_shape_impl(self): self.lc = self.layout.get_info(self.lcayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): np_instance = draw_cap_mos( @@ -337,9 +337,9 @@ def parameters_from_shape_impl(self): self.lc = self.layout.get_info(self.lcayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): np_instance = draw_cap_mos( diff --git a/gf180/cells/klayout/pymacros/cells/diode.py b/gf180/cells/klayout/pymacros/cells/diode.py index 25dacba..894cb89 100644 --- a/gf180/cells/klayout/pymacros/cells/diode.py +++ b/gf180/cells/klayout/pymacros/cells/diode.py @@ -100,9 +100,9 @@ def parameters_from_shape_impl(self): self.la = self.layout.get_info(self.laayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): np_instance = draw_diode_nd2ps( @@ -183,9 +183,9 @@ def parameters_from_shape_impl(self): self.la = self.layout.get_info(self.laayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): np_instance = draw_diode_pd2nw( @@ -265,9 +265,9 @@ def parameters_from_shape_impl(self): self.la = self.layout.get_info(self.laayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): nwp_instance = draw_diode_nw2ps( @@ -346,9 +346,9 @@ def parameters_from_shape_impl(self): self.la = self.layout.get_info(self.laayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): diode_pw2dw_instance = draw_diode_pw2dw( @@ -428,9 +428,9 @@ def parameters_from_shape_impl(self): self.la = self.layout.get_info(self.laayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): diode_dw2ps_instance = draw_diode_dw2ps( @@ -509,9 +509,9 @@ def parameters_from_shape_impl(self): self.la = self.layout.get_info(self.laayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): sc_instance = draw_sc_diode( diff --git a/gf180/cells/klayout/pymacros/cells/draw_cap_mim.py b/gf180/cells/klayout/pymacros/cells/draw_cap_mim.py index 62530fe..1d326ad 100644 --- a/gf180/cells/klayout/pymacros/cells/draw_cap_mim.py +++ b/gf180/cells/klayout/pymacros/cells/draw_cap_mim.py @@ -77,14 +77,14 @@ def draw_cap_mim( size=(m_up.size[0], m_up.size[1]), layer=layer["fusetop"] ) ) - fusetop.xmin = m_up.xmin - fusetop.ymin = m_up.ymin + fusetop.dxmin = m_up.dxmin + fusetop.dymin = m_up.dymin mim_l_mk = c.add_ref( gf.components.rectangle(size=(fusetop.size[0], l_mk_w), layer=layer["mim_l_mk"]) ) - mim_l_mk.xmin = fusetop.xmin - mim_l_mk.ymin = fusetop.ymin + mim_l_mk.dxmin = fusetop.dxmin + mim_l_mk.dymin = fusetop.dymin m_dn = c.add_ref( gf.components.rectangle( @@ -92,30 +92,30 @@ def draw_cap_mim( layer=bottom_layer, ) ) - m_dn.xmin = m_up.xmin - bot_enc_top - m_dn.ymin = m_up.ymin - bot_enc_top + m_dn.dxmin = m_up.dxmin - bot_enc_top + m_dn.dymin = m_up.dymin - bot_enc_top cap_mk = c.add_ref( gf.components.rectangle( size=(m_dn.size[0], m_dn.size[1]), layer=layer["cap_mk"] ) ) - cap_mk.xmin = m_dn.xmin - cap_mk.ymin = m_dn.ymin + cap_mk.dxmin = m_dn.dxmin + cap_mk.dymin = m_dn.dymin # generating labels if label == 1: c.add_label( top_label, - position=(m_up.xmin + (m_up.size[0] / 2), m_dn.xmin + (m_dn.size[1] / 2)), + position=(m_up.dxmin + (m_up.size[0] / 2), m_dn.dxmin + (m_dn.size[1] / 2)), layer=up_label_layer, ) c.add_label( bot_label, position=( - m_dn.xmin + (m_dn.size[0] / 2), - m_dn.ymin + (m_up.ymin - m_dn.ymin) / 2, + m_dn.dxmin + (m_dn.size[0] / 2), + m_dn.dymin + (m_up.dymin - m_dn.dymin) / 2, ), layer=bot_label_layer, ) @@ -123,8 +123,8 @@ def draw_cap_mim( # generating vias via = via_generator( - x_range=(m_up.xmin, m_up.xmax), - y_range=(m_up.ymin, m_up.ymax), + x_range=(m_up.dxmin, m_up.dxmax), + y_range=(m_up.dymin, m_up.dymax), via_enclosure=via_enc, via_layer=via_layer, via_size=via_size, diff --git a/gf180/cells/klayout/pymacros/cells/draw_cap_mos.py b/gf180/cells/klayout/pymacros/cells/draw_cap_mos.py index 6c61141..3537723 100644 --- a/gf180/cells/klayout/pymacros/cells/draw_cap_mos.py +++ b/gf180/cells/klayout/pymacros/cells/draw_cap_mos.py @@ -61,13 +61,13 @@ def cap_mos_inst( size=(cmp.size[0], cmp.size[1]), layer=layer["mos_cap_mk"] ) ) - cap_mk.xmin = cmp.xmin - cap_mk.ymin = cmp.ymin + cap_mk.dxmin = cmp.dxmin + cap_mk.dymin = cmp.dymin c_inst.add_array( component=via_stack( - x_range=(cmp.xmin, cmp.xmin + con_w), - y_range=(cmp.ymin, cmp.ymax), + x_range=(cmp.dxmin, cmp.dxmin + con_w), + y_range=(cmp.dymin, cmp.dymax), base_layer=layer["comp"], metal_level=1, ), @@ -85,19 +85,19 @@ def cap_mos_inst( layer=implant_layer, ) ) - imp_rect.xmin = cmp.xmin - implant_enc[0] - imp_rect.ymin = cmp.ymin - implant_enc[1] + imp_rect.dxmin = cmp.dxmin - implant_enc[0] + imp_rect.dymin = cmp.dymin - implant_enc[1] poly = c_inst.add_ref( gf.components.rectangle(size=(lc, pl_l), layer=layer["poly2"]) ) - poly.xmin = cmp.xmin + cmp_ext - poly.ymin = cmp.ymin - pl_ext + poly.dxmin = cmp.dxmin + cmp_ext + poly.dymin = cmp.dymin - pl_ext pl_con_el = via_stack( - x_range=(poly.xmin, poly.xmax), - y_range=(poly.ymin, poly.ymin + con_w), + x_range=(poly.dxmin, poly.dxmax), + y_range=(poly.dymin, poly.dymin + con_w), base_layer=layer["poly2"], metal_level=1, ) @@ -115,8 +115,8 @@ def cap_mos_inst( c_inst.add_label( g_label, position=( - pl_con.xmin + (pl_con.size[0] / 2), - pl_con.ymin + (pl_con_el.size[1] / 2), + pl_con.dxmin + (pl_con.size[0] / 2), + pl_con.dymin + (pl_con_el.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -126,8 +126,8 @@ def cap_mos_inst( size=(pl_con.size[0], pl_con.size[1]), layer=layer["metal1"] ) ) - pl_m1.xmin = pl_con.xmin - pl_m1.ymin = pl_con.ymin + pl_m1.dxmin = pl_con.dxmin + pl_m1.dymin = pl_con.dymin return c_inst @@ -221,22 +221,22 @@ def draw_cap_mos( columns=2, spacing=(m1_w + cmp_w - 2 * cmp_ed_w, 0), ) - cmp_m1_v.xmin = cmp_m1_xmin - (m1_w - (cmp_m1_xmax - cmp_m1_xmin)) - cmp_m1_v.ymax = cmp_m1_ymax + cmp_m1_v.dxmin = cmp_m1_xmin - (m1_w - (cmp_m1_xmax - cmp_m1_xmin)) + cmp_m1_v.dymax = cmp_m1_ymax cmp_m1_h = c.add_ref( gf.components.rectangle(size=(cmp_m1_v.size[0], m1_w), layer=layer["metal1"]) ) - cmp_m1_h.xmin = cmp_m1_v.xmin - cmp_m1_h.ymax = cmp_m1_v.ymin + cmp_m1_h.dxmin = cmp_m1_v.dxmin + cmp_m1_h.dymax = cmp_m1_v.dymin # sd labels generation if label == 1: c.add_label( sd_label, position=( - cmp_m1_h.xmin + (cmp_m1_h.size[0] / 2), - cmp_m1_h.ymin + (cmp_m1_h.size[1] / 2), + cmp_m1_h.dxmin + (cmp_m1_h.size[0] / 2), + cmp_m1_h.dymin + (cmp_m1_h.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -253,8 +253,8 @@ def draw_cap_mos( layer=layer["dualgate"], ) ) - dg.xmin = c_inst.xmin - dg_enc_cmp - dg.ymin = c_inst.ymin - dg_enc_poly + dg.dxmin = c_inst.dxmin - dg_enc_cmp + dg.dymin = c_inst.dymin - dg_enc_poly cmp_polys = c_inst.get_polygons(by_spec=layer["comp"]) cmp_xmin = np.min(cmp_polys[0][:, 0]) @@ -273,8 +273,8 @@ def draw_cap_mos( layer=layer["nwell"], ) ) - nwell.xmin = cmp_xmin - np_enc_cmp - nwell.ymin = cmp_ymin - np_enc_gate + nwell.dxmin = cmp_xmin - np_enc_cmp + nwell.dymin = cmp_ymin - np_enc_gate else: lvpwell = c.add_ref( gf.components.rectangle( @@ -286,8 +286,8 @@ def draw_cap_mos( ) ) - lvpwell.xmin = cmp_xmin - np_enc_cmp - lvpwell.ymin = cmp_ymin - np_enc_gate + lvpwell.dxmin = cmp_xmin - np_enc_cmp + lvpwell.dymin = cmp_ymin - np_enc_gate if deepnwell == 1: if type == "cap_nmos": @@ -301,8 +301,8 @@ def draw_cap_mos( ) ) - lvp_rect.xmin = c_inst.xmin - lvpwell_enc_ncmp - lvp_rect.ymin = c_inst.ymin - lvpwell_enc_ncmp + lvp_rect.dxmin = c_inst.dxmin - lvpwell_enc_ncmp + lvp_rect.dymin = c_inst.dymin - lvpwell_enc_ncmp dn_rect = c.add_ref( gf.components.rectangle( @@ -314,8 +314,8 @@ def draw_cap_mos( ) ) - dn_rect.xmin = lvp_rect.xmin - dn_enc_lvpwell - dn_rect.ymin = lvp_rect.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvp_rect.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvp_rect.dymin - dn_enc_lvpwell else: dn_rect = c.add_ref( @@ -328,33 +328,35 @@ def draw_cap_mos( ) ) - dn_rect.xmin = c_inst.xmin - dnwell_enc_pcmp - dn_rect.ymin = c_inst.ymin - dnwell_enc_pcmp + dn_rect.dxmin = c_inst.dxmin - dnwell_enc_pcmp + dn_rect.dymin = c_inst.dymin - dnwell_enc_pcmp if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * grw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * grw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * grw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * grw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - grw, rect_pcmpgr_in.ymin - grw)) + rect_pcmpgr_out.dmove( + (rect_pcmpgr_in.dxmin - grw, rect_pcmpgr_in.dymin - grw) + ) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -367,31 +369,33 @@ def draw_cap_mos( psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * comp_pp_enc, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * comp_pp_enc, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * comp_pp_enc, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + comp_pp_enc, - rect_pcmpgr_in.ymin + comp_pp_enc, + rect_pcmpgr_in.dxmin + comp_pp_enc, + rect_pcmpgr_in.dymin + comp_pp_enc, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * comp_pp_enc, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * comp_pp_enc, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + + 2 * comp_pp_enc, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - comp_pp_enc, - rect_pcmpgr_out.ymin - comp_pp_enc, + rect_pcmpgr_out.dxmin - comp_pp_enc, + rect_pcmpgr_out.dymin - comp_pp_enc, ) ) c.add_ref( @@ -405,10 +409,10 @@ def draw_cap_mos( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -419,10 +423,10 @@ def draw_cap_mos( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -432,10 +436,10 @@ def draw_cap_mos( c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -446,10 +450,10 @@ def draw_cap_mos( c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -474,7 +478,7 @@ def draw_cap_mos( layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - grw, rect_pcmpgr_in.ymin - grw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - grw, rect_pcmpgr_in.dymin - grw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, diff --git a/gf180/cells/klayout/pymacros/cells/draw_diode.py b/gf180/cells/klayout/pymacros/cells/draw_diode.py index 8e9ffe6..02dc520 100644 --- a/gf180/cells/klayout/pymacros/cells/draw_diode.py +++ b/gf180/cells/klayout/pymacros/cells/draw_diode.py @@ -66,20 +66,20 @@ def draw_diode_nd2ps( layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp diode_mk = c.add_ref( gf.components.rectangle( size=(ncmp.size[0], ncmp.size[1]), layer=layer["diode_mk"] ) ) - diode_mk.xmin = ncmp.xmin - diode_mk.ymin = ncmp.ymin + diode_mk.dxmin = ncmp.dxmin + diode_mk.dymin = ncmp.dymin ncmp_con = c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -87,7 +87,7 @@ def draw_diode_nd2ps( # p generation pcmp = c.add_ref(gf.components.rectangle(size=(cw, la), layer=layer["comp"])) - pcmp.xmax = ncmp.xmin - comp_spacing + pcmp.dxmax = ncmp.dxmin - comp_spacing pplus = c.add_ref( gf.components.rectangle( size=( @@ -97,13 +97,13 @@ def draw_diode_nd2ps( layer=layer["pplus"], ) ) - pplus.xmin = pcmp.xmin - pp_enc_comp - pplus.ymin = pcmp.ymin - pp_enc_comp + pplus.dxmin = pcmp.dxmin - pp_enc_comp + pplus.dymin = pcmp.dymin - pp_enc_comp pcmp_con = c.add_ref( via_stack( - x_range=(pcmp.xmin, pcmp.xmax), - y_range=(pcmp.ymin, pcmp.ymax), + x_range=(pcmp.dxmin, pcmp.dxmax), + y_range=(pcmp.dymin, pcmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -115,8 +115,8 @@ def draw_diode_nd2ps( c.add_label( n_label, position=( - ncmp_con.xmin + (ncmp_con.size[0] / 2), - ncmp_con.ymin + (ncmp_con.size[1] / 2), + ncmp_con.dxmin + (ncmp_con.size[0] / 2), + ncmp_con.dymin + (ncmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -125,8 +125,8 @@ def draw_diode_nd2ps( c.add_label( p_label, position=( - pcmp_con.xmin + (pcmp_con.size[0] / 2), - pcmp_con.ymin + (pcmp_con.size[1] / 2), + pcmp_con.dxmin + (pcmp_con.size[0] / 2), + pcmp_con.dymin + (pcmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -136,14 +136,14 @@ def draw_diode_nd2ps( dg = c.add_ref( gf.components.rectangle( size=( - ncmp.xmax - pcmp.xmin + (2 * dg_enc_cmp), + ncmp.dxmax - pcmp.dxmin + (2 * dg_enc_cmp), ncmp.size[1] + (2 * dg_enc_cmp), ), layer=layer["dualgate"], ) ) - dg.xmin = pcmp.xmin - dg_enc_cmp - dg.ymin = pcmp.ymin - dg_enc_cmp + dg.dxmin = pcmp.dxmin - dg_enc_cmp + dg.dymin = pcmp.dymin - dg_enc_cmp if deepnwell == 1: lvpwell_enc_ncmp = 0.6 @@ -151,15 +151,15 @@ def draw_diode_nd2ps( lvpwell = c.add_ref( gf.components.rectangle( size=( - ncmp.xmax - pcmp.xmin + (lvpwell_enc_ncmp + lvpwell_enc_pcmp), + ncmp.dxmax - pcmp.dxmin + (lvpwell_enc_ncmp + lvpwell_enc_pcmp), ncmp.size[1] + (2 * lvpwell_enc_ncmp), ), layer=layer["lvpwell"], ) ) - lvpwell.xmin = pcmp.xmin - lvpwell_enc_pcmp - lvpwell.ymin = ncmp.ymin - lvpwell_enc_ncmp + lvpwell.dxmin = pcmp.dxmin - lvpwell_enc_pcmp + lvpwell.dymin = ncmp.dymin - lvpwell_enc_ncmp dn_enc_lvpwell = 2.5 dn_rect = c.add_ref( @@ -172,8 +172,8 @@ def draw_diode_nd2ps( ) ) - dn_rect.xmin = lvpwell.xmin - dn_enc_lvpwell - dn_rect.ymin = lvpwell.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvpwell.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvpwell.dymin - dn_enc_lvpwell if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") @@ -182,25 +182,27 @@ def draw_diode_nd2ps( rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + rect_pcmpgr_out.dmove( + (rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw) + ) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -213,31 +215,33 @@ def draw_diode_nd2ps( psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * pp_enc_comp, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + pp_enc_comp, - rect_pcmpgr_in.ymin + pp_enc_comp, + rect_pcmpgr_in.dxmin + pp_enc_comp, + rect_pcmpgr_in.dymin + pp_enc_comp, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * pp_enc_comp, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + + 2 * pp_enc_comp, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - pp_enc_comp, - rect_pcmpgr_out.ymin - pp_enc_comp, + rect_pcmpgr_out.dxmin - pp_enc_comp, + rect_pcmpgr_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -255,10 +259,10 @@ def draw_diode_nd2ps( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -269,10 +273,10 @@ def draw_diode_nd2ps( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -282,10 +286,10 @@ def draw_diode_nd2ps( c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -296,10 +300,10 @@ def draw_diode_nd2ps( c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -324,7 +328,7 @@ def draw_diode_nd2ps( layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -394,20 +398,20 @@ def draw_diode_pd2nw( layer=layer["pplus"], ) ) - pplus.xmin = pcmp.xmin - pp_enc_comp - pplus.ymin = pcmp.ymin - pp_enc_comp + pplus.dxmin = pcmp.dxmin - pp_enc_comp + pplus.dymin = pcmp.dymin - pp_enc_comp diode_mk = c.add_ref( gf.components.rectangle( size=(pcmp.size[0], pcmp.size[1]), layer=layer["diode_mk"] ) ) - diode_mk.xmin = pcmp.xmin - diode_mk.ymin = pcmp.ymin + diode_mk.dxmin = pcmp.dxmin + diode_mk.dymin = pcmp.dymin pcmp_con = c.add_ref( via_stack( - x_range=(pcmp.xmin, pcmp.xmax), - y_range=(pcmp.ymin, pcmp.ymax), + x_range=(pcmp.dxmin, pcmp.dxmax), + y_range=(pcmp.dymin, pcmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -415,7 +419,7 @@ def draw_diode_pd2nw( # n generation ncmp = c.add_ref(gf.components.rectangle(size=(cw, la), layer=layer["comp"])) - ncmp.xmax = pcmp.xmin - comp_spacing + ncmp.dxmax = pcmp.dxmin - comp_spacing nplus = c.add_ref( gf.components.rectangle( size=( @@ -425,13 +429,13 @@ def draw_diode_pd2nw( layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp ncmp_con = c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -443,8 +447,8 @@ def draw_diode_pd2nw( c.add_label( n_label, position=( - ncmp_con.xmin + (ncmp_con.size[0] / 2), - ncmp_con.ymin + (ncmp_con.size[1] / 2), + ncmp_con.dxmin + (ncmp_con.size[0] / 2), + ncmp_con.dymin + (ncmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -453,8 +457,8 @@ def draw_diode_pd2nw( c.add_label( p_label, position=( - pcmp_con.xmin + (pcmp_con.size[0] / 2), - pcmp_con.ymin + (pcmp_con.size[1] / 2), + pcmp_con.dxmin + (pcmp_con.size[0] / 2), + pcmp_con.dymin + (pcmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -463,28 +467,28 @@ def draw_diode_pd2nw( dg = c.add_ref( gf.components.rectangle( size=( - pcmp.xmax - ncmp.xmin + (2 * dg_enc_cmp), + pcmp.dxmax - ncmp.dxmin + (2 * dg_enc_cmp), ncmp.size[1] + (2 * dg_enc_cmp), ), layer=layer["dualgate"], ) ) - dg.xmin = ncmp.xmin - dg_enc_cmp - dg.ymin = ncmp.ymin - dg_enc_cmp + dg.dxmin = ncmp.dxmin - dg_enc_cmp + dg.dymin = ncmp.dymin - dg_enc_cmp # nwell generation nwell = c.add_ref( gf.components.rectangle( size=( - pcmp.xmax - ncmp.xmin + (nwell_ncmp_enc + nwell_pcmp_enc), + pcmp.dxmax - ncmp.dxmin + (nwell_ncmp_enc + nwell_pcmp_enc), pcmp.size[1] + (2 * nwell_pcmp_enc), ), layer=layer["nwell"], ) ) - nwell.xmin = ncmp.xmin - nwell_ncmp_enc - nwell.ymin = pcmp.ymin - nwell_pcmp_enc + nwell.dxmin = ncmp.dxmin - nwell_ncmp_enc + nwell.dymin = pcmp.dymin - nwell_pcmp_enc if deepnwell == 1: dn_rect = c.add_ref( @@ -497,33 +501,35 @@ def draw_diode_pd2nw( ) ) - dn_rect.xmin = nwell.xmin - dn_enc_nwell - dn_rect.ymin = nwell.ymin - dn_enc_nwell + dn_rect.dxmin = nwell.dxmin - dn_enc_nwell + dn_rect.dymin = nwell.dymin - dn_enc_nwell if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + rect_pcmpgr_out.dmove( + (rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw) + ) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -536,31 +542,33 @@ def draw_diode_pd2nw( psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * pp_enc_comp, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + pp_enc_comp, - rect_pcmpgr_in.ymin + pp_enc_comp, + rect_pcmpgr_in.dxmin + pp_enc_comp, + rect_pcmpgr_in.dymin + pp_enc_comp, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * pp_enc_comp, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + + 2 * pp_enc_comp, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - pp_enc_comp, - rect_pcmpgr_out.ymin - pp_enc_comp, + rect_pcmpgr_out.dxmin - pp_enc_comp, + rect_pcmpgr_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -574,10 +582,10 @@ def draw_diode_pd2nw( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -588,10 +596,10 @@ def draw_diode_pd2nw( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -601,10 +609,10 @@ def draw_diode_pd2nw( c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -615,10 +623,10 @@ def draw_diode_pd2nw( c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -643,7 +651,7 @@ def draw_diode_pd2nw( layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -704,15 +712,15 @@ def draw_diode_nw2ps( layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp diode_mk = c.add_ref( gf.components.rectangle( size=(ncmp.size[0], ncmp.size[1]), layer=layer["diode_mk"] ) ) - diode_mk.xmin = ncmp.xmin - diode_mk.ymin = ncmp.ymin + diode_mk.dxmin = ncmp.dxmin + diode_mk.dymin = ncmp.dymin nwell = c.add_ref( gf.components.rectangle( @@ -723,13 +731,13 @@ def draw_diode_nw2ps( layer=layer["nwell"], ) ) - nwell.xmin = ncmp.xmin - nwell_ncmp_enc - nwell.ymin = ncmp.ymin - nwell_ncmp_enc + nwell.dxmin = ncmp.dxmin - nwell_ncmp_enc + nwell.dymin = ncmp.dymin - nwell_ncmp_enc n_con = c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -737,7 +745,7 @@ def draw_diode_nw2ps( # p generation pcmp = c.add_ref(gf.components.rectangle(size=(cw, la), layer=layer["comp"])) - pcmp.xmax = ncmp.xmin - comp_spacing + pcmp.dxmax = ncmp.dxmin - comp_spacing pplus = c.add_ref( gf.components.rectangle( size=( @@ -747,13 +755,13 @@ def draw_diode_nw2ps( layer=layer["pplus"], ) ) - pplus.xmin = pcmp.xmin - pp_enc_comp - pplus.ymin = pcmp.ymin - pp_enc_comp + pplus.dxmin = pcmp.dxmin - pp_enc_comp + pplus.dymin = pcmp.dymin - pp_enc_comp p_con = c.add_ref( via_stack( - x_range=(pcmp.xmin, pcmp.xmax), - y_range=(pcmp.ymin, pcmp.ymax), + x_range=(pcmp.dxmin, pcmp.dxmax), + y_range=(pcmp.dymin, pcmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -765,8 +773,8 @@ def draw_diode_nw2ps( c.add_label( n_label, position=( - n_con.xmin + (n_con.size[0] / 2), - n_con.ymin + (n_con.size[1] / 2), + n_con.dxmin + (n_con.size[0] / 2), + n_con.dymin + (n_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -775,8 +783,8 @@ def draw_diode_nw2ps( c.add_label( p_label, position=( - p_con.xmin + (p_con.size[0] / 2), - p_con.ymin + (p_con.size[1] / 2), + p_con.dxmin + (p_con.size[0] / 2), + p_con.dymin + (p_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -785,14 +793,14 @@ def draw_diode_nw2ps( dg = c.add_ref( gf.components.rectangle( size=( - ncmp.xmax - pcmp.xmin + (2 * dg_enc_cmp), + ncmp.dxmax - pcmp.dxmin + (2 * dg_enc_cmp), ncmp.size[1] + (2 * dg_enc_cmp), ), layer=layer["dualgate"], ) ) - dg.xmin = pcmp.xmin - dg_enc_cmp - dg.ymin = pcmp.ymin - dg_enc_cmp + dg.dxmin = pcmp.dxmin - dg_enc_cmp + dg.dymin = pcmp.dymin - dg_enc_cmp # creating layout and cell in klayout @@ -853,15 +861,15 @@ def draw_diode_pw2dw( layer=layer["pplus"], ) ) - pplus.xmin = pcmp.xmin - pp_enc_comp - pplus.ymin = pcmp.ymin - pp_enc_comp + pplus.dxmin = pcmp.dxmin - pp_enc_comp + pplus.dymin = pcmp.dymin - pp_enc_comp diode_mk = c.add_ref( gf.components.rectangle( size=(pcmp.size[0], pcmp.size[1]), layer=layer["diode_mk"] ) ) - diode_mk.xmin = pcmp.xmin - diode_mk.ymin = pcmp.ymin + diode_mk.dxmin = pcmp.dxmin + diode_mk.dymin = pcmp.dymin lvpwell = c.add_ref( gf.components.rectangle( @@ -872,13 +880,13 @@ def draw_diode_pw2dw( layer=layer["lvpwell"], ) ) - lvpwell.xmin = pcmp.xmin - lvpwell_enc_pcmp - lvpwell.ymin = pcmp.ymin - lvpwell_enc_pcmp + lvpwell.dxmin = pcmp.dxmin - lvpwell_enc_pcmp + lvpwell.dymin = pcmp.dymin - lvpwell_enc_pcmp p_con = c.add_ref( via_stack( - x_range=(pcmp.xmin, pcmp.xmax), - y_range=(pcmp.ymin, pcmp.ymax), + x_range=(pcmp.dxmin, pcmp.dxmax), + y_range=(pcmp.dymin, pcmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -886,7 +894,7 @@ def draw_diode_pw2dw( # n generation ncmp = c.add_ref(gf.components.rectangle(size=(cw, la), layer=layer["comp"])) - ncmp.xmax = pcmp.xmin - comp_spacing + ncmp.dxmax = pcmp.dxmin - comp_spacing nplus = c.add_ref( gf.components.rectangle( size=( @@ -896,13 +904,13 @@ def draw_diode_pw2dw( layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp n_con = c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -914,8 +922,8 @@ def draw_diode_pw2dw( c.add_label( n_label, position=( - n_con.xmin + (n_con.size[0] / 2), - n_con.ymin + (n_con.size[1] / 2), + n_con.dxmin + (n_con.size[0] / 2), + n_con.dymin + (n_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -924,8 +932,8 @@ def draw_diode_pw2dw( c.add_label( p_label, position=( - p_con.xmin + (p_con.size[0] / 2), - p_con.ymin + (p_con.size[1] / 2), + p_con.dxmin + (p_con.size[0] / 2), + p_con.dymin + (p_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -940,33 +948,33 @@ def draw_diode_pw2dw( ) ) - dn_rect.xmin = lvpwell.xmin - dn_enc_lvpwell - dn_rect.ymin = lvpwell.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvpwell.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvpwell.dymin - dn_enc_lvpwell if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + rect_pcmpgr_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -979,31 +987,31 @@ def draw_diode_pw2dw( psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * pp_enc_comp, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + pp_enc_comp, - rect_pcmpgr_in.ymin + pp_enc_comp, + rect_pcmpgr_in.dxmin + pp_enc_comp, + rect_pcmpgr_in.dymin + pp_enc_comp, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * pp_enc_comp, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - pp_enc_comp, - rect_pcmpgr_out.ymin - pp_enc_comp, + rect_pcmpgr_out.dxmin - pp_enc_comp, + rect_pcmpgr_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -1017,10 +1025,10 @@ def draw_diode_pw2dw( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1031,10 +1039,10 @@ def draw_diode_pw2dw( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1044,10 +1052,10 @@ def draw_diode_pw2dw( c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1058,10 +1066,10 @@ def draw_diode_pw2dw( c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1086,7 +1094,7 @@ def draw_diode_pw2dw( layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -1106,8 +1114,8 @@ def draw_diode_pw2dw( layer=layer["dualgate"], ) ) - dg.xmin = dn_rect.xmin - dg_enc_dn - dg.ymin = dn_rect.ymin - dg_enc_dn + dg.dxmin = dn_rect.dxmin - dg_enc_dn + dg.dymin = dn_rect.dymin - dg_enc_dn # creating layout and cell in klayout @@ -1163,8 +1171,8 @@ def draw_diode_dw2ps( n_con = c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1179,8 +1187,8 @@ def draw_diode_dw2ps( layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp else: c_temp = gf.Component("temp_store guard ring") ncmp_in = c_temp.add_ref( @@ -1195,7 +1203,7 @@ def draw_diode_dw2ps( layer=layer["comp"], ) ) - ncmp_out.move((ncmp_in.xmin - cw, ncmp_in.ymin - cw)) + ncmp_out.dmove((ncmp_in.dxmin - cw, ncmp_in.dymin - cw)) ncmp = c.add_ref( gf.geometry.boolean( A=ncmp_out, @@ -1208,31 +1216,31 @@ def draw_diode_dw2ps( pplus_in = c_temp.add_ref( gf.components.rectangle( size=( - (ncmp_in.xmax - ncmp_in.xmin) - 2 * pp_enc_comp, - (ncmp_in.ymax - ncmp_in.ymin) - 2 * pp_enc_comp, + (ncmp_in.dxmax - ncmp_in.dxmin) - 2 * pp_enc_comp, + (ncmp_in.dymax - ncmp_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - pplus_in.move( + pplus_in.dmove( ( - ncmp_in.xmin + pp_enc_comp, - ncmp_in.ymin + pp_enc_comp, + ncmp_in.dxmin + pp_enc_comp, + ncmp_in.dymin + pp_enc_comp, ) ) pplus_out = c_temp.add_ref( gf.components.rectangle( size=( - (ncmp_out.xmax - ncmp_out.xmin) + 2 * pp_enc_comp, - (ncmp_out.ymax - ncmp_out.ymin) + 2 * pp_enc_comp, + (ncmp_out.dxmax - ncmp_out.dxmin) + 2 * pp_enc_comp, + (ncmp_out.dymax - ncmp_out.dymin) + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - pplus_out.move( + pplus_out.dmove( ( - ncmp_out.xmin - pp_enc_comp, - ncmp_out.ymin - pp_enc_comp, + ncmp_out.dxmin - pp_enc_comp, + ncmp_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -1246,10 +1254,10 @@ def draw_diode_dw2ps( c.add_ref( via_generator( x_range=( - ncmp_in.xmin + con_size, - ncmp_in.xmax - con_size, + ncmp_in.dxmin + con_size, + ncmp_in.dxmax - con_size, ), - y_range=(ncmp_out.ymin, ncmp_in.ymin), + y_range=(ncmp_out.dymin, ncmp_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1260,10 +1268,10 @@ def draw_diode_dw2ps( c.add_ref( via_generator( x_range=( - ncmp_in.xmin + con_size, - ncmp_in.xmax - con_size, + ncmp_in.dxmin + con_size, + ncmp_in.dxmax - con_size, ), - y_range=(ncmp_in.ymax, ncmp_out.ymax), + y_range=(ncmp_in.dymax, ncmp_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1273,10 +1281,10 @@ def draw_diode_dw2ps( n_con = c.add_ref( via_generator( - x_range=(ncmp_out.xmin, ncmp_in.xmin), + x_range=(ncmp_out.dxmin, ncmp_in.dxmin), y_range=( - ncmp_in.ymin + con_size, - ncmp_in.ymax - con_size, + ncmp_in.dymin + con_size, + ncmp_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1287,10 +1295,10 @@ def draw_diode_dw2ps( c.add_ref( via_generator( - x_range=(ncmp_in.xmax, ncmp_out.xmax), + x_range=(ncmp_in.dxmax, ncmp_out.dxmax), y_range=( - ncmp_in.ymin + con_size, - ncmp_in.ymax - con_size, + ncmp_in.dymin + con_size, + ncmp_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1315,7 +1323,7 @@ def draw_diode_dw2ps( layer=layer["metal1"], ) ) - comp_m1_out.move((ncmp_in.xmin - cw, ncmp_in.ymin - cw)) + comp_m1_out.dmove((ncmp_in.dxmin - cw, ncmp_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=ncmp_out, @@ -1331,8 +1339,8 @@ def draw_diode_dw2ps( c.add_label( n_label, position=( - n_con.xmin + (n_con.size[0] / 2), - n_con.ymin + (n_con.size[1] / 2), + n_con.dxmin + (n_con.size[0] / 2), + n_con.dymin + (n_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -1348,41 +1356,41 @@ def draw_diode_dw2ps( layer=layer["dnwell"], ) ) - dn_rect.xmin = ncmp.xmin - dn_enc_ncmp - dn_rect.ymin = ncmp.ymin - dn_enc_ncmp + dn_rect.dxmin = ncmp.dxmin - dn_enc_ncmp + dn_rect.dymin = ncmp.dymin - dn_enc_ncmp diode_mk = c.add_ref( gf.components.rectangle( size=(dn_rect.size[0], dn_rect.size[1]), layer=layer["diode_mk"] ) ) - diode_mk.xmin = dn_rect.xmin - diode_mk.ymin = dn_rect.ymin + diode_mk.dxmin = dn_rect.dxmin + diode_mk.dymin = dn_rect.dymin if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + rect_pcmpgr_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -1395,31 +1403,31 @@ def draw_diode_dw2ps( psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * pp_enc_comp, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + pp_enc_comp, - rect_pcmpgr_in.ymin + pp_enc_comp, + rect_pcmpgr_in.dxmin + pp_enc_comp, + rect_pcmpgr_in.dymin + pp_enc_comp, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * pp_enc_comp, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - pp_enc_comp, - rect_pcmpgr_out.ymin - pp_enc_comp, + rect_pcmpgr_out.dxmin - pp_enc_comp, + rect_pcmpgr_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -1433,10 +1441,10 @@ def draw_diode_dw2ps( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1447,10 +1455,10 @@ def draw_diode_dw2ps( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1460,10 +1468,10 @@ def draw_diode_dw2ps( p_con = c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1474,10 +1482,10 @@ def draw_diode_dw2ps( c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1492,8 +1500,8 @@ def draw_diode_dw2ps( c.add_label( p_label, position=( - p_con.xmin + (p_con.size[0] / 2), - p_con.ymin + (p_con.size[1] / 2), + p_con.dxmin + (p_con.size[0] / 2), + p_con.dymin + (p_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -1508,13 +1516,13 @@ def draw_diode_dw2ps( comp_m1_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -1536,8 +1544,8 @@ def draw_diode_dw2ps( layer=layer["dualgate"], ) ) - dg.xmin = dn_rect.xmin - dg_enc_dn - dg.ymin = dn_rect.ymin - dg_enc_dn + dg.dxmin = dn_rect.dxmin - dg_enc_dn + dg.dymin = dn_rect.dymin - dg_enc_dn # creating layout and cell in klayout @@ -1607,13 +1615,13 @@ def sc_cathode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1635,8 +1643,8 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: c.add_ref( via_stack( - x_range=(cmp.xmin, cmp.xmax), - y_range=(cmp.ymin, cmp.ymax), + x_range=(cmp.dxmin, cmp.dxmax), + y_range=(cmp.dymin, cmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1663,7 +1671,7 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: component=gf.components.rectangle( size=( cath_m1_xmax - cath_m1_xmin, - cath_m1_ymin - sc_cathode.ymin + m1_w, + cath_m1_ymin - sc_cathode.dymin + m1_w, ), layer=layer["metal1"], ), @@ -1672,22 +1680,22 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: spacing=((cw + wa + (2 * sc_comp_spacing)), 0), ) - cath_m1_v.xmin = cath_m1_xmin - cath_m1_v.ymax = cath_m1_ymin + cath_m1_v.dxmin = cath_m1_xmin + cath_m1_v.dymax = cath_m1_ymin cath_m1_h = c.add_ref( gf.components.rectangle(size=(cath_m1_v.size[0], m1_w), layer=layer["metal1"]) ) - cath_m1_h.xmin = cath_m1_v.xmin - cath_m1_h.ymax = cath_m1_v.ymin + cath_m1_h.dxmin = cath_m1_v.dxmin + cath_m1_h.dymax = cath_m1_v.dymin # cathode label generation if label == 1: c.add_label( n_label, position=( - cath_m1_h.xmin + (cath_m1_h.size[0] / 2), - cath_m1_h.ymin + (cath_m1_h.size[1] / 2), + cath_m1_h.dxmin + (cath_m1_h.size[0] / 2), + cath_m1_h.dymin + (cath_m1_h.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -1699,7 +1707,7 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: spacing=(wa + cw + (2 * sc_comp_spacing), 0), ) - sc_anode.xmin = sc_cathode.xmin + (cw + sc_comp_spacing) + sc_anode.dxmin = sc_cathode.dxmin + (cw + sc_comp_spacing) an_m1_polys = sc_anode.get_polygons(by_spec=layer["metal1"]) an_m1_xmin = np.min(an_m1_polys[0][:, 0]) @@ -1712,7 +1720,7 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: component=gf.components.rectangle( size=( an_m1_xmax - an_m1_xmin, - cath_m1_ymin - sc_an.ymin + m1_w, + cath_m1_ymin - sc_an.dymin + m1_w, ), layer=layer["metal1"], ), @@ -1721,22 +1729,22 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: spacing=((cw + wa + (2 * sc_comp_spacing)), 0), ) - an_m1_v.xmin = an_m1_xmin - an_m1_v.ymin = an_m1_ymax + an_m1_v.dxmin = an_m1_xmin + an_m1_v.dymin = an_m1_ymax an_m1_h = c.add_ref( gf.components.rectangle(size=(an_m1_v.size[0], m1_w), layer=layer["metal1"]) ) - an_m1_h.xmin = an_m1_v.xmin - an_m1_h.ymin = an_m1_v.ymax + an_m1_h.dxmin = an_m1_v.dxmin + an_m1_h.dymin = an_m1_v.dymax # anode label generation if label == 1: c.add_label( p_label, position=( - an_m1_h.xmin + (an_m1_h.size[0] / 2), - an_m1_h.ymin + (an_m1_h.size[1] / 2), + an_m1_h.dxmin + (an_m1_h.size[0] / 2), + an_m1_h.dymin + (an_m1_h.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -1763,8 +1771,8 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: layer=layer["schottky_diode"], ) ) - diode_mk.xmin = sc_cathode.xmin - sc_enc_comp - diode_mk.ymin = sc_cathode.ymin - sc_enc_comp + diode_mk.dxmin = sc_cathode.dxmin - sc_enc_comp + diode_mk.dymin = sc_cathode.dymin - sc_enc_comp # dnwell dn_rect = c.add_ref( @@ -1776,33 +1784,33 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: layer=layer["dnwell"], ) ) - dn_rect.xmin = sc_anode.xmin - dn_enc_sc_an - dn_rect.ymin = sc_anode.ymin - dn_enc_sc_an + dn_rect.dxmin = sc_anode.dxmin - dn_enc_sc_an + dn_rect.dymin = sc_anode.dymin - dn_enc_sc_an if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + rect_pcmpgr_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -1815,31 +1823,31 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * pp_enc_comp, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + pp_enc_comp, - rect_pcmpgr_in.ymin + pp_enc_comp, + rect_pcmpgr_in.dxmin + pp_enc_comp, + rect_pcmpgr_in.dymin + pp_enc_comp, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * pp_enc_comp, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - pp_enc_comp, - rect_pcmpgr_out.ymin - pp_enc_comp, + rect_pcmpgr_out.dxmin - pp_enc_comp, + rect_pcmpgr_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -1853,10 +1861,10 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1867,10 +1875,10 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1880,10 +1888,10 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1894,10 +1902,10 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1922,7 +1930,7 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, diff --git a/gf180/cells/klayout/pymacros/cells/draw_fet.py b/gf180/cells/klayout/pymacros/cells/draw_fet.py index 9e8328f..8c8c46d 100644 --- a/gf180/cells/klayout/pymacros/cells/draw_fet.py +++ b/gf180/cells/klayout/pymacros/cells/draw_fet.py @@ -130,13 +130,13 @@ def alter_interdig( pat_o.append(pat[i]) nt = [] - [nt.append(x) for x in pat if x not in nt] + [nt.append(dx) for dx in pat if dx not in nt] nt_o = [] - [nt_o.append(x) for x in pat_o if x not in nt_o] + [nt_o.append(dx) for dx in pat_o if dx not in nt_o] nt_e = [] - [nt_e.append(x) for x in pat_e if x not in nt_e] + [nt_e.append(dx) for dx in pat_e if dx not in nt_e] nl = len(nt) nl_b = len(nt_e) @@ -146,7 +146,7 @@ def alter_interdig( m2_y = via_size[1] + 2 * via_enc[1] m2 = gf.components.rectangle( - size=(sd_diff.xmax - sd_diff.xmin, m2_y), + size=(sd_diff.dxmax - sd_diff.dxmin, m2_y), layer=layer["metal2"], ) @@ -156,7 +156,7 @@ def alter_interdig( rows=nl_b, spacing=(0, -m2_y - m2_spacing), ) - m2_arrb.movey(pc1.ymin - m2_spacing - m2_y) + m2_arrb.dmovey(pc1.dymin - m2_spacing - m2_y) m2_arru = c_inst.add_array( component=m2, @@ -164,7 +164,7 @@ def alter_interdig( rows=nl_u, spacing=(0, m2_y + m2_spacing), ) - m2_arru.movey(pc2.ymax + m2_spacing) + m2_arru.dmovey(pc2.dymax + m2_spacing) for i in range(nl_u): for j in range(floor(nf / 2)): @@ -173,19 +173,19 @@ def alter_interdig( gf.components.rectangle( size=( pc_x, - ((pc2.ymax + (i + 1) * (m2_spacing + m2_y)) - pc2.ymin), + ((pc2.dymax + (i + 1) * (m2_spacing + m2_y)) - pc2.dymin), ), layer=layer["metal1"], ) ) - m1.xmin = pc2.xmin + j * (pc_spacing) - m1.ymin = pc2.ymin + m1.dxmin = pc2.dxmin + j * (pc_spacing) + m1.dymin = pc2.dymin via1_dr = via_generator( - x_range=(m1.xmin, m1.xmax), + x_range=(m1.dxmin, m1.dxmax), y_range=( - m2_arru.ymin + i * (m2_y + m2_spacing), - m2_arru.ymin + i * (m2_y + m2_spacing) + m2_y, + m2_arru.dymin + i * (m2_y + m2_spacing), + m2_arru.dymin + i * (m2_y + m2_spacing) + m2_y, ), via_enclosure=via_enc, via_layer=layer["via1"], @@ -198,8 +198,8 @@ def alter_interdig( labels_gen( label_str="None", position=( - (via1.xmax + via1.xmin) / 2, - (via1.ymax + via1.ymin) / 2, + (via1.dxmax + via1.dxmin) / 2, + (via1.dymax + via1.dymin) / 2, ), layer=layer["metal2_label"], label=patt_label, @@ -214,8 +214,8 @@ def alter_interdig( labels_gen( label_str="None", position=( - m1.xmin + (m1.size[0] / 2), - pc2.ymin + (pc2.size[1] / 2), + m1.dxmin + (m1.size[0] / 2), + pc2.dymin + (pc2.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -232,18 +232,18 @@ def alter_interdig( gf.components.rectangle( size=( pc_x, - ((pc1.ymax + (i + 1) * (m2_spacing + m2_y)) - pc1.ymin), + ((pc1.dymax + (i + 1) * (m2_spacing + m2_y)) - pc1.dymin), ), layer=layer["metal1"], ) ) - m1.xmin = pc1.xmin + j * (pc_spacing) - m1.ymin = -(m1.ymax - m1.ymin) + (pc1.ymax) + m1.dxmin = pc1.dxmin + j * (pc_spacing) + m1.dymin = -(m1.dymax - m1.dymin) + (pc1.dymax) via1_dr = via_generator( - x_range=(m1.xmin, m1.xmax), + x_range=(m1.dxmin, m1.dxmax), y_range=( - m2_arrb.ymax - i * (m2_spacing + m2_y) - m2_y, - m2_arrb.ymax - i * (m2_spacing + m2_y), + m2_arrb.dymax - i * (m2_spacing + m2_y) - m2_y, + m2_arrb.dymax - i * (m2_spacing + m2_y), ), via_enclosure=via_enc, via_layer=layer["via1"], @@ -256,8 +256,8 @@ def alter_interdig( labels_gen( label_str="None", position=( - (via1.xmax + via1.xmin) / 2, - (via1.ymax + via1.ymin) / 2, + (via1.dxmax + via1.dxmin) / 2, + (via1.dymax + via1.dymin) / 2, ), layer=layer["metal2_label"], label=patt_label, @@ -272,8 +272,8 @@ def alter_interdig( labels_gen( label_str="None", position=( - m1.xmin + (m1.size[0] / 2), - pc1.ymin + (pc1.size[1] / 2), + m1.dxmin + (m1.size[0] / 2), + pc1.dymin + (pc1.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -296,11 +296,11 @@ def alter_interdig( m2_y, ), layer=layer["metal2"], - ).move( + ).dmove( ( - m2_arrb.xmin + m2_arrb.dxmin - (m2_y + sd_l + (i + 1) * (m3_spacing + m3_x)), - m2_arrb.ymax - i * (m2_spacing + m2_y) - m2_y, + m2_arrb.dymax - i * (m2_spacing + m2_y) - m2_y, ) ) ) @@ -311,11 +311,11 @@ def alter_interdig( m2_y, ), layer=layer["metal2"], - ).move( + ).dmove( ( - m2_arru.xmin + m2_arru.dxmin - (m2_y + sd_l + (i + 1) * (m3_spacing + m3_x)), - m2_arru.ymin + j * (m2_spacing + m2_y), + m2_arru.dymin + j * (m2_spacing + m2_y), ) ) ) @@ -323,15 +323,15 @@ def alter_interdig( gf.components.rectangle( size=( m3_x, - m2_join_u.ymax - m2_join_b.ymin, + m2_join_u.dymax - m2_join_b.dymin, ), layer=layer["metal1"], ) ) - m3.move((m2_join_b.xmin, m2_join_b.ymin)) + m3.dmove((m2_join_b.dxmin, m2_join_b.dymin)) via2_dr = via_generator( - x_range=(m3.xmin, m3.xmax), - y_range=(m2_join_b.ymin, m2_join_b.ymax), + x_range=(m3.dxmin, m3.dxmax), + y_range=(m2_join_b.dymin, m2_join_b.dymax), via_enclosure=via_enc, via_size=via_size, via_layer=layer["via1"], @@ -343,7 +343,7 @@ def alter_interdig( rows=2, spacing=( 0, - m2_join_u.ymin - m2_join_b.ymin, + m2_join_u.dymin - m2_join_b.dymin, ), ) # via2_draw return c_inst @@ -386,7 +386,7 @@ def interdigit( if nf == len(patt): pat = list(patt) nt = [] # list to store the symbols of transistors and their number nt(number of transistors) - [nt.append(x) for x in pat if x not in nt] + [nt.append(dx) for dx in pat if dx not in nt] nl = len(nt) m2_spacing = 0.28 @@ -396,7 +396,7 @@ def interdigit( m2_y = via_size[1] + 2 * via_enc[1] m2 = gf.components.rectangle( - size=(sd_diff.xmax - sd_diff.xmin, m2_y), layer=layer["metal2"] + size=(sd_diff.dxmax - sd_diff.dxmin, m2_y), layer=layer["metal2"] ) if gate_con_pos == "alternating": @@ -426,9 +426,9 @@ def interdigit( component=m2, columns=1, rows=nl, - spacing=(0, m2.ymax - m2.ymin + m2_spacing), + spacing=(0, m2.dymax - m2.dymin + m2_spacing), ) - m2_arr.movey(pc2.ymax + m2_spacing) + m2_arr.dmovey(pc2.dymax + m2_spacing) for i in range(nl): for j in range(int(nf)): @@ -438,22 +438,22 @@ def interdigit( size=( pc_x, ( - (pc2.ymax + (i + 1) * (m2_spacing + m2_y)) - - ((1 - j % 2) * pc1.ymin) - - (j % 2) * pc2.ymin + (pc2.dymax + (i + 1) * (m2_spacing + m2_y)) + - ((1 - j % 2) * pc1.dymin) + - (j % 2) * pc2.dymin ), ), layer=layer["metal1"], ) ) - m1.xmin = pc1.xmin + j * (pc2.xmin - pc1.xmin) - m1.ymin = pc1.ymin + m1.dxmin = pc1.dxmin + j * (pc2.dxmin - pc1.dxmin) + m1.dymin = pc1.dymin via1_dr = via_generator( - x_range=(m1.xmin, m1.xmax), + x_range=(m1.dxmin, m1.dxmax), y_range=( - m2_arr.ymin + i * (m2_spacing + m2_y), - m2_arr.ymin + i * (m2_spacing + m2_y) + m2_y, + m2_arr.dymin + i * (m2_spacing + m2_y), + m2_arr.dymin + i * (m2_spacing + m2_y) + m2_y, ), via_enclosure=via_enc, via_layer=layer["via1"], @@ -466,8 +466,8 @@ def interdigit( labels_gen( label_str="None", position=( - (via1.xmax + via1.xmin) / 2, - (via1.ymax + via1.ymin) / 2, + (via1.dxmax + via1.dxmin) / 2, + (via1.dymax + via1.dymin) / 2, ), layer=layer["metal2_label"], label=patt_label, @@ -482,8 +482,8 @@ def interdigit( labels_gen( label_str="None", position=( - m1.xmin + (m1.size[0] / 2), - pc1.ymin + (pc1.size[1] / 2), + m1.dxmin + (m1.size[0] / 2), + pc1.dymin + (pc1.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -500,7 +500,7 @@ def interdigit( rows=nl, spacing=(0, -m2_y - m2_spacing), ) - m2_arr.movey(pc2.ymin - m2_spacing - m2_y) + m2_arr.dmovey(pc2.dymin - m2_spacing - m2_y) for i in range(nl): for j in range(int(nf)): @@ -510,22 +510,22 @@ def interdigit( size=( pc_x, ( - (pc1.ymax + (i + 1) * (m2_spacing + m2_y)) - - (j % 2) * pc1.ymin - - (1 - j % 2) * pc2.ymin + (pc1.dymax + (i + 1) * (m2_spacing + m2_y)) + - (j % 2) * pc1.dymin + - (1 - j % 2) * pc2.dymin ), ), layer=layer["metal1"], ) ) - m1.xmin = pc1.xmin + j * (pc2.xmin - pc1.xmin) - m1.ymax = pc1.ymax + m1.dxmin = pc1.dxmin + j * (pc2.dxmin - pc1.dxmin) + m1.dymax = pc1.dymax via1_dr = via_generator( - x_range=(m1.xmin, m1.xmax), + x_range=(m1.dxmin, m1.dxmax), y_range=( - m2_arr.ymax - i * (m2_spacing + m2_y) - m2_y, - m2_arr.ymax - i * (m2_spacing + m2_y), + m2_arr.dymax - i * (m2_spacing + m2_y) - m2_y, + m2_arr.dymax - i * (m2_spacing + m2_y), ), via_enclosure=via_enc, via_layer=layer["via1"], @@ -538,8 +538,8 @@ def interdigit( labels_gen( label_str="None", position=( - (via1.xmax + via1.xmin) / 2, - (via1.ymax + via1.ymin) / 2, + (via1.dxmax + via1.dxmin) / 2, + (via1.dymax + via1.dymin) / 2, ), layer=layer["metal2_label"], label=patt_label, @@ -554,8 +554,8 @@ def interdigit( labels_gen( label_str="None", position=( - m1.xmin + (m1.size[0] / 2), - pc1.ymin + (pc1.size[1] / 2), + m1.dxmin + (m1.size[0] / 2), + pc1.dymin + (pc1.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -590,8 +590,8 @@ def hv_gen(c, c_inst, volt, dg_encx: float = 0.1, dg_ency: float = 0.1): layer=layer["dualgate"], ) ) - dg.xmin = c_inst.xmin - dg_encx - dg.ymin = c_inst.ymin - dg_ency + dg.dxmin = c_inst.dxmin - dg_encx + dg.dymin = c_inst.dymin - dg_ency if volt == "5V": v5x = c.add_ref( @@ -599,8 +599,8 @@ def hv_gen(c, c_inst, volt, dg_encx: float = 0.1, dg_ency: float = 0.1): size=(dg.size[0], dg.size[1]), layer=layer["v5_xtor"] ) ) - v5x.xmin = dg.xmin - v5x.ymin = dg.ymin + v5x.dxmin = dg.dxmin + v5x.dymin = dg.dymin # return c @@ -647,23 +647,23 @@ def bulk_gr_gen( rect_bulk_in = c_temp.add_ref( gf.components.rectangle( size=( - (c_inst.xmax - c_inst.xmin) + 2 * m1_sp, - (c_inst.ymax - c_inst.ymin) + 2 * m1_sp, + (c_inst.dxmax - c_inst.dxmin) + 2 * m1_sp, + (c_inst.dymax - c_inst.dymin) + 2 * m1_sp, ), layer=layer["comp"], ) ) - rect_bulk_in.move((c_inst.xmin - m1_sp, c_inst.ymin - m1_sp)) + rect_bulk_in.dmove((c_inst.dxmin - m1_sp, c_inst.dymin - m1_sp)) rect_bulk_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) + 2 * grw, - (rect_bulk_in.ymax - rect_bulk_in.ymin) + 2 * grw, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) + 2 * grw, + (rect_bulk_in.dymax - rect_bulk_in.dymin) + 2 * grw, ), layer=layer["comp"], ) ) - rect_bulk_out.move((rect_bulk_in.xmin - grw, rect_bulk_in.ymin - grw)) + rect_bulk_out.dmove((rect_bulk_in.dxmin - grw, rect_bulk_in.dymin - grw)) B = c.add_ref( gf.geometry.boolean( A=rect_bulk_out, @@ -676,26 +676,26 @@ def bulk_gr_gen( psdm_in = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) - 2 * comp_pp_enc, - (rect_bulk_in.ymax - rect_bulk_in.ymin) - 2 * comp_pp_enc, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) - 2 * comp_pp_enc, + (rect_bulk_in.dymax - rect_bulk_in.dymin) - 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_in.move((rect_bulk_in.xmin + comp_pp_enc, rect_bulk_in.ymin + comp_pp_enc)) + psdm_in.dmove((rect_bulk_in.dxmin + comp_pp_enc, rect_bulk_in.dymin + comp_pp_enc)) psdm_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_out.xmax - rect_bulk_out.xmin) + 2 * comp_pp_enc, - (rect_bulk_out.ymax - rect_bulk_out.ymin) + 2 * comp_pp_enc, + (rect_bulk_out.dxmax - rect_bulk_out.dxmin) + 2 * comp_pp_enc, + (rect_bulk_out.dymax - rect_bulk_out.dymin) + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_bulk_out.xmin - comp_pp_enc, - rect_bulk_out.ymin - comp_pp_enc, + rect_bulk_out.dxmin - comp_pp_enc, + rect_bulk_out.dymin - comp_pp_enc, ) ) c.add_ref( @@ -707,10 +707,10 @@ def bulk_gr_gen( c.add_ref( via_generator( x_range=( - rect_bulk_in.xmin + con_size, - rect_bulk_in.xmax - con_size, + rect_bulk_in.dxmin + con_size, + rect_bulk_in.dxmax - con_size, ), - y_range=(rect_bulk_out.ymin, rect_bulk_in.ymin), + y_range=(rect_bulk_out.dymin, rect_bulk_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -721,10 +721,10 @@ def bulk_gr_gen( c.add_ref( via_generator( x_range=( - rect_bulk_in.xmin + con_size, - rect_bulk_in.xmax - con_size, + rect_bulk_in.dxmin + con_size, + rect_bulk_in.dxmax - con_size, ), - y_range=(rect_bulk_in.ymax, rect_bulk_out.ymax), + y_range=(rect_bulk_in.dymax, rect_bulk_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -734,10 +734,10 @@ def bulk_gr_gen( c.add_ref( via_generator( - x_range=(rect_bulk_out.xmin, rect_bulk_in.xmin), + x_range=(rect_bulk_out.dxmin, rect_bulk_in.dxmin), y_range=( - rect_bulk_in.ymin + con_size, - rect_bulk_in.ymax - con_size, + rect_bulk_in.dymin + con_size, + rect_bulk_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -748,10 +748,10 @@ def bulk_gr_gen( c.add_ref( via_generator( - x_range=(rect_bulk_in.xmax, rect_bulk_out.xmax), + x_range=(rect_bulk_in.dxmax, rect_bulk_out.dxmax), y_range=( - rect_bulk_in.ymin + con_size, - rect_bulk_in.ymax - con_size, + rect_bulk_in.dymin + con_size, + rect_bulk_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -764,22 +764,22 @@ def bulk_gr_gen( gf.components.rectangle( size=( (l_d) + 2 * comp_spacing, - (c_inst.ymax - c_inst.ymin) + 2 * poly2_comp_spacing, + (c_inst.dymax - c_inst.dymin) + 2 * poly2_comp_spacing, ), layer=layer["metal1"], ) ) - comp_m1_in.move((-comp_spacing, c_inst.ymin - poly2_comp_spacing)) + comp_m1_in.dmove((-comp_spacing, c_inst.dymin - poly2_comp_spacing)) comp_m1_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) + 2 * grw, - (rect_bulk_in.ymax - rect_bulk_in.ymin) + 2 * grw, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) + 2 * grw, + (rect_bulk_in.dymax - rect_bulk_in.dymin) + 2 * grw, ), layer=layer["metal1"], ) ) - comp_m1_out.move((rect_bulk_in.xmin - grw, rect_bulk_in.ymin - grw)) + comp_m1_out.dmove((rect_bulk_in.dxmin - grw, rect_bulk_in.dymin - grw)) c.add_ref( gf.geometry.boolean( A=rect_bulk_out, @@ -795,8 +795,8 @@ def bulk_gr_gen( labels_gen( label_str=sub_label, position=( - B.xmin + (grw + 2 * (comp_pp_enc)) / 2, - B.ymin + (B.size[1] / 2), + B.dxmin + (grw + 2 * (comp_pp_enc)) / 2, + B.dymin + (B.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -811,8 +811,8 @@ def bulk_gr_gen( deepnwell=deepnwell, pcmpgr=pcmpgr, inst_size=(B.size[0], B.size[1]), - inst_xmin=B.xmin, - inst_ymin=B.ymin, + inst_xmin=B.dxmin, + inst_ymin=B.dymin, grw=grw, volt=volt, ) @@ -823,8 +823,8 @@ def bulk_gr_gen( deepnwell=deepnwell, pcmpgr=pcmpgr, enc_size=(B.size[0], B.size[1]), - enc_xmin=B.xmin, - enc_ymin=B.ymin, + enc_xmin=B.dxmin, + enc_ymin=B.dymin, nw_enc_pcmp=nw_enc_pcmp, grw=grw, volt=volt, @@ -855,23 +855,23 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move((dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn)) + rect_pcmpgr_in.dmove((dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn)) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * grw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * grw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * grw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * grw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - grw, rect_pcmpgr_in.ymin - grw)) + rect_pcmpgr_out.dmove((rect_pcmpgr_in.dxmin - grw, rect_pcmpgr_in.dymin - grw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -884,31 +884,31 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * comp_pp_enc, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * comp_pp_enc, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * comp_pp_enc, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + comp_pp_enc, - rect_pcmpgr_in.ymin + comp_pp_enc, + rect_pcmpgr_in.dxmin + comp_pp_enc, + rect_pcmpgr_in.dymin + comp_pp_enc, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * comp_pp_enc, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * comp_pp_enc, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + 2 * comp_pp_enc, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - comp_pp_enc, - rect_pcmpgr_out.ymin - comp_pp_enc, + rect_pcmpgr_out.dxmin - comp_pp_enc, + rect_pcmpgr_out.dymin - comp_pp_enc, ) ) c.add_ref( @@ -922,10 +922,10 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -936,10 +936,10 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -949,10 +949,10 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -963,10 +963,10 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -991,7 +991,7 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - grw, rect_pcmpgr_in.ymin - grw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - grw, rect_pcmpgr_in.dymin - grw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -1020,8 +1020,8 @@ def nfet_deep_nwell( deepnwell : boolean of having deepnwell pcmpgr : boolean of having deepnwell guardring inst_size : deepnwell enclosed size - inst_xmin : deepnwell enclosed xmin - inst_ymin : deepnwell enclosed ymin + inst_xmin : deepnwell enclosed dxmin + inst_ymin : deepnwell enclosed dymin grw : guardring width """ @@ -1039,10 +1039,10 @@ def nfet_deep_nwell( ) ) - lvp_rect.ymin = inst_ymin - lvpwell_enc_ncmp + lvp_rect.dymin = inst_ymin - lvpwell_enc_ncmp dn_enc_lvpwell = 2.5 - lvp_rect.xmin = inst_xmin - lvpwell_enc_ncmp + lvp_rect.dxmin = inst_xmin - lvpwell_enc_ncmp dn_rect = c.add_ref( gf.components.rectangle( size=( @@ -1053,8 +1053,8 @@ def nfet_deep_nwell( ) ) - dn_rect.xmin = lvp_rect.xmin - dn_enc_lvpwell - dn_rect.ymin = lvp_rect.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvp_rect.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvp_rect.dymin - dn_enc_lvpwell if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=grw)) @@ -1070,8 +1070,8 @@ def nfet_deep_nwell( layer=layer["dualgate"], ) ) - dg.xmin = dn_rect.xmin - dg_enc_dn - dg.ymin = dn_rect.ymin - dg_enc_dn + dg.dxmin = dn_rect.dxmin - dg_enc_dn + dg.dymin = dn_rect.dymin - dg_enc_dn elif volt in ["5V", "6V"]: dg_enc_cmp = 0.24 @@ -1086,8 +1086,8 @@ def nfet_deep_nwell( layer=layer["dualgate"], ) ) - dg.xmin = inst_xmin - dg_enc_cmp - dg.ymin = inst_ymin - dg_enc_poly + dg.dxmin = inst_xmin - dg_enc_cmp + dg.dymin = inst_ymin - dg_enc_poly if volt == "5V": v5x = c.add_ref( @@ -1095,8 +1095,8 @@ def nfet_deep_nwell( size=(dg.size[0], dg.size[1]), layer=layer["v5_xtor"] ) ) - v5x.xmin = dg.xmin - v5x.ymin = dg.ymin + v5x.dxmin = dg.dxmin + v5x.dymin = dg.dymin return c @@ -1125,8 +1125,8 @@ def add_inter_sd_labels( labels_gen( label_str="None", position=( - poly1.xmin + l_gate + (inter_sd_l / 2) + i * (l_gate + inter_sd_l), - sd_diff_intr.ymin + (sd_diff_intr.size[1] / 2), + poly1.dxmin + l_gate + (inter_sd_l / 2) + i * (l_gate + inter_sd_l), + sd_diff_intr.dymin + (sd_diff_intr.size[1] / 2), ), layer=label_layer, label=label, @@ -1159,8 +1159,8 @@ def add_gate_labels(c, g_label, pc1, c_pc, pc_spacing, nc1, nc2, pc2, label, lay labels_gen( label_str="None", position=( - pc1.xmin + (c_pc.size[0] / 2) + i * (pc_spacing), - pc1.ymin + (c_pc.size[1] / 2), + pc1.dxmin + (c_pc.size[0] / 2) + i * (pc_spacing), + pc1.dymin + (c_pc.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -1175,8 +1175,8 @@ def add_gate_labels(c, g_label, pc1, c_pc, pc_spacing, nc1, nc2, pc2, label, lay labels_gen( label_str="None", position=( - pc2.xmin + (c_pc.size[0] / 2) + i * (pc_spacing), - pc2.ymin + (c_pc.size[1] / 2), + pc2.dxmin + (c_pc.size[0] / 2) + i * (pc_spacing), + pc2.dymin + (c_pc.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -1203,8 +1203,8 @@ def sd_m1_area_check( 0, ), ) - sd_m1_arr.xmin = sd_con.xmin - sd_m1_arr.ymin = sd_con.ymin - (sd_con_m1.size[1] - sd_con.size[1]) / 2 + sd_m1_arr.dxmin = sd_con.dxmin + sd_m1_arr.dymin = sd_con.dymin - (sd_con_m1.size[1] - sd_con.size[1]) / 2 def poly_con_m1_check(poly_con_area, m1_area, c_pc, poly_con, c_pl_con): @@ -1215,8 +1215,8 @@ def poly_con_m1_check(poly_con_area, m1_area, c_pc, poly_con, c_pl_con): layer=layer["metal1"], ) ) - m1_poly.xmin = c_pl_con.xmin - (m1_poly.size[0] - poly_con.size[0]) / 2 - m1_poly.ymin = c_pl_con.ymin + m1_poly.dxmin = c_pl_con.dxmin - (m1_poly.size[0] - poly_con.size[0]) / 2 + m1_poly.dymin = c_pl_con.dymin def inter_sd_m1_area_check( @@ -1233,9 +1233,9 @@ def inter_sd_m1_area_check( rows=1, spacing=(l_gate + inter_sd_l, 0), ) - inter_sd_m1_arr.xmin = inter_sd_con.xmin - inter_sd_m1_arr.ymin = ( - inter_sd_con.ymin - (inter_sd_con_m1.size[1] - sd_con.size[1]) / 2 + inter_sd_m1_arr.dxmin = inter_sd_con.dxmin + inter_sd_m1_arr.dymin = ( + inter_sd_con.dymin - (inter_sd_con_m1.size[1] - sd_con.size[1]) / 2 ) @@ -1247,8 +1247,8 @@ def bulk_m1_check(bulk_con_area, m1_area, c_inst, bulk_con): layer=layer["metal1"], ) ) - bulk_m1.xmin = bulk_con.xmin - bulk_m1.ymin = bulk_con.ymin - (bulk_m1.size[1] - bulk_con.size[1]) / 2 + bulk_m1.dxmin = bulk_con.dxmin + bulk_m1.dymin = bulk_con.dymin - (bulk_m1.size[1] - bulk_con.size[1]) / 2 # @gf.cell @@ -1359,12 +1359,12 @@ def draw_nfet( spacing=(cmpc_size[0] + sd_diff_intr.size[0], 0), ) - sd_diff.xmin = sd_diff_intr.xmin - cmpc_size[0] - sd_diff.ymin = sd_diff_intr.ymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 + sd_diff.dxmin = sd_diff_intr.dxmin - cmpc_size[0] + sd_diff.dymin = sd_diff_intr.dymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 sd_con = via_stack( - x_range=(sd_diff.xmin + con_pp_sp, sd_diff_intr.xmin - con_pp_sp), - y_range=(sd_diff.ymin, sd_diff.ymax), + x_range=(sd_diff.dxmin + con_pp_sp, sd_diff_intr.dxmin - con_pp_sp), + y_range=(sd_diff.dymin, sd_diff.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1395,8 +1395,12 @@ def draw_nfet( if con_bet_fin == 1 and nf > 1: inter_sd_con = via_stack( x_range=( - sd_diff_intr.xmin + pl_cmp_spacing + l_gate + pl_cmpcon_sp, - sd_diff_intr.xmin + pl_cmp_spacing + l_gate + inter_sd_l - pl_cmpcon_sp, + sd_diff_intr.dxmin + pl_cmp_spacing + l_gate + pl_cmpcon_sp, + sd_diff_intr.dxmin + + pl_cmp_spacing + + l_gate + + inter_sd_l + - pl_cmpcon_sp, ), y_range=(0, w_gate), base_layer=layer["comp"], @@ -1426,7 +1430,10 @@ def draw_nfet( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmin + (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmin + (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, label_lst=sd_label, @@ -1438,7 +1445,10 @@ def draw_nfet( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmax - (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmax - (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, label_lst=sd_label, @@ -1462,8 +1472,8 @@ def draw_nfet( rect_pc = c_pc.add_ref(gf.components.rectangle(size=pc_size, layer=layer["poly2"])) poly_con = via_stack( - x_range=(rect_pc.xmin, rect_pc.xmax), - y_range=(rect_pc.ymin, rect_pc.ymax), + x_range=(rect_pc.dxmin, rect_pc.dxmax), + y_range=(rect_pc.dymin, rect_pc.dymax), base_layer=layer["poly2"], metal_level=1, li_enc_dir="H", @@ -1480,8 +1490,8 @@ def draw_nfet( size=(l_gate, w_gate + 2 * end_cap), layer=layer["poly2"] ) ) - poly.xmin = sd_diff_intr.xmin + pl_cmp_spacing - poly.ymin = sd_diff_intr.ymin - end_cap + poly.dxmin = sd_diff_intr.dxmin + pl_cmp_spacing + poly.dymin = sd_diff_intr.dymin - end_cap if gate_con_pos == "bottom": mv = 0 @@ -1499,13 +1509,13 @@ def draw_nfet( columns=1, spacing=(0, pc_size[1] + w_gate + 2 * end_cap), ) - pc.move((poly.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) + pc.dmove((poly.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) # gate_lablel c.add_ref( labels_gen( label_str="None", - position=(pc.xmin + c_pc.size[0] / 2, pc.ymin + c_pc.size[1] / 2), + position=(pc.dxmin + c_pc.size[0] / 2, pc.dymin + c_pc.size[1] / 2), layer=layer["metal1_label"], label=label, label_lst=g_label, @@ -1544,8 +1554,8 @@ def draw_nfet( columns=ceil(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly1.xmin = sd_diff_intr.xmin + pl_cmp_spacing - poly1.ymin = sd_diff_intr.ymin - end_cap - e_c + poly1.dxmin = sd_diff_intr.dxmin + pl_cmp_spacing + poly1.dymin = sd_diff_intr.dymin - end_cap - e_c poly2 = c_inst.add_array( rect_p2, @@ -1553,8 +1563,8 @@ def draw_nfet( columns=floor(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly2.xmin = poly1.xmin + l_gate + inter_sd_l - poly2.ymin = p_mv + poly2.dxmin = poly1.dxmin + l_gate + inter_sd_l + poly2.dymin = p_mv # generating poly contacts setups @@ -1578,14 +1588,14 @@ def draw_nfet( pc1 = c_inst.add_array( component=c_pc, rows=1, columns=nc1, spacing=(pc_spacing, 0) ) - pc1.move((poly1.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) + pc1.dmove((poly1.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) pc2 = c_inst.add_array( component=c_pc, rows=1, columns=nc2, spacing=(pc_spacing, 0) ) - pc2.move( + pc2.dmove( ( - poly1.xmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), + poly1.dxmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), -pc_size[1] - end_cap + mv_2, ) ) @@ -1640,8 +1650,8 @@ def draw_nfet( layer=layer["nplus"], ) ) - nplus.xmin = sd_diff.xmin - comp_np_enc - nplus.ymin = sd_diff.ymin - np_cmp_ency + nplus.dxmin = sd_diff.dxmin - comp_np_enc + nplus.dymin = sd_diff.dymin - np_cmp_ency elif bulk == "Bulk Tie": rect_bulk = c_inst.add_ref( @@ -1649,33 +1659,33 @@ def draw_nfet( size=(sd_l + con_sp, sd_diff.size[1]), layer=layer["comp"] ) ) - rect_bulk.xmin = sd_diff.xmax - rect_bulk.ymin = sd_diff.ymin + rect_bulk.dxmin = sd_diff.dxmax + rect_bulk.dymin = sd_diff.dymin nsdm = c_inst.add_ref( gf.components.rectangle( size=( - sd_diff.xmax - sd_diff.xmin + comp_np_enc, + sd_diff.dxmax - sd_diff.dxmin + comp_np_enc, sd_diff.size[1] + (2 * np_cmp_ency), ), layer=layer["nplus"], ) ) - nsdm.xmin = sd_diff.xmin - comp_np_enc - nsdm.ymin = sd_diff.ymin - np_cmp_ency + nsdm.dxmin = sd_diff.dxmin - comp_np_enc + nsdm.dymin = sd_diff.dymin - np_cmp_ency psdm = c_inst.add_ref( gf.components.rectangle( size=( - rect_bulk.xmax - rect_bulk.xmin + comp_pp_enc, + rect_bulk.dxmax - rect_bulk.dxmin + comp_pp_enc, w_gate + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm.connect("e1", destination=nsdm.ports["e3"]) + psdm.connect("e1", nsdm.ports["e3"]) bulk_con = via_stack( - x_range=(sd_con_arr.xmax + m1_sp, rect_bulk.xmax), - y_range=(rect_bulk.ymin, rect_bulk.ymax), + x_range=(sd_con_arr.dxmax + m1_sp, rect_bulk.dxmax), + y_range=(rect_bulk.dymin, rect_bulk.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1689,8 +1699,8 @@ def draw_nfet( labels_gen( label_str=sub_label, position=( - bulk_con.xmin + bulk_con.size[0] / 2, - bulk_con.ymin + bulk_con.size[1] / 2, + bulk_con.dxmin + bulk_con.size[0] / 2, + bulk_con.dymin + bulk_con.size[1] / 2, ), layer=layer["metal1_label"], label=label, @@ -1706,8 +1716,8 @@ def draw_nfet( layer=layer["nplus"], ) ) - nsdm.xmin = sd_diff.xmin - comp_np_enc - nsdm.ymin = sd_diff_intr.ymin - gate_np_enc + nsdm.dxmin = sd_diff.dxmin - comp_np_enc + nsdm.dymin = sd_diff_intr.dymin - gate_np_enc c.add_ref(c_inst) bulk_gr_gen( @@ -1730,8 +1740,8 @@ def draw_nfet( c.add_ref(c_inst) inst_size = (c_inst.size[0], c_inst.size[1]) - inst_xmin = c_inst.xmin - inst_ymin = c_inst.ymin + inst_xmin = c_inst.dxmin + inst_ymin = c_inst.dymin c.add_ref( nfet_deep_nwell( @@ -1771,8 +1781,8 @@ def pfet_deep_nwell( deepnwell : boolaen of having deepnwell pcmpgr : boolean of having deepnwell guardring enc_size : enclosed size - enc_xmin : enclosed xmin - enc_ymin : enclosed ymin + enc_xmin : enclosed dxmin + enc_ymin : enclosed dymin nw_enc_pcmp : nwell enclosure of pcomp grw : guardring width """ @@ -1793,8 +1803,8 @@ def pfet_deep_nwell( ) ) - dn_rect.xmin = enc_xmin - dnwell_enc_pcmp - dn_rect.ymin = enc_ymin - dnwell_enc_pcmp + dn_rect.dxmin = enc_xmin - dnwell_enc_pcmp + dn_rect.dymin = enc_ymin - dnwell_enc_pcmp if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=grw)) @@ -1809,8 +1819,8 @@ def pfet_deep_nwell( layer=layer["dualgate"], ) ) - dg.xmin = dn_rect.xmin - dg_enc_dn - dg.ymin = dn_rect.ymin - dg_enc_dn + dg.dxmin = dn_rect.dxmin - dg_enc_dn + dg.dymin = dn_rect.dymin - dg_enc_dn if volt == "5V": v5x = c.add_ref( @@ -1818,8 +1828,8 @@ def pfet_deep_nwell( size=(dg.size[0], dg.size[1]), layer=layer["v5_xtor"] ) ) - v5x.xmin = dg.xmin - v5x.ymin = dg.ymin + v5x.dxmin = dg.dxmin + v5x.dymin = dg.dymin else: # nwell generation @@ -1832,8 +1842,8 @@ def pfet_deep_nwell( layer=layer["nwell"], ) ) - nw.xmin = enc_xmin - nw_enc_pcmp - nw.ymin = enc_ymin - nw_enc_pcmp + nw.dxmin = enc_xmin - nw_enc_pcmp + nw.dymin = enc_ymin - nw_enc_pcmp if volt == "5V" or volt == "6V": dg = c.add_ref( @@ -1845,8 +1855,8 @@ def pfet_deep_nwell( layer=layer["dualgate"], ) ) - dg.xmin = nw.xmin - dg_enc_dn - dg.ymin = nw.ymin - dg_enc_dn + dg.dxmin = nw.dxmin - dg_enc_dn + dg.dymin = nw.dymin - dg_enc_dn if volt == "5V": v5x = c.add_ref( @@ -1854,8 +1864,8 @@ def pfet_deep_nwell( size=(dg.size[0], dg.size[1]), layer=layer["v5_xtor"] ) ) - v5x.xmin = dg.xmin - v5x.ymin = dg.ymin + v5x.dxmin = dg.dxmin + v5x.dymin = dg.dymin return c @@ -1975,12 +1985,12 @@ def draw_pfet( spacing=(cmpc_size[0] + sd_diff_intr.size[0], 0), ) - sd_diff.xmin = sd_diff_intr.xmin - cmpc_size[0] - sd_diff.ymin = sd_diff_intr.ymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 + sd_diff.dxmin = sd_diff_intr.dxmin - cmpc_size[0] + sd_diff.dymin = sd_diff_intr.dymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 sd_con = via_stack( - x_range=(sd_diff.xmin + con_pp_sp, sd_diff_intr.xmin - con_pp_sp), - y_range=(sd_diff.ymin, sd_diff.ymax), + x_range=(sd_diff.dxmin + con_pp_sp, sd_diff_intr.dxmin - con_pp_sp), + y_range=(sd_diff.dymin, sd_diff.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -2011,8 +2021,12 @@ def draw_pfet( if con_bet_fin == 1 and nf > 1: inter_sd_con = via_stack( x_range=( - sd_diff_intr.xmin + pl_cmp_spacing + l_gate + pl_cmpcon_sp, - sd_diff_intr.xmin + pl_cmp_spacing + l_gate + inter_sd_l - pl_cmpcon_sp, + sd_diff_intr.dxmin + pl_cmp_spacing + l_gate + pl_cmpcon_sp, + sd_diff_intr.dxmin + + pl_cmp_spacing + + l_gate + + inter_sd_l + - pl_cmpcon_sp, ), y_range=(0, w_gate), base_layer=layer["comp"], @@ -2042,7 +2056,10 @@ def draw_pfet( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmin + (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmin + (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, label_lst=sd_label, @@ -2054,7 +2071,10 @@ def draw_pfet( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmax - (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmax - (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, label_lst=sd_label, @@ -2078,8 +2098,8 @@ def draw_pfet( rect_pc = c_pc.add_ref(gf.components.rectangle(size=pc_size, layer=layer["poly2"])) poly_con = via_stack( - x_range=(rect_pc.xmin, rect_pc.xmax), - y_range=(rect_pc.ymin, rect_pc.ymax), + x_range=(rect_pc.dxmin, rect_pc.dxmax), + y_range=(rect_pc.dymin, rect_pc.dymax), base_layer=layer["poly2"], metal_level=1, li_enc_dir="H", @@ -2096,8 +2116,8 @@ def draw_pfet( size=(l_gate, w_gate + 2 * end_cap), layer=layer["poly2"] ) ) - poly.xmin = sd_diff_intr.xmin + pl_cmp_spacing - poly.ymin = sd_diff_intr.ymin - end_cap + poly.dxmin = sd_diff_intr.dxmin + pl_cmp_spacing + poly.dymin = sd_diff_intr.dymin - end_cap if gate_con_pos == "bottom": mv = 0 @@ -2115,13 +2135,13 @@ def draw_pfet( columns=1, spacing=(0, pc_size[1] + w_gate + 2 * end_cap), ) - pc.move((poly.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) + pc.dmove((poly.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) # gate_lablel c.add_ref( labels_gen( label_str="None", - position=(pc.xmin + c_pc.size[0] / 2, pc.ymin + c_pc.size[1] / 2), + position=(pc.dxmin + c_pc.size[0] / 2, pc.dymin + c_pc.size[1] / 2), layer=layer["metal1_label"], label=label, label_lst=g_label, @@ -2160,8 +2180,8 @@ def draw_pfet( columns=ceil(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly1.xmin = sd_diff_intr.xmin + pl_cmp_spacing - poly1.ymin = sd_diff_intr.ymin - end_cap - e_c + poly1.dxmin = sd_diff_intr.dxmin + pl_cmp_spacing + poly1.dymin = sd_diff_intr.dymin - end_cap - e_c poly2 = c_inst.add_array( rect_p2, @@ -2169,8 +2189,8 @@ def draw_pfet( columns=floor(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly2.xmin = poly1.xmin + l_gate + inter_sd_l - poly2.ymin = p_mv + poly2.dxmin = poly1.dxmin + l_gate + inter_sd_l + poly2.dymin = p_mv # generating poly contacts setups @@ -2194,14 +2214,14 @@ def draw_pfet( pc1 = c_inst.add_array( component=c_pc, rows=1, columns=nc1, spacing=(pc_spacing, 0) ) - pc1.move((poly1.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) + pc1.dmove((poly1.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) pc2 = c_inst.add_array( component=c_pc, rows=1, columns=nc2, spacing=(pc_spacing, 0) ) - pc2.move( + pc2.dmove( ( - poly1.xmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), + poly1.dxmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), -pc_size[1] - end_cap + mv_2, ) ) @@ -2253,8 +2273,8 @@ def draw_pfet( layer=layer["pplus"], ) ) - pplus.xmin = sd_diff.xmin - comp_pp_enc - pplus.ymin = sd_diff_intr.ymin - gate_pp_enc + pplus.dxmin = sd_diff.dxmin - comp_pp_enc + pplus.dymin = sd_diff_intr.dymin - gate_pp_enc c.add_ref(c_inst) @@ -2265,8 +2285,8 @@ def draw_pfet( deepnwell=deepnwell, pcmpgr=pcmpgr, enc_size=(sd_diff.size[0], sd_diff.size[1]), - enc_xmin=sd_diff.xmin, - enc_ymin=sd_diff.ymin, + enc_xmin=sd_diff.dxmin, + enc_ymin=sd_diff.dymin, nw_enc_pcmp=nw_enc_pcmp, grw=grw, volt=volt, @@ -2281,34 +2301,34 @@ def draw_pfet( size=(sd_l + con_sp, sd_diff.size[1]), layer=layer["comp"] ) ) - rect_bulk.xmin = sd_diff.xmax - rect_bulk.ymin = sd_diff.ymin + rect_bulk.dxmin = sd_diff.dxmax + rect_bulk.dymin = sd_diff.dymin psdm = c_inst.add_ref( gf.components.rectangle( size=( - sd_diff.xmax - sd_diff.xmin + comp_pp_enc, + sd_diff.dxmax - sd_diff.dxmin + comp_pp_enc, sd_diff.size[1] + (2 * pp_cmp_ency), # w_gate + 2 * gate_pp_enc, ), layer=layer["pplus"], ) ) - psdm.xmin = sd_diff.xmin - comp_pp_enc - psdm.ymin = sd_diff.ymin - gate_pp_enc + psdm.dxmin = sd_diff.dxmin - comp_pp_enc + psdm.dymin = sd_diff.dymin - gate_pp_enc nsdm = c_inst.add_ref( gf.components.rectangle( size=( - rect_bulk.xmax - rect_bulk.xmin + comp_np_enc, + rect_bulk.dxmax - rect_bulk.dxmin + comp_np_enc, w_gate + 2 * comp_np_enc, ), layer=layer["nplus"], ) ) - nsdm.connect("e1", destination=psdm.ports["e3"]) + nsdm.connect("e1", psdm.ports["e3"]) bulk_con = via_stack( - x_range=(sd_con_arr.xmax + m1_sp, rect_bulk.xmax), - y_range=(rect_bulk.ymin, rect_bulk.ymax), + x_range=(sd_con_arr.dxmax + m1_sp, rect_bulk.dxmax), + y_range=(rect_bulk.dymin, rect_bulk.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -2324,8 +2344,8 @@ def draw_pfet( labels_gen( label_str=sub_label, position=( - bulk_con.xmin + bulk_con.size[0] / 2, - bulk_con.ymin + bulk_con.size[1] / 2, + bulk_con.dxmin + bulk_con.size[0] / 2, + bulk_con.dymin + bulk_con.size[1] / 2, ), layer=layer["metal1_label"], label=label, @@ -2335,14 +2355,14 @@ def draw_pfet( ) # deep nwell generation - nw_enc_pcmp = 0.45 + comp_np_enc + psdm.ymax - nsdm.ymax + nw_enc_pcmp = 0.45 + comp_np_enc + psdm.dymax - nsdm.dymax c.add_ref( pfet_deep_nwell( deepnwell=deepnwell, pcmpgr=pcmpgr, enc_size=(sd_diff.size[0] + rect_bulk.size[0], sd_diff.size[1]), - enc_xmin=sd_diff.xmin, - enc_ymin=sd_diff.ymin, + enc_xmin=sd_diff.dxmin, + enc_ymin=sd_diff.dymin, nw_enc_pcmp=nw_enc_pcmp, grw=grw, volt=volt, @@ -2356,8 +2376,8 @@ def draw_pfet( layer=layer["pplus"], ) ) - psdm.xmin = sd_diff.xmin - comp_pp_enc - psdm.ymin = sd_diff_intr.ymin - gate_pp_enc + psdm.dxmin = sd_diff.dxmin - comp_pp_enc + psdm.dymin = sd_diff_intr.dymin - gate_pp_enc c.add_ref(c_inst) bulk_gr_gen( @@ -2485,12 +2505,12 @@ def draw_nfet_06v0_nvt( spacing=(cmpc_size[0] + sd_diff_intr.size[0], 0), ) - sd_diff.xmin = sd_diff_intr.xmin - cmpc_size[0] - sd_diff.ymin = sd_diff_intr.ymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 + sd_diff.dxmin = sd_diff_intr.dxmin - cmpc_size[0] + sd_diff.dymin = sd_diff_intr.dymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 sd_con = via_stack( - x_range=(sd_diff.xmin + con_pp_sp, sd_diff_intr.xmin - con_pp_sp), - y_range=(sd_diff.ymin, sd_diff.ymax), + x_range=(sd_diff.dxmin + con_pp_sp, sd_diff_intr.dxmin - con_pp_sp), + y_range=(sd_diff.dymin, sd_diff.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -2521,8 +2541,12 @@ def draw_nfet_06v0_nvt( if con_bet_fin == 1 and nf > 1: inter_sd_con = via_stack( x_range=( - sd_diff_intr.xmin + pl_cmp_spacing + l_gate + pl_cmpcon_sp, - sd_diff_intr.xmin + pl_cmp_spacing + l_gate + inter_sd_l - pl_cmpcon_sp, + sd_diff_intr.dxmin + pl_cmp_spacing + l_gate + pl_cmpcon_sp, + sd_diff_intr.dxmin + + pl_cmp_spacing + + l_gate + + inter_sd_l + - pl_cmpcon_sp, ), y_range=(0, w_gate), base_layer=layer["comp"], @@ -2552,7 +2576,10 @@ def draw_nfet_06v0_nvt( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmin + (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmin + (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, label_lst=sd_label, @@ -2564,7 +2591,10 @@ def draw_nfet_06v0_nvt( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmax - (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmax - (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, label_lst=sd_label, @@ -2588,8 +2618,8 @@ def draw_nfet_06v0_nvt( rect_pc = c_pc.add_ref(gf.components.rectangle(size=pc_size, layer=layer["poly2"])) poly_con = via_stack( - x_range=(rect_pc.xmin, rect_pc.xmax), - y_range=(rect_pc.ymin, rect_pc.ymax), + x_range=(rect_pc.dxmin, rect_pc.dxmax), + y_range=(rect_pc.dymin, rect_pc.dymax), base_layer=layer["poly2"], metal_level=1, li_enc_dir="H", @@ -2602,8 +2632,8 @@ def draw_nfet_06v0_nvt( size=(l_gate, w_gate + 2 * end_cap), layer=layer["poly2"] ) ) - poly.xmin = sd_diff_intr.xmin + pl_cmp_spacing - poly.ymin = sd_diff_intr.ymin - end_cap + poly.dxmin = sd_diff_intr.dxmin + pl_cmp_spacing + poly.dymin = sd_diff_intr.dymin - end_cap if gate_con_pos == "bottom": mv = 0 @@ -2621,13 +2651,13 @@ def draw_nfet_06v0_nvt( columns=1, spacing=(0, pc_size[1] + w_gate + 2 * end_cap), ) - pc.move((poly.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) + pc.dmove((poly.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) # gate_lablel c.add_ref( labels_gen( label_str="None", - position=(pc.xmin + c_pc.size[0] / 2, pc.ymin + c_pc.size[1] / 2), + position=(pc.dxmin + c_pc.size[0] / 2, pc.dymin + c_pc.size[1] / 2), layer=layer["metal1_label"], label=label, label_lst=g_label, @@ -2666,8 +2696,8 @@ def draw_nfet_06v0_nvt( columns=ceil(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly1.xmin = sd_diff_intr.xmin + pl_cmp_spacing - poly1.ymin = sd_diff_intr.ymin - end_cap - e_c + poly1.dxmin = sd_diff_intr.dxmin + pl_cmp_spacing + poly1.dymin = sd_diff_intr.dymin - end_cap - e_c poly2 = c_inst.add_array( rect_p2, @@ -2675,8 +2705,8 @@ def draw_nfet_06v0_nvt( columns=floor(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly2.xmin = poly1.xmin + l_gate + inter_sd_l - poly2.ymin = p_mv + poly2.dxmin = poly1.dxmin + l_gate + inter_sd_l + poly2.dymin = p_mv # generating poly contacts setups @@ -2700,14 +2730,14 @@ def draw_nfet_06v0_nvt( pc1 = c_inst.add_array( component=c_pc, rows=1, columns=nc1, spacing=(pc_spacing, 0) ) - pc1.move((poly1.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) + pc1.dmove((poly1.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) pc2 = c_inst.add_array( component=c_pc, rows=1, columns=nc2, spacing=(pc_spacing, 0) ) - pc2.move( + pc2.dmove( ( - poly1.xmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), + poly1.dxmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), -pc_size[1] - end_cap + mv_2, ) ) @@ -2759,8 +2789,8 @@ def draw_nfet_06v0_nvt( layer=layer["nplus"], ) ) - nplus.xmin = sd_diff.xmin - comp_np_enc - nplus.ymin = sd_diff_intr.ymin - gate_np_enc + nplus.dxmin = sd_diff.dxmin - comp_np_enc + nplus.dymin = sd_diff_intr.dymin - gate_np_enc elif bulk == "Bulk Tie": rect_bulk = c_inst.add_ref( @@ -2768,33 +2798,33 @@ def draw_nfet_06v0_nvt( size=(sd_l + con_sp, sd_diff.size[1]), layer=layer["comp"] ) ) - rect_bulk.xmin = sd_diff.xmax - rect_bulk.ymin = sd_diff.ymin + rect_bulk.dxmin = sd_diff.dxmax + rect_bulk.dymin = sd_diff.dymin nsdm = c_inst.add_ref( gf.components.rectangle( size=( - sd_diff.xmax - sd_diff.xmin + comp_np_enc, + sd_diff.dxmax - sd_diff.dxmin + comp_np_enc, sd_diff.size[1] + (2 * np_cmp_ency), ), layer=layer["nplus"], ) ) - nsdm.xmin = sd_diff.xmin - comp_np_enc - nsdm.ymin = sd_diff.ymin - np_cmp_ency + nsdm.dxmin = sd_diff.dxmin - comp_np_enc + nsdm.dymin = sd_diff.dymin - np_cmp_ency psdm = c_inst.add_ref( gf.components.rectangle( size=( - rect_bulk.xmax - rect_bulk.xmin + comp_pp_enc, + rect_bulk.dxmax - rect_bulk.dxmin + comp_pp_enc, w_gate + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm.connect("e1", destination=nsdm.ports["e3"]) + psdm.connect("e1", nsdm.ports["e3"]) bulk_con = via_stack( - x_range=(sd_con_arr.xmax + m1_sp, rect_bulk.xmax), - y_range=(rect_bulk.ymin, rect_bulk.ymax), + x_range=(sd_con_arr.dxmax + m1_sp, rect_bulk.dxmax), + y_range=(rect_bulk.dymin, rect_bulk.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -2808,8 +2838,8 @@ def draw_nfet_06v0_nvt( labels_gen( label_str=sub_label, position=( - bulk_con.xmin + bulk_con.size[0] / 2, - bulk_con.ymin + bulk_con.size[1] / 2, + bulk_con.dxmin + bulk_con.size[0] / 2, + bulk_con.dymin + bulk_con.size[1] / 2, ), layer=layer["metal1_label"], label=label, @@ -2825,33 +2855,33 @@ def draw_nfet_06v0_nvt( layer=layer["nplus"], ) ) - nsdm.xmin = sd_diff.xmin - comp_np_enc - nsdm.ymin = sd_diff_intr.ymin - gate_np_enc + nsdm.dxmin = sd_diff.dxmin - comp_np_enc + nsdm.dymin = sd_diff_intr.dymin - gate_np_enc c.add_ref(c_inst) c_temp = gf.Component("temp_store") rect_bulk_in = c_temp.add_ref( gf.components.rectangle( size=( - (c_inst.xmax - c_inst.xmin) + 2 * comp_spacing, - (c_inst.ymax - c_inst.ymin) + 2 * poly2_comp_spacing, + (c_inst.dxmax - c_inst.dxmin) + 2 * comp_spacing, + (c_inst.dymax - c_inst.dymin) + 2 * poly2_comp_spacing, ), layer=layer["comp"], ) ) - rect_bulk_in.move( - (c_inst.xmin - comp_spacing, c_inst.ymin - poly2_comp_spacing) + rect_bulk_in.dmove( + (c_inst.dxmin - comp_spacing, c_inst.dymin - poly2_comp_spacing) ) rect_bulk_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) + 2 * grw, - (rect_bulk_in.ymax - rect_bulk_in.ymin) + 2 * grw, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) + 2 * grw, + (rect_bulk_in.dymax - rect_bulk_in.dymin) + 2 * grw, ), layer=layer["comp"], ) ) - rect_bulk_out.move((rect_bulk_in.xmin - grw, rect_bulk_in.ymin - grw)) + rect_bulk_out.dmove((rect_bulk_in.dxmin - grw, rect_bulk_in.dymin - grw)) c.add_ref( gf.geometry.boolean( A=rect_bulk_out, @@ -2864,26 +2894,28 @@ def draw_nfet_06v0_nvt( psdm_in = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) - 2 * comp_pp_enc, - (rect_bulk_in.ymax - rect_bulk_in.ymin) - 2 * comp_pp_enc, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) - 2 * comp_pp_enc, + (rect_bulk_in.dymax - rect_bulk_in.dymin) - 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_in.move((rect_bulk_in.xmin + comp_pp_enc, rect_bulk_in.ymin + comp_pp_enc)) + psdm_in.dmove( + (rect_bulk_in.dxmin + comp_pp_enc, rect_bulk_in.dymin + comp_pp_enc) + ) psdm_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_out.xmax - rect_bulk_out.xmin) + 2 * comp_pp_enc, - (rect_bulk_out.ymax - rect_bulk_out.ymin) + 2 * comp_pp_enc, + (rect_bulk_out.dxmax - rect_bulk_out.dxmin) + 2 * comp_pp_enc, + (rect_bulk_out.dymax - rect_bulk_out.dymin) + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_bulk_out.xmin - comp_pp_enc, - rect_bulk_out.ymin - comp_pp_enc, + rect_bulk_out.dxmin - comp_pp_enc, + rect_bulk_out.dymin - comp_pp_enc, ) ) psdm = c.add_ref( @@ -2897,10 +2929,10 @@ def draw_nfet_06v0_nvt( c.add_ref( via_generator( x_range=( - rect_bulk_in.xmin + con_size, - rect_bulk_in.xmax - con_size, + rect_bulk_in.dxmin + con_size, + rect_bulk_in.dxmax - con_size, ), - y_range=(rect_bulk_out.ymin, rect_bulk_in.ymin), + y_range=(rect_bulk_out.dymin, rect_bulk_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -2911,10 +2943,10 @@ def draw_nfet_06v0_nvt( c.add_ref( via_generator( x_range=( - rect_bulk_in.xmin + con_size, - rect_bulk_in.xmax - con_size, + rect_bulk_in.dxmin + con_size, + rect_bulk_in.dxmax - con_size, ), - y_range=(rect_bulk_in.ymax, rect_bulk_out.ymax), + y_range=(rect_bulk_in.dymax, rect_bulk_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -2924,10 +2956,10 @@ def draw_nfet_06v0_nvt( c.add_ref( via_generator( - x_range=(rect_bulk_out.xmin, rect_bulk_in.xmin), + x_range=(rect_bulk_out.dxmin, rect_bulk_in.dxmin), y_range=( - rect_bulk_in.ymin + con_size, - rect_bulk_in.ymax - con_size, + rect_bulk_in.dymin + con_size, + rect_bulk_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -2938,10 +2970,10 @@ def draw_nfet_06v0_nvt( c.add_ref( via_generator( - x_range=(rect_bulk_in.xmax, rect_bulk_out.xmax), + x_range=(rect_bulk_in.dxmax, rect_bulk_out.dxmax), y_range=( - rect_bulk_in.ymin + con_size, - rect_bulk_in.ymax - con_size, + rect_bulk_in.dymin + con_size, + rect_bulk_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -2954,22 +2986,22 @@ def draw_nfet_06v0_nvt( gf.components.rectangle( size=( (l_d) + 2 * comp_spacing, - (c_inst.ymax - c_inst.ymin) + 2 * poly2_comp_spacing, + (c_inst.dymax - c_inst.dymin) + 2 * poly2_comp_spacing, ), layer=layer["metal1"], ) ) - comp_m1_in.move((-comp_spacing, c_inst.ymin - poly2_comp_spacing)) + comp_m1_in.dmove((-comp_spacing, c_inst.dymin - poly2_comp_spacing)) comp_m1_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) + 2 * grw, - (rect_bulk_in.ymax - rect_bulk_in.ymin) + 2 * grw, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) + 2 * grw, + (rect_bulk_in.dymax - rect_bulk_in.dymin) + 2 * grw, ), layer=layer["metal1"], ) ) - comp_m1_out.move((rect_bulk_in.xmin - grw, rect_bulk_in.ymin - grw)) + comp_m1_out.dmove((rect_bulk_in.dxmin - grw, rect_bulk_in.dymin - grw)) b_gr = c.add_ref( gf.geometry.boolean( A=rect_bulk_out, @@ -2983,8 +3015,8 @@ def draw_nfet_06v0_nvt( labels_gen( label_str=sub_label, position=( - b_gr.xmin + (grw + 2 * (comp_pp_enc)) / 2, - b_gr.ymin + (b_gr.size[1] / 2), + b_gr.dxmin + (grw + 2 * (comp_pp_enc)) / 2, + b_gr.dymin + (b_gr.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -3002,8 +3034,8 @@ def draw_nfet_06v0_nvt( layer=layer["dualgate"], ) ) - dg.xmin = sd_diff.xmin - nvt_enc_cmp - dg.ymin = sd_diff.ymin - nvt_enc_cmp + dg.dxmin = sd_diff.dxmin - nvt_enc_cmp + dg.dymin = sd_diff.dymin - nvt_enc_cmp if bulk != "Guard Ring": c.add_ref(c_inst) @@ -3017,16 +3049,16 @@ def draw_nfet_06v0_nvt( layer=layer["dualgate"], ) ) - dg.xmin = c_inst.xmin - nvt_enc_cmp - dg.ymin = c_inst.ymin - nvt_enc_cmp + dg.dxmin = c_inst.dxmin - nvt_enc_cmp + dg.dymin = c_inst.dymin - nvt_enc_cmp # generating native layer nat = c.add_ref( gf.components.rectangle(size=(dg.size[0], dg.size[1]), layer=layer["nat"]) ) - nat.xmin = dg.xmin - nat.ymin = dg.ymin + nat.dxmin = dg.dxmin + nat.dymin = dg.dymin # creating layout and cell in klayout diff --git a/gf180/cells/klayout/pymacros/cells/draw_res.py b/gf180/cells/klayout/pymacros/cells/draw_res.py index ab911e4..d2e4f4e 100644 --- a/gf180/cells/klayout/pymacros/cells/draw_res.py +++ b/gf180/cells/klayout/pymacros/cells/draw_res.py @@ -67,24 +67,24 @@ def draw_metal_res( m_rect = c.add_ref( gf.components.rectangle(size=(l_res + (2 * m_ext), w_res), layer=m_layer) ) - m_rect.xmin = res_mk.xmin - m_ext - m_rect.ymin = res_mk.ymin + m_rect.dxmin = res_mk.dxmin - m_ext + m_rect.dymin = res_mk.dymin # labels generation if label == 1: c.add_label( r0_label, position=( - res_mk.xmin + (res_mk.size[0] / 2), - res_mk.ymin + (res_mk.size[1] / 2), + res_mk.dxmin + (res_mk.size[0] / 2), + res_mk.dymin + (res_mk.size[1] / 2), ), layer=m_label_layer, ) c.add_label( r1_label, position=( - m_rect.xmin + (res_mk.xmin - m_rect.xmin) / 2, - m_rect.ymin + (m_rect.size[1] / 2), + m_rect.dxmin + (res_mk.dxmin - m_rect.dxmin) / 2, + m_rect.dymin + (m_rect.size[1] / 2), ), layer=m_label_layer, ) @@ -118,23 +118,23 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move((dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn)) + rect_pcmpgr_in.dmove((dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn)) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * grw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * grw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * grw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * grw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - grw, rect_pcmpgr_in.ymin - grw)) + rect_pcmpgr_out.dmove((rect_pcmpgr_in.dxmin - grw, rect_pcmpgr_in.dymin - grw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -147,31 +147,31 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * comp_pp_enc, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * comp_pp_enc, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * comp_pp_enc, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + comp_pp_enc, - rect_pcmpgr_in.ymin + comp_pp_enc, + rect_pcmpgr_in.dxmin + comp_pp_enc, + rect_pcmpgr_in.dymin + comp_pp_enc, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * comp_pp_enc, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * comp_pp_enc, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + 2 * comp_pp_enc, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - comp_pp_enc, - rect_pcmpgr_out.ymin - comp_pp_enc, + rect_pcmpgr_out.dxmin - comp_pp_enc, + rect_pcmpgr_out.dymin - comp_pp_enc, ) ) c.add_ref( @@ -185,10 +185,10 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -199,10 +199,10 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -212,10 +212,10 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -226,10 +226,10 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -254,7 +254,7 @@ def pcmpgr_gen(dn_rect, grw: float = 0.36) -> gf.Component: layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - grw, rect_pcmpgr_in.ymin - grw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - grw, rect_pcmpgr_in.dymin - grw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -298,8 +298,8 @@ def plus_res_inst( layer=layer["sab"], ) ) - sab_rect.xmin = res_mk.xmin - sab_rect.ymin = res_mk.ymin - sab_res_ext + sab_rect.dxmin = res_mk.dxmin + sab_rect.dymin = res_mk.dymin - sab_res_ext cmp = c.add_ref( gf.components.rectangle( @@ -307,12 +307,12 @@ def plus_res_inst( layer=layer["comp"], ) ) - cmp.xmin = res_mk.xmin - cmp_res_ext - cmp.ymin = res_mk.ymin + cmp.dxmin = res_mk.dxmin - cmp_res_ext + cmp.dymin = res_mk.dymin cmp_con = via_stack( - x_range=(cmp.xmin, res_mk.xmin + con_enc), - y_range=(cmp.ymin, cmp.ymax), + x_range=(cmp.dxmin, res_mk.dxmin + con_enc), + y_range=(cmp.dymin, cmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -329,16 +329,16 @@ def plus_res_inst( c.add_label( r0_label, position=( - cmp_con_arr.xmin + (cmp_con.size[0] / 2), - cmp_con_arr.ymin + (cmp_con.size[1] / 2), + cmp_con_arr.dxmin + (cmp_con.size[0] / 2), + cmp_con_arr.dymin + (cmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) c.add_label( r1_label, position=( - cmp_con_arr.xmax - (cmp_con.size[0] / 2), - cmp_con_arr.ymin + (cmp_con.size[1] / 2), + cmp_con_arr.dxmax - (cmp_con.size[0] / 2), + cmp_con_arr.dymin + (cmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -349,8 +349,8 @@ def plus_res_inst( layer=cmp_imp_layer, ) ) - cmp_imp.xmin = cmp.xmin - np_enc_cmp - cmp_imp.ymin = cmp.ymin - np_enc_cmp + cmp_imp.dxmin = cmp.dxmin - np_enc_cmp + cmp_imp.dymin = cmp.dymin - np_enc_cmp if sub == 1: sub_w: float = 0.36 @@ -358,14 +358,14 @@ def plus_res_inst( gf.components.rectangle(size=(sub_w, w_res), layer=layer["comp"]) ) comp_spacing: float = 0.72 - sub_rect.xmax = cmp.xmin - comp_spacing - sub_rect.ymin = cmp.ymin + sub_rect.dxmax = cmp.dxmin - comp_spacing + sub_rect.dymin = cmp.dymin # sub_rect contact sub_con = c.add_ref( via_stack( - x_range=(sub_rect.xmin, sub_rect.xmax), - y_range=(sub_rect.ymin, sub_rect.ymax), + x_range=(sub_rect.dxmin, sub_rect.dxmax), + y_range=(sub_rect.dymin, sub_rect.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -381,16 +381,16 @@ def plus_res_inst( layer=sub_imp_layer, ) ) - sub_imp.xmin = sub_rect.xmin - pp_enc_cmp - sub_imp.ymin = sub_rect.ymin - pp_enc_cmp + sub_imp.dxmin = sub_rect.dxmin - pp_enc_cmp + sub_imp.dymin = sub_rect.dymin - pp_enc_cmp # label generation if label == 1: c.add_label( sub_label, position=( - sub_con.xmin + (sub_con.size[0] / 2), - sub_con.ymin + (sub_con.size[1] / 2), + sub_con.dxmin + (sub_con.size[0] / 2), + sub_con.dymin + (sub_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -449,8 +449,8 @@ def draw_nplus_res( layer=layer["lvpwell"], ) ) - lvpwell.xmin = r_inst.xmin - lvpwell_enc_cmp - lvpwell.ymin = r_inst.ymin - lvpwell_enc_cmp + lvpwell.dxmin = r_inst.dxmin - lvpwell_enc_cmp + lvpwell.dymin = r_inst.dymin - lvpwell_enc_cmp dn_enc_lvpwell = 2.5 dn_rect = c.add_ref( @@ -462,8 +462,8 @@ def draw_nplus_res( layer=layer["dnwell"], ) ) - dn_rect.xmin = lvpwell.xmin - dn_enc_lvpwell - dn_rect.ymin = lvpwell.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvpwell.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvpwell.dymin - dn_enc_lvpwell if pcmpgr == 1: sub_w = 0.36 @@ -529,8 +529,8 @@ def draw_pplus_res( layer=layer["dnwell"], ) ) - dn_rect.xmax = r_inst.xmax + dn_enc_pcmp - dn_rect.ymin = r_inst.ymin - dn_enc_pcmp + dn_rect.dxmax = r_inst.dxmax + dn_enc_pcmp + dn_rect.dymin = r_inst.dymin - dn_enc_pcmp if pcmpgr == 1: sub_w = 0.36 @@ -548,8 +548,8 @@ def draw_pplus_res( layer=layer["nwell"], ) ) - nw_rect.xmin = r_inst.xmin - nw_enc_pcmp - nw_rect.ymin = r_inst.ymin - nw_enc_pcmp + nw_rect.dxmin = r_inst.dxmin - nw_enc_pcmp + nw_rect.dymin = r_inst.dymin - nw_enc_pcmp c.write_gds("res_temp.gds") layout.read("res_temp.gds") @@ -591,8 +591,8 @@ def polyf_res_inst( layer=layer["sab"], ) ) - sab_rect.xmin = res_mk.xmin - sab_rect.ymin = res_mk.ymin - sab_res_ext + sab_rect.dxmin = res_mk.dxmin + sab_rect.dymin = res_mk.dymin - sab_res_ext pl = c.add_ref( gf.components.rectangle( @@ -600,12 +600,12 @@ def polyf_res_inst( layer=layer["poly2"], ) ) - pl.xmin = res_mk.xmin - pl_res_ext - pl.ymin = res_mk.ymin + pl.dxmin = res_mk.dxmin - pl_res_ext + pl.dymin = res_mk.dymin pl_con = via_stack( - x_range=(pl.xmin, res_mk.xmin + con_enc), - y_range=(pl.ymin, pl.ymax), + x_range=(pl.dxmin, res_mk.dxmin + con_enc), + y_range=(pl.dymin, pl.dymax), base_layer=layer["poly2"], metal_level=1, ) @@ -623,20 +623,20 @@ def polyf_res_inst( layer=pl_imp_layer, ) ) - pl_imp.xmin = pl.xmin - np_enc_poly2 - pl_imp.ymin = pl.ymin - np_enc_poly2 + pl_imp.dxmin = pl.dxmin - np_enc_poly2 + pl_imp.dymin = pl.dymin - np_enc_poly2 sub_rect = c.add_ref( gf.components.rectangle(size=(sub_w, w_res), layer=layer["comp"]) ) - sub_rect.xmax = pl.xmin - comp_spacing - sub_rect.ymin = pl.ymin + sub_rect.dxmax = pl.dxmin - comp_spacing + sub_rect.dymin = pl.dymin # sub_rect contact sub_con = c.add_ref( via_stack( - x_range=(sub_rect.xmin, sub_rect.xmax), - y_range=(sub_rect.ymin, sub_rect.ymax), + x_range=(sub_rect.dxmin, sub_rect.dxmax), + y_range=(sub_rect.dymin, sub_rect.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -651,24 +651,24 @@ def polyf_res_inst( layer=sub_imp_layer, ) ) - sub_imp.xmin = sub_rect.xmin - pp_enc_cmp - sub_imp.ymin = sub_rect.ymin - pp_enc_cmp + sub_imp.dxmin = sub_rect.dxmin - pp_enc_cmp + sub_imp.dymin = sub_rect.dymin - pp_enc_cmp # labels generation if label == 1: c.add_label( r0_label, position=( - pl_con_arr.xmin + (pl_con.size[0] / 2), - pl_con_arr.ymin + (pl_con.size[1] / 2), + pl_con_arr.dxmin + (pl_con.size[0] / 2), + pl_con_arr.dymin + (pl_con.size[1] / 2), ), layer=layer["metal1_label"], ) c.add_label( r1_label, position=( - pl_con_arr.xmax - (pl_con.size[0] / 2), - pl_con_arr.ymin + (pl_con.size[1] / 2), + pl_con_arr.dxmax - (pl_con.size[0] / 2), + pl_con_arr.dymin + (pl_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -676,8 +676,8 @@ def polyf_res_inst( c.add_label( sub_label, position=( - sub_con.xmin + (sub_con.size[0] / 2), - sub_con.ymin + (sub_con.size[1] / 2), + sub_con.dxmin + (sub_con.size[0] / 2), + sub_con.dymin + (sub_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -734,8 +734,8 @@ def draw_npolyf_res( layer=layer["lvpwell"], ) ) - lvpwell.xmin = r_inst.xmin - lvpwell_enc_cmp - lvpwell.ymin = r_inst.ymin - lvpwell_enc_cmp + lvpwell.dxmin = r_inst.dxmin - lvpwell_enc_cmp + lvpwell.dymin = r_inst.dymin - lvpwell_enc_cmp dn_enc_lvpwell = 2.5 dn_rect = c.add_ref( @@ -747,8 +747,8 @@ def draw_npolyf_res( layer=layer["dnwell"], ) ) - dn_rect.xmin = lvpwell.xmin - dn_enc_lvpwell - dn_rect.ymin = lvpwell.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvpwell.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvpwell.dymin - dn_enc_lvpwell if pcmpgr == 1: sub_w = 0.36 @@ -814,8 +814,8 @@ def draw_ppolyf_res( layer=layer["dnwell"], ) ) - dn_rect.xmax = r_inst.xmax + dn_enc_poly2 - dn_rect.ymin = r_inst.ymin - dn_enc_poly2 + dn_rect.dxmax = r_inst.dxmax + dn_enc_poly2 + dn_rect.dymin = r_inst.dymin - dn_enc_poly2 if pcmpgr == 1: sub_w = 0.36 @@ -870,8 +870,8 @@ def draw_ppolyf_u_high_Rs_res( ) ) - resis_mk.xmin = res_mk.xmin - resis_enc[0] - resis_mk.ymin = res_mk.ymin - resis_enc[1] + resis_mk.dxmin = res_mk.dxmin - resis_enc[0] + resis_mk.dymin = res_mk.dymin - resis_enc[1] sab_rect = c.add_ref( gf.components.rectangle( @@ -882,8 +882,8 @@ def draw_ppolyf_u_high_Rs_res( layer=layer["sab"], ) ) - sab_rect.xmin = res_mk.xmin - sab_res_ext[0] - sab_rect.ymin = res_mk.ymin - sab_res_ext[1] + sab_rect.dxmin = res_mk.dxmin - sab_res_ext[0] + sab_rect.dymin = res_mk.dymin - sab_res_ext[1] pl = c.add_ref( gf.components.rectangle( @@ -891,12 +891,12 @@ def draw_ppolyf_u_high_Rs_res( layer=layer["poly2"], ) ) - pl.xmin = res_mk.xmin - pl_res_ext - pl.ymin = res_mk.ymin + pl.dxmin = res_mk.dxmin - pl_res_ext + pl.dymin = res_mk.dymin pl_con = via_stack( - x_range=(pl.xmin, pl.xmin + con_size), - y_range=(pl.ymin, pl.ymax), + x_range=(pl.dxmin, pl.dxmin + con_size), + y_range=(pl.dymin, pl.dymax), base_layer=layer["poly2"], metal_level=1, ) @@ -917,20 +917,20 @@ def draw_ppolyf_u_high_Rs_res( component=pplus, rows=1, columns=2, spacing=(pplus.size[0] + res_mk.size[0], 0) ) - pplus_arr.xmin = pl.xmin - pp_enc_poly2 - pplus_arr.ymin = pl.ymin - pp_enc_poly2 + pplus_arr.dxmin = pl.dxmin - pp_enc_poly2 + pplus_arr.dymin = pl.dymin - pp_enc_poly2 sub_rect = c.add_ref( gf.components.rectangle(size=(sub_w, w_res), layer=layer["comp"]) ) - sub_rect.xmax = pl.xmin - comp_spacing - sub_rect.ymin = pl.ymin + sub_rect.dxmax = pl.dxmin - comp_spacing + sub_rect.dymin = pl.dymin # sub_rect contact sub_con = c.add_ref( via_stack( - x_range=(sub_rect.xmin, sub_rect.xmax), - y_range=(sub_rect.ymin, sub_rect.ymax), + x_range=(sub_rect.dxmin, sub_rect.dxmax), + y_range=(sub_rect.dymin, sub_rect.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -941,16 +941,16 @@ def draw_ppolyf_u_high_Rs_res( c.add_label( r0_label, position=( - pl_con_arr.xmin + (pl_con.size[0] / 2), - pl_con_arr.ymin + (pl_con.size[1] / 2), + pl_con_arr.dxmin + (pl_con.size[0] / 2), + pl_con_arr.dymin + (pl_con.size[1] / 2), ), layer=layer["metal1_label"], ) c.add_label( r1_label, position=( - pl_con_arr.xmax - (pl_con.size[0] / 2), - pl_con_arr.ymin + (pl_con.size[1] / 2), + pl_con_arr.dxmax - (pl_con.size[0] / 2), + pl_con_arr.dymin + (pl_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -958,8 +958,8 @@ def draw_ppolyf_u_high_Rs_res( c.add_label( sub_label, position=( - sub_con.xmin + (sub_con.size[0] / 2), - sub_con.ymin + (sub_con.size[1] / 2), + sub_con.dxmin + (sub_con.size[0] / 2), + sub_con.dymin + (sub_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -978,21 +978,21 @@ def draw_ppolyf_u_high_Rs_res( layer=sub_layer, ) ) - sub_imp.xmin = sub_rect.xmin - pp_enc_cmp - sub_imp.ymin = sub_rect.ymin - pp_enc_cmp + sub_imp.dxmin = sub_rect.dxmin - pp_enc_cmp + sub_imp.dymin = sub_rect.dymin - pp_enc_cmp if deepnwell == 1: dn_rect = c.add_ref( gf.components.rectangle( size=( - (pl.xmax - sub_rect.xmin) + (dn_enc_poly2 + dn_enc_ncmp), + (pl.dxmax - sub_rect.dxmin) + (dn_enc_poly2 + dn_enc_ncmp), pl.size[1] + (2 * dn_enc_poly2), ), layer=layer["dnwell"], ) ) - dn_rect.xmax = pl.xmax + dn_enc_poly2 - dn_rect.ymin = pl.ymin - dn_enc_poly2 + dn_rect.dxmax = pl.dxmax + dn_enc_poly2 + dn_rect.dymin = pl.dymin - dn_enc_poly2 if volt == "5/6V": dg = c.add_ref( @@ -1005,8 +1005,8 @@ def draw_ppolyf_u_high_Rs_res( ) ) - dg.xmin = dn_rect.xmin - dg_enc_dn - dg.ymin = dn_rect.ymin - dg_enc_dn + dg.dxmin = dn_rect.dxmin - dg_enc_dn + dg.dymin = dn_rect.dymin - dg_enc_dn if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=sub_w)) @@ -1019,8 +1019,8 @@ def draw_ppolyf_u_high_Rs_res( ) ) - dg.xmin = resis_mk.xmin - dg.ymin = resis_mk.ymin + dg.dxmin = resis_mk.dxmin + dg.dymin = resis_mk.dymin c.write_gds("res_temp.gds") layout.read("res_temp.gds") @@ -1071,21 +1071,21 @@ def draw_well_res( size=(res_mk.size[0] + (2 * nw_res_ext), w_res), layer=well_layer ) ) - well_rect.xmin = res_mk.xmin - nw_res_ext - well_rect.ymin = res_mk.ymin + nw_res_enc + well_rect.dxmin = res_mk.dxmin - nw_res_ext + well_rect.dymin = res_mk.dymin + nw_res_enc @gf.cell def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: c = gf.Component() cmp = c.add_ref(gf.components.rectangle(size=size, layer=layer["comp"])) - cmp.xmin = well_rect.xmin + nw_enc_cmp - cmp.ymin = well_rect.ymin + nw_enc_cmp + cmp.dxmin = well_rect.dxmin + nw_enc_cmp + cmp.dymin = well_rect.dymin + nw_enc_cmp c.add_ref( via_stack( - x_range=(cmp.xmin, cmp.xmax), - y_range=(cmp.ymin, cmp.ymax), + x_range=(cmp.dxmin, cmp.dxmax), + y_range=(cmp.dymin, cmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1095,7 +1095,7 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: con_polys = comp_related_gen( size=( - res_mk.xmin - well_rect.xmin - nw_enc_cmp, + res_mk.dxmin - well_rect.dxmin - nw_enc_cmp, well_rect.size[1] - (2 * nw_enc_cmp), ) ) @@ -1120,20 +1120,20 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: columns=2, spacing=(well_rect.size[0] - (2 * nw_enc_cmp) - con_polys.size[0], 0), ) - nplus_arr.xmin = con_polys.xmin - pp_enc_cmp - nplus_arr.ymin = con_polys.ymin - pp_enc_cmp + nplus_arr.dxmin = con_polys.dxmin - pp_enc_cmp + nplus_arr.dymin = con_polys.dymin - pp_enc_cmp sub_rect = c.add_ref( gf.components.rectangle(size=(sub_w, well_rect.size[1]), layer=layer["comp"]) ) - sub_rect.xmax = well_rect.xmin - nw_comp_spacing - sub_rect.ymin = well_rect.ymin + sub_rect.dxmax = well_rect.dxmin - nw_comp_spacing + sub_rect.dymin = well_rect.dymin # sub_rect contact sub_con = c.add_ref( via_stack( - x_range=(sub_rect.xmin, sub_rect.xmax), - y_range=(sub_rect.ymin, sub_rect.ymax), + x_range=(sub_rect.dxmin, sub_rect.dxmax), + y_range=(sub_rect.dymin, sub_rect.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1148,8 +1148,8 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: layer=sub_imp_layer, ) ) - sub_imp.xmin = sub_rect.xmin - pp_enc_cmp - sub_imp.ymin = sub_rect.ymin - pp_enc_cmp + sub_imp.dxmin = sub_rect.dxmin - pp_enc_cmp + sub_imp.dymin = sub_rect.dymin - pp_enc_cmp if res_type == "pwell": dn_rect = c.add_ref( @@ -1161,8 +1161,8 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: layer=layer["dnwell"], ) ) - dn_rect.xmin = well_rect.xmin - dn_enc_lvpwell - dn_rect.ymin = well_rect.ymin - dn_enc_lvpwell + dn_rect.dxmin = well_rect.dxmin - dn_enc_lvpwell + dn_rect.dymin = well_rect.dymin - dn_enc_lvpwell if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=sub_w)) @@ -1172,16 +1172,16 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: c.add_label( r0_label, position=( - con_polys_arr.xmin + (con_polys.size[0] / 2), - con_polys_arr.ymin + (con_polys.size[1] / 2), + con_polys_arr.dxmin + (con_polys.size[0] / 2), + con_polys_arr.dymin + (con_polys.size[1] / 2), ), layer=layer["metal1_label"], ) c.add_label( r1_label, position=( - con_polys_arr.xmax - (con_polys.size[0] / 2), - con_polys_arr.ymin + (con_polys.size[1] / 2), + con_polys_arr.dxmax - (con_polys.size[0] / 2), + con_polys_arr.dymin + (con_polys.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -1189,8 +1189,8 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: c.add_label( sub_label, position=( - sub_con.xmin + (sub_con.size[0] / 2), - sub_con.ymin + (sub_con.size[1] / 2), + sub_con.dxmin + (sub_con.size[0] / 2), + sub_con.dymin + (sub_con.size[1] / 2), ), layer=layer["metal1_label"], ) diff --git a/gf180/cells/klayout/pymacros/cells/efuse.py b/gf180/cells/klayout/pymacros/cells/efuse.py index 03cf5dc..8185b2a 100644 --- a/gf180/cells/klayout/pymacros/cells/efuse.py +++ b/gf180/cells/klayout/pymacros/cells/efuse.py @@ -70,9 +70,9 @@ def parameters_from_shape_impl(self): pass def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - # return pya.Trans(self.shape.bbox().center()) + # return pya.Trans(self.shape.bbox().dcenter()) pass def produce_impl(self): diff --git a/gf180/cells/klayout/pymacros/cells/fet.py b/gf180/cells/klayout/pymacros/cells/fet.py index 60e6f1e..5ca6a5f 100644 --- a/gf180/cells/klayout/pymacros/cells/fet.py +++ b/gf180/cells/klayout/pymacros/cells/fet.py @@ -142,9 +142,9 @@ def parameters_from_shape_impl(self): self.l_gate = self.l_gateayout.get_info(self.l_gateayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): instance = draw_nfet( @@ -281,9 +281,9 @@ def parameters_from_shape_impl(self): self.l_gate = self.l_gateayout.get_info(self.l_gateayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): instance = draw_pfet( @@ -411,9 +411,9 @@ def parameters_from_shape_impl(self): self.l_gate = self.l_gateayout.get_info(self.l_gateayer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): instance = draw_nfet_06v0_nvt( diff --git a/gf180/cells/klayout/pymacros/cells/res.py b/gf180/cells/klayout/pymacros/cells/res.py index a15f48a..09d385c 100644 --- a/gf180/cells/klayout/pymacros/cells/res.py +++ b/gf180/cells/klayout/pymacros/cells/res.py @@ -167,9 +167,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu @@ -269,9 +269,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu @@ -365,9 +365,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu @@ -461,9 +461,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu @@ -557,9 +557,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu @@ -650,9 +650,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu @@ -743,9 +743,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu @@ -837,9 +837,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu @@ -932,9 +932,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu @@ -1027,9 +1027,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu @@ -1122,9 +1122,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu @@ -1225,9 +1225,9 @@ def parameters_from_shape_impl(self): self.l_res = self.layout.get_info(self.layer) def transformation_from_shape_impl(self): - # Implement the "Create PCell from shape" protocol: we use the center of the shape's + # Implement the "Create PCell from shape" protocol: we use the dcenter of the shape's # bounding box to determine the transformation - return pya.Trans(self.shape.bbox().center()) + return pya.Trans(self.shape.bbox().dcenter()) def produce_impl(self): dbu_PERCISION = 1 / self.layout.dbu diff --git a/gf180/cells/klayout/pymacros/cells/via_generator.py b/gf180/cells/klayout/pymacros/cells/via_generator.py index 60496ab..e7a787d 100644 --- a/gf180/cells/klayout/pymacros/cells/via_generator.py +++ b/gf180/cells/klayout/pymacros/cells/via_generator.py @@ -64,10 +64,10 @@ def via_generator( via_arr = c.add_array(rect_via, rows=nr, columns=nc, spacing=via_sp) - via_arr.move((x_range[0], y_range[0])) + via_arr.dmove((x_range[0], y_range[0])) - via_arr.movex((width - nc * via_size[0] - (nc - 1) * via_spacing[0]) / 2) - via_arr.movey((length - nr * via_size[1] - (nr - 1) * via_spacing[1]) / 2) + via_arr.dmovex((width - nc * via_size[0] - (nc - 1) * via_spacing[0]) / 2) + via_arr.dmovey((length - nr * via_size[1] - (nr - 1) * via_spacing[1]) / 2) return c @@ -124,13 +124,13 @@ def via_stack( m1 = c.add_ref( gf.components.rectangle(size=(m1_x, m1_y), layer=layer["metal1"]) ) - m1.xmin = con.xmin - m_enc - m1.ymin = con.ymin - m_enc + m1.dxmin = con.dxmin - m_enc + m1.dymin = con.dymin - m_enc if metal_level >= 2: via1_gen = via_generator( - x_range=(m1.xmin, m1.xmax), - y_range=(m1.ymin, m1.ymax), + x_range=(m1.dxmin, m1.dxmax), + y_range=(m1.dymin, m1.dymax), via_size=via_size, via_enclosure=via_enc, via_layer=layer["via1"], @@ -138,29 +138,29 @@ def via_stack( ) via1 = c.add_ref(via1_gen) - if (via1.xmax - via1.xmin + 2 * m_enc[0]) < ( + if (via1.dxmax - via1.dxmin + 2 * m_enc[0]) < ( via_size[0] + 2 * via_enc[0] ) and metal_level >= 3: m2_x = via_size[0] + 2 * via_enc[0] else: - m2_x = via1.xmax - via1.xmin + 2 * m_enc[0] + m2_x = via1.dxmax - via1.dxmin + 2 * m_enc[0] - if (via1.ymax - via1.ymin + 2 * m_enc[1]) < ( + if (via1.dymax - via1.dymin + 2 * m_enc[1]) < ( via_size[1] + 2 * via_enc[1] ) and metal_level >= 3: m2_y = via_size[1] + 2 * via_enc[1] else: - m2_y = via1.ymax - via1.ymin + 2 * m_enc[1] + m2_y = via1.dymax - via1.dymin + 2 * m_enc[1] - m2_mx = (m2_x - (via1.xmax - via1.xmin)) / 2 - m2_my = (m2_y - (via1.ymax - via1.ymin)) / 2 + m2_mx = (m2_x - (via1.dxmax - via1.dxmin)) / 2 + m2_my = (m2_y - (via1.dymax - via1.dymin)) / 2 m2 = c.add_ref( gf.components.rectangle(size=(m2_x, m2_y), layer=layer["metal2"]) ) - m2.move((via1.xmin - m2_mx, via1.ymin - m2_my)) + m2.dmove((via1.dxmin - m2_mx, via1.dymin - m2_my)) return c diff --git a/gf180/diode.py b/gf180/diode.py index 4ae4127..73e3b8b 100644 --- a/gf180/diode.py +++ b/gf180/diode.py @@ -57,20 +57,20 @@ def diode_nd2ps( layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp diode_mk = c.add_ref( gf.components.rectangle( size=(ncmp.size[0], ncmp.size[1]), layer=layer["diode_mk"] ) ) - diode_mk.xmin = ncmp.xmin - diode_mk.ymin = ncmp.ymin + diode_mk.dxmin = ncmp.dxmin + diode_mk.dymin = ncmp.dymin ncmp_con = c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -78,7 +78,7 @@ def diode_nd2ps( # p generation pcmp = c.add_ref(gf.components.rectangle(size=(cw, la), layer=layer["comp"])) - pcmp.xmax = ncmp.xmin - comp_spacing + pcmp.dxmax = ncmp.dxmin - comp_spacing pplus = c.add_ref( gf.components.rectangle( size=( @@ -88,13 +88,13 @@ def diode_nd2ps( layer=layer["pplus"], ) ) - pplus.xmin = pcmp.xmin - pp_enc_comp - pplus.ymin = pcmp.ymin - pp_enc_comp + pplus.dxmin = pcmp.dxmin - pp_enc_comp + pplus.dymin = pcmp.dymin - pp_enc_comp pcmp_con = c.add_ref( via_stack( - x_range=(pcmp.xmin, pcmp.xmax), - y_range=(pcmp.ymin, pcmp.ymax), + x_range=(pcmp.dxmin, pcmp.dxmax), + y_range=(pcmp.dymin, pcmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -106,8 +106,8 @@ def diode_nd2ps( c.add_label( n_label, position=( - ncmp_con.xmin + (ncmp_con.size[0] / 2), - ncmp_con.ymin + (ncmp_con.size[1] / 2), + ncmp_con.dxmin + (ncmp_con.size[0] / 2), + ncmp_con.dymin + (ncmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -116,8 +116,8 @@ def diode_nd2ps( c.add_label( p_label, position=( - pcmp_con.xmin + (pcmp_con.size[0] / 2), - pcmp_con.ymin + (pcmp_con.size[1] / 2), + pcmp_con.dxmin + (pcmp_con.size[0] / 2), + pcmp_con.dymin + (pcmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -126,28 +126,28 @@ def diode_nd2ps( dg = c.add_ref( gf.components.rectangle( size=( - ncmp.xmax - pcmp.xmin + (2 * dg_enc_cmp), + ncmp.dxmax - pcmp.dxmin + (2 * dg_enc_cmp), ncmp.size[1] + (2 * dg_enc_cmp), ), layer=layer["dualgate"], ) ) - dg.xmin = pcmp.xmin - dg_enc_cmp - dg.ymin = pcmp.ymin - dg_enc_cmp + dg.dxmin = pcmp.dxmin - dg_enc_cmp + dg.dymin = pcmp.dymin - dg_enc_cmp if deepnwell == 1: lvpwell = c.add_ref( gf.components.rectangle( size=( - ncmp.xmax - pcmp.xmin + (lvpwell_enc_ncmp + lvpwell_enc_pcmp), + ncmp.dxmax - pcmp.dxmin + (lvpwell_enc_ncmp + lvpwell_enc_pcmp), ncmp.size[1] + (2 * lvpwell_enc_ncmp), ), layer=layer["lvpwell"], ) ) - lvpwell.xmin = pcmp.xmin - lvpwell_enc_pcmp - lvpwell.ymin = ncmp.ymin - lvpwell_enc_ncmp + lvpwell.dxmin = pcmp.dxmin - lvpwell_enc_pcmp + lvpwell.dymin = ncmp.dymin - lvpwell_enc_ncmp dn_rect = c.add_ref( gf.components.rectangle( @@ -159,33 +159,35 @@ def diode_nd2ps( ) ) - dn_rect.xmin = lvpwell.xmin - dn_enc_lvpwell - dn_rect.ymin = lvpwell.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvpwell.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvpwell.dymin - dn_enc_lvpwell if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + rect_pcmpgr_out.dmove( + (rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw) + ) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -198,31 +200,33 @@ def diode_nd2ps( psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * pp_enc_comp, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + pp_enc_comp, - rect_pcmpgr_in.ymin + pp_enc_comp, + rect_pcmpgr_in.dxmin + pp_enc_comp, + rect_pcmpgr_in.dymin + pp_enc_comp, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * pp_enc_comp, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + + 2 * pp_enc_comp, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - pp_enc_comp, - rect_pcmpgr_out.ymin - pp_enc_comp, + rect_pcmpgr_out.dxmin - pp_enc_comp, + rect_pcmpgr_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -236,10 +240,10 @@ def diode_nd2ps( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -250,10 +254,10 @@ def diode_nd2ps( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -263,10 +267,10 @@ def diode_nd2ps( c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -277,10 +281,10 @@ def diode_nd2ps( c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -305,7 +309,7 @@ def diode_nd2ps( layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -368,20 +372,20 @@ def diode_pd2nw( layer=layer["pplus"], ) ) - pplus.xmin = pcmp.xmin - pp_enc_comp - pplus.ymin = pcmp.ymin - pp_enc_comp + pplus.dxmin = pcmp.dxmin - pp_enc_comp + pplus.dymin = pcmp.dymin - pp_enc_comp diode_mk = c.add_ref( gf.components.rectangle( size=(pcmp.size[0], pcmp.size[1]), layer=layer["diode_mk"] ) ) - diode_mk.xmin = pcmp.xmin - diode_mk.ymin = pcmp.ymin + diode_mk.dxmin = pcmp.dxmin + diode_mk.dymin = pcmp.dymin pcmp_con = c.add_ref( via_stack( - x_range=(pcmp.xmin, pcmp.xmax), - y_range=(pcmp.ymin, pcmp.ymax), + x_range=(pcmp.dxmin, pcmp.dxmax), + y_range=(pcmp.dymin, pcmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -389,7 +393,7 @@ def diode_pd2nw( # n generation ncmp = c.add_ref(gf.components.rectangle(size=(cw, la), layer=layer["comp"])) - ncmp.xmax = pcmp.xmin - comp_spacing + ncmp.dxmax = pcmp.dxmin - comp_spacing nplus = c.add_ref( gf.components.rectangle( size=( @@ -399,13 +403,13 @@ def diode_pd2nw( layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp ncmp_con = c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -417,8 +421,8 @@ def diode_pd2nw( c.add_label( n_label, position=( - ncmp_con.xmin + (ncmp_con.size[0] / 2), - ncmp_con.ymin + (ncmp_con.size[1] / 2), + ncmp_con.dxmin + (ncmp_con.size[0] / 2), + ncmp_con.dymin + (ncmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -427,8 +431,8 @@ def diode_pd2nw( c.add_label( p_label, position=( - pcmp_con.xmin + (pcmp_con.size[0] / 2), - pcmp_con.ymin + (pcmp_con.size[1] / 2), + pcmp_con.dxmin + (pcmp_con.size[0] / 2), + pcmp_con.dymin + (pcmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -437,28 +441,28 @@ def diode_pd2nw( dg = c.add_ref( gf.components.rectangle( size=( - pcmp.xmax - ncmp.xmin + (2 * dg_enc_cmp), + pcmp.dxmax - ncmp.dxmin + (2 * dg_enc_cmp), ncmp.size[1] + (2 * dg_enc_cmp), ), layer=layer["dualgate"], ) ) - dg.xmin = ncmp.xmin - dg_enc_cmp - dg.ymin = ncmp.ymin - dg_enc_cmp + dg.dxmin = ncmp.dxmin - dg_enc_cmp + dg.dymin = ncmp.dymin - dg_enc_cmp # nwell generation nwell = c.add_ref( gf.components.rectangle( size=( - pcmp.xmax - ncmp.xmin + (nwell_ncmp_enc + nwell_pcmp_enc), + pcmp.dxmax - ncmp.dxmin + (nwell_ncmp_enc + nwell_pcmp_enc), pcmp.size[1] + (2 * nwell_pcmp_enc), ), layer=layer["nwell"], ) ) - nwell.xmin = ncmp.xmin - nwell_ncmp_enc - nwell.ymin = pcmp.ymin - nwell_pcmp_enc + nwell.dxmin = ncmp.dxmin - nwell_ncmp_enc + nwell.dymin = pcmp.dymin - nwell_pcmp_enc if deepnwell == 1: dn_rect = c.add_ref( @@ -471,33 +475,35 @@ def diode_pd2nw( ) ) - dn_rect.xmin = nwell.xmin - dn_enc_nwell - dn_rect.ymin = nwell.ymin - dn_enc_nwell + dn_rect.dxmin = nwell.dxmin - dn_enc_nwell + dn_rect.dymin = nwell.dymin - dn_enc_nwell if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + rect_pcmpgr_out.dmove( + (rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw) + ) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -510,31 +516,33 @@ def diode_pd2nw( psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * pp_enc_comp, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + pp_enc_comp, - rect_pcmpgr_in.ymin + pp_enc_comp, + rect_pcmpgr_in.dxmin + pp_enc_comp, + rect_pcmpgr_in.dymin + pp_enc_comp, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * pp_enc_comp, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + + 2 * pp_enc_comp, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - pp_enc_comp, - rect_pcmpgr_out.ymin - pp_enc_comp, + rect_pcmpgr_out.dxmin - pp_enc_comp, + rect_pcmpgr_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -548,10 +556,10 @@ def diode_pd2nw( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -562,10 +570,10 @@ def diode_pd2nw( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -575,10 +583,10 @@ def diode_pd2nw( c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -589,10 +597,10 @@ def diode_pd2nw( c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -617,7 +625,7 @@ def diode_pd2nw( layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -670,15 +678,15 @@ def diode_nw2ps( layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp diode_mk = c.add_ref( gf.components.rectangle( size=(ncmp.size[0], ncmp.size[1]), layer=layer["diode_mk"] ) ) - diode_mk.xmin = ncmp.xmin - diode_mk.ymin = ncmp.ymin + diode_mk.dxmin = ncmp.dxmin + diode_mk.dymin = ncmp.dymin nwell = c.add_ref( gf.components.rectangle( @@ -689,13 +697,13 @@ def diode_nw2ps( layer=layer["nwell"], ) ) - nwell.xmin = ncmp.xmin - nwell_ncmp_enc - nwell.ymin = ncmp.ymin - nwell_ncmp_enc + nwell.dxmin = ncmp.dxmin - nwell_ncmp_enc + nwell.dymin = ncmp.dymin - nwell_ncmp_enc n_con = c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -703,7 +711,7 @@ def diode_nw2ps( # p generation pcmp = c.add_ref(gf.components.rectangle(size=(cw, la), layer=layer["comp"])) - pcmp.xmax = ncmp.xmin - comp_spacing + pcmp.dxmax = ncmp.dxmin - comp_spacing pplus = c.add_ref( gf.components.rectangle( size=( @@ -713,13 +721,13 @@ def diode_nw2ps( layer=layer["pplus"], ) ) - pplus.xmin = pcmp.xmin - pp_enc_comp - pplus.ymin = pcmp.ymin - pp_enc_comp + pplus.dxmin = pcmp.dxmin - pp_enc_comp + pplus.dymin = pcmp.dymin - pp_enc_comp p_con = c.add_ref( via_stack( - x_range=(pcmp.xmin, pcmp.xmax), - y_range=(pcmp.ymin, pcmp.ymax), + x_range=(pcmp.dxmin, pcmp.dxmax), + y_range=(pcmp.dymin, pcmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -731,8 +739,8 @@ def diode_nw2ps( c.add_label( n_label, position=( - n_con.xmin + (n_con.size[0] / 2), - n_con.ymin + (n_con.size[1] / 2), + n_con.dxmin + (n_con.size[0] / 2), + n_con.dymin + (n_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -741,8 +749,8 @@ def diode_nw2ps( c.add_label( p_label, position=( - p_con.xmin + (p_con.size[0] / 2), - p_con.ymin + (p_con.size[1] / 2), + p_con.dxmin + (p_con.size[0] / 2), + p_con.dymin + (p_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -751,14 +759,14 @@ def diode_nw2ps( dg = c.add_ref( gf.components.rectangle( size=( - ncmp.xmax - pcmp.xmin + (2 * dg_enc_cmp), + ncmp.dxmax - pcmp.dxmin + (2 * dg_enc_cmp), ncmp.size[1] + (2 * dg_enc_cmp), ), layer=layer["dualgate"], ) ) - dg.xmin = pcmp.xmin - dg_enc_cmp - dg.ymin = pcmp.ymin - dg_enc_cmp + dg.dxmin = pcmp.dxmin - dg_enc_cmp + dg.dymin = pcmp.dymin - dg_enc_cmp return c @@ -816,15 +824,15 @@ def diode_pw2dw( layer=layer["pplus"], ) ) - pplus.xmin = pcmp.xmin - pp_enc_comp - pplus.ymin = pcmp.ymin - pp_enc_comp + pplus.dxmin = pcmp.dxmin - pp_enc_comp + pplus.dymin = pcmp.dymin - pp_enc_comp diode_mk = c.add_ref( gf.components.rectangle( size=(pcmp.size[0], pcmp.size[1]), layer=layer["diode_mk"] ) ) - diode_mk.xmin = pcmp.xmin - diode_mk.ymin = pcmp.ymin + diode_mk.dxmin = pcmp.dxmin + diode_mk.dymin = pcmp.dymin lvpwell = c.add_ref( gf.components.rectangle( @@ -835,13 +843,13 @@ def diode_pw2dw( layer=layer["lvpwell"], ) ) - lvpwell.xmin = pcmp.xmin - lvpwell_enc_pcmp - lvpwell.ymin = pcmp.ymin - lvpwell_enc_pcmp + lvpwell.dxmin = pcmp.dxmin - lvpwell_enc_pcmp + lvpwell.dymin = pcmp.dymin - lvpwell_enc_pcmp p_con = c.add_ref( via_stack( - x_range=(pcmp.xmin, pcmp.xmax), - y_range=(pcmp.ymin, pcmp.ymax), + x_range=(pcmp.dxmin, pcmp.dxmax), + y_range=(pcmp.dymin, pcmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -849,7 +857,7 @@ def diode_pw2dw( # n generation ncmp = c.add_ref(gf.components.rectangle(size=(cw, la), layer=layer["comp"])) - ncmp.xmax = pcmp.xmin - comp_spacing + ncmp.dxmax = pcmp.dxmin - comp_spacing nplus = c.add_ref( gf.components.rectangle( size=( @@ -859,13 +867,13 @@ def diode_pw2dw( layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp n_con = c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -877,8 +885,8 @@ def diode_pw2dw( c.add_label( n_label, position=( - n_con.xmin + (n_con.size[0] / 2), - n_con.ymin + (n_con.size[1] / 2), + n_con.dxmin + (n_con.size[0] / 2), + n_con.dymin + (n_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -887,8 +895,8 @@ def diode_pw2dw( c.add_label( p_label, position=( - p_con.xmin + (p_con.size[0] / 2), - p_con.ymin + (p_con.size[1] / 2), + p_con.dxmin + (p_con.size[0] / 2), + p_con.dymin + (p_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -903,33 +911,33 @@ def diode_pw2dw( ) ) - dn_rect.xmin = lvpwell.xmin - dn_enc_lvpwell - dn_rect.ymin = lvpwell.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvpwell.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvpwell.dymin - dn_enc_lvpwell if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + rect_pcmpgr_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -942,31 +950,31 @@ def diode_pw2dw( psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * pp_enc_comp, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + pp_enc_comp, - rect_pcmpgr_in.ymin + pp_enc_comp, + rect_pcmpgr_in.dxmin + pp_enc_comp, + rect_pcmpgr_in.dymin + pp_enc_comp, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * pp_enc_comp, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - pp_enc_comp, - rect_pcmpgr_out.ymin - pp_enc_comp, + rect_pcmpgr_out.dxmin - pp_enc_comp, + rect_pcmpgr_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -980,10 +988,10 @@ def diode_pw2dw( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -994,10 +1002,10 @@ def diode_pw2dw( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1007,10 +1015,10 @@ def diode_pw2dw( c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1021,10 +1029,10 @@ def diode_pw2dw( c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1049,7 +1057,7 @@ def diode_pw2dw( layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -1069,8 +1077,8 @@ def diode_pw2dw( layer=layer["dualgate"], ) ) - dg.xmin = dn_rect.xmin - dg_enc_dn - dg.ymin = dn_rect.ymin - dg_enc_dn + dg.dxmin = dn_rect.dxmin - dg_enc_dn + dg.dymin = dn_rect.dymin - dg_enc_dn return c @@ -1123,8 +1131,8 @@ def diode_dw2ps( n_con = c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1139,8 +1147,8 @@ def diode_dw2ps( layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp else: c_temp = gf.Component("temp_store guard ring") ncmp_in = c_temp.add_ref( @@ -1155,7 +1163,7 @@ def diode_dw2ps( layer=layer["comp"], ) ) - ncmp_out.move((ncmp_in.xmin - cw, ncmp_in.ymin - cw)) + ncmp_out.dmove((ncmp_in.dxmin - cw, ncmp_in.dymin - cw)) ncmp = c.add_ref( gf.geometry.boolean( A=ncmp_out, @@ -1168,31 +1176,31 @@ def diode_dw2ps( pplus_in = c_temp.add_ref( gf.components.rectangle( size=( - (ncmp_in.xmax - ncmp_in.xmin) - 2 * pp_enc_comp, - (ncmp_in.ymax - ncmp_in.ymin) - 2 * pp_enc_comp, + (ncmp_in.dxmax - ncmp_in.dxmin) - 2 * pp_enc_comp, + (ncmp_in.dymax - ncmp_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - pplus_in.move( + pplus_in.dmove( ( - ncmp_in.xmin + pp_enc_comp, - ncmp_in.ymin + pp_enc_comp, + ncmp_in.dxmin + pp_enc_comp, + ncmp_in.dymin + pp_enc_comp, ) ) pplus_out = c_temp.add_ref( gf.components.rectangle( size=( - (ncmp_out.xmax - ncmp_out.xmin) + 2 * pp_enc_comp, - (ncmp_out.ymax - ncmp_out.ymin) + 2 * pp_enc_comp, + (ncmp_out.dxmax - ncmp_out.dxmin) + 2 * pp_enc_comp, + (ncmp_out.dymax - ncmp_out.dymin) + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - pplus_out.move( + pplus_out.dmove( ( - ncmp_out.xmin - pp_enc_comp, - ncmp_out.ymin - pp_enc_comp, + ncmp_out.dxmin - pp_enc_comp, + ncmp_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -1206,10 +1214,10 @@ def diode_dw2ps( c.add_ref( via_generator( x_range=( - ncmp_in.xmin + con_size, - ncmp_in.xmax - con_size, + ncmp_in.dxmin + con_size, + ncmp_in.dxmax - con_size, ), - y_range=(ncmp_out.ymin, ncmp_in.ymin), + y_range=(ncmp_out.dymin, ncmp_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1220,10 +1228,10 @@ def diode_dw2ps( c.add_ref( via_generator( x_range=( - ncmp_in.xmin + con_size, - ncmp_in.xmax - con_size, + ncmp_in.dxmin + con_size, + ncmp_in.dxmax - con_size, ), - y_range=(ncmp_in.ymax, ncmp_out.ymax), + y_range=(ncmp_in.dymax, ncmp_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1233,10 +1241,10 @@ def diode_dw2ps( n_con = c.add_ref( via_generator( - x_range=(ncmp_out.xmin, ncmp_in.xmin), + x_range=(ncmp_out.dxmin, ncmp_in.dxmin), y_range=( - ncmp_in.ymin + con_size, - ncmp_in.ymax - con_size, + ncmp_in.dymin + con_size, + ncmp_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1247,10 +1255,10 @@ def diode_dw2ps( c.add_ref( via_generator( - x_range=(ncmp_in.xmax, ncmp_out.xmax), + x_range=(ncmp_in.dxmax, ncmp_out.dxmax), y_range=( - ncmp_in.ymin + con_size, - ncmp_in.ymax - con_size, + ncmp_in.dymin + con_size, + ncmp_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1275,7 +1283,7 @@ def diode_dw2ps( layer=layer["metal1"], ) ) - comp_m1_out.move((ncmp_in.xmin - cw, ncmp_in.ymin - cw)) + comp_m1_out.dmove((ncmp_in.dxmin - cw, ncmp_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=ncmp_out, @@ -1291,8 +1299,8 @@ def diode_dw2ps( c.add_label( n_label, position=( - n_con.xmin + (n_con.size[0] / 2), - n_con.ymin + (n_con.size[1] / 2), + n_con.dxmin + (n_con.size[0] / 2), + n_con.dymin + (n_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -1308,41 +1316,41 @@ def diode_dw2ps( layer=layer["dnwell"], ) ) - dn_rect.xmin = ncmp.xmin - dn_enc_ncmp - dn_rect.ymin = ncmp.ymin - dn_enc_ncmp + dn_rect.dxmin = ncmp.dxmin - dn_enc_ncmp + dn_rect.dymin = ncmp.dymin - dn_enc_ncmp diode_mk = c.add_ref( gf.components.rectangle( size=(dn_rect.size[0], dn_rect.size[1]), layer=layer["diode_mk"] ) ) - diode_mk.xmin = dn_rect.xmin - diode_mk.ymin = dn_rect.ymin + diode_mk.dxmin = dn_rect.dxmin + diode_mk.dymin = dn_rect.dymin if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + rect_pcmpgr_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -1355,31 +1363,31 @@ def diode_dw2ps( psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * pp_enc_comp, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + pp_enc_comp, - rect_pcmpgr_in.ymin + pp_enc_comp, + rect_pcmpgr_in.dxmin + pp_enc_comp, + rect_pcmpgr_in.dymin + pp_enc_comp, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * pp_enc_comp, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - pp_enc_comp, - rect_pcmpgr_out.ymin - pp_enc_comp, + rect_pcmpgr_out.dxmin - pp_enc_comp, + rect_pcmpgr_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -1393,10 +1401,10 @@ def diode_dw2ps( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1407,10 +1415,10 @@ def diode_dw2ps( c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1420,10 +1428,10 @@ def diode_dw2ps( p_con = c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1434,10 +1442,10 @@ def diode_dw2ps( c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1452,8 +1460,8 @@ def diode_dw2ps( c.add_label( p_label, position=( - p_con.xmin + (p_con.size[0] / 2), - p_con.ymin + (p_con.size[1] / 2), + p_con.dxmin + (p_con.size[0] / 2), + p_con.dymin + (p_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -1468,13 +1476,13 @@ def diode_dw2ps( comp_m1_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -1496,8 +1504,8 @@ def diode_dw2ps( layer=layer["dualgate"], ) ) - dg.xmin = dn_rect.xmin - dg_enc_dn - dg.ymin = dn_rect.ymin - dg_enc_dn + dg.dxmin = dn_rect.dxmin - dg_enc_dn + dg.dymin = dn_rect.dymin - dg_enc_dn return c @@ -1558,13 +1566,13 @@ def sc_cathode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: layer=layer["nplus"], ) ) - nplus.xmin = ncmp.xmin - np_enc_comp - nplus.ymin = ncmp.ymin - np_enc_comp + nplus.dxmin = ncmp.dxmin - np_enc_comp + nplus.dymin = ncmp.dymin - np_enc_comp c.add_ref( via_stack( - x_range=(ncmp.xmin, ncmp.xmax), - y_range=(ncmp.ymin, ncmp.ymax), + x_range=(ncmp.dxmin, ncmp.dxmax), + y_range=(ncmp.dymin, ncmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1584,8 +1592,8 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: cmp = c.add_ref(gf.components.rectangle(size=size, layer=layer["comp"])) c.add_ref( via_stack( - x_range=(cmp.xmin, cmp.xmax), - y_range=(cmp.ymin, cmp.ymax), + x_range=(cmp.dxmin, cmp.dxmax), + y_range=(cmp.dymin, cmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1602,15 +1610,15 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: spacing=((cw + wa + (2 * sc_comp_spacing)), 0), ) - cath_m1_xmin = sc_cathode.xmin - cath_m1_ymin = sc_cathode.ymin - cath_m1_xmax = sc_cathode.xmax + cath_m1_xmin = sc_cathode.dxmin + cath_m1_ymin = sc_cathode.dymin + cath_m1_xmax = sc_cathode.dxmax cath_m1_v = c.add_array( component=gf.components.rectangle( size=( cath_m1_xmax - cath_m1_xmin, - cath_m1_ymin - sc_cathode.ymin + m1_w, + cath_m1_ymin - sc_cathode.dymin + m1_w, ), layer=layer["metal1"], ), @@ -1619,21 +1627,21 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: spacing=((cw + wa + (2 * sc_comp_spacing)), 0), ) - cath_m1_v.xmin = cath_m1_xmin - cath_m1_v.ymax = cath_m1_ymin + cath_m1_v.dxmin = cath_m1_xmin + cath_m1_v.dymax = cath_m1_ymin cath_m1_h = c.add_ref( gf.components.rectangle(size=(cath_m1_v.size[0], m1_w), layer=layer["metal1"]) ) - cath_m1_h.xmin = cath_m1_v.xmin - cath_m1_h.ymax = cath_m1_v.ymin + cath_m1_h.dxmin = cath_m1_v.dxmin + cath_m1_h.dymax = cath_m1_v.dymin # cathode label generation if label == 1: c.add_label( n_label, position=( - cath_m1_h.xmin + (cath_m1_h.size[0] / 2), - cath_m1_h.ymin + (cath_m1_h.size[1] / 2), + cath_m1_h.dxmin + (cath_m1_h.size[0] / 2), + cath_m1_h.dymin + (cath_m1_h.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -1645,18 +1653,18 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: spacing=(wa + cw + (2 * sc_comp_spacing), 0), ) - sc_anode.xmin = sc_cathode.xmin + (cw + sc_comp_spacing) - an_m1_xmin = sc_anode.xmin - an_m1_ymin = sc_anode.ymin - an_m1_xmax = sc_anode.xmax - an_m1_ymax = sc_anode.ymax + sc_anode.dxmin = sc_cathode.dxmin + (cw + sc_comp_spacing) + an_m1_xmin = sc_anode.dxmin + an_m1_ymin = sc_anode.dymin + an_m1_xmax = sc_anode.dxmax + an_m1_ymax = sc_anode.dymax if m > 1: an_m1_v = c.add_array( component=gf.components.rectangle( size=( an_m1_xmax - an_m1_xmin, - cath_m1_ymin - sc_an.ymin + m1_w, + cath_m1_ymin - sc_an.dymin + m1_w, ), layer=layer["metal1"], ), @@ -1665,22 +1673,22 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: spacing=((cw + wa + (2 * sc_comp_spacing)), 0), ) - an_m1_v.xmin = an_m1_xmin - an_m1_v.ymin = an_m1_ymax + an_m1_v.dxmin = an_m1_xmin + an_m1_v.dymin = an_m1_ymax an_m1_h = c.add_ref( gf.components.rectangle(size=(an_m1_v.size[0], m1_w), layer=layer["metal1"]) ) - an_m1_h.xmin = an_m1_v.xmin - an_m1_h.ymin = an_m1_v.ymax + an_m1_h.dxmin = an_m1_v.dxmin + an_m1_h.dymin = an_m1_v.dymax # anode label generation if label == 1: c.add_label( p_label, position=( - an_m1_h.xmin + (an_m1_h.size[0] / 2), - an_m1_h.ymin + (an_m1_h.size[1] / 2), + an_m1_h.dxmin + (an_m1_h.size[0] / 2), + an_m1_h.dymin + (an_m1_h.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -1707,8 +1715,8 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: layer=layer["schottky_diode"], ) ) - diode_mk.xmin = sc_cathode.xmin - sc_enc_comp - diode_mk.ymin = sc_cathode.ymin - sc_enc_comp + diode_mk.dxmin = sc_cathode.dxmin - sc_enc_comp + diode_mk.dymin = sc_cathode.dymin - sc_enc_comp # dnwell dn_rect = c.add_ref( @@ -1720,33 +1728,33 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: layer=layer["dnwell"], ) ) - dn_rect.xmin = sc_anode.xmin - dn_enc_sc_an - dn_rect.ymin = sc_anode.ymin - dn_enc_sc_an + dn_rect.dxmin = sc_anode.dxmin - dn_enc_sc_an + dn_rect.dymin = sc_anode.dymin - dn_enc_sc_an if pcmpgr == 1: c_temp_gr = gf.Component("temp_store guard ring") rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move( - (dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn) + rect_pcmpgr_in.dmove( + (dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn) ) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * cw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * cw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * cw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * cw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + rect_pcmpgr_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -1759,31 +1767,31 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * pp_enc_comp, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * pp_enc_comp, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + pp_enc_comp, - rect_pcmpgr_in.ymin + pp_enc_comp, + rect_pcmpgr_in.dxmin + pp_enc_comp, + rect_pcmpgr_in.dymin + pp_enc_comp, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * pp_enc_comp, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + 2 * pp_enc_comp, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + 2 * pp_enc_comp, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - pp_enc_comp, - rect_pcmpgr_out.ymin - pp_enc_comp, + rect_pcmpgr_out.dxmin - pp_enc_comp, + rect_pcmpgr_out.dymin - pp_enc_comp, ) ) c.add_ref( @@ -1796,10 +1804,10 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1810,10 +1818,10 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -1823,10 +1831,10 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1837,10 +1845,10 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -1865,7 +1873,7 @@ def sc_anode_strap(size: Float2 = (0.1, 0.1)) -> gf.Component: layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - cw, rect_pcmpgr_in.ymin - cw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - cw, rect_pcmpgr_in.dymin - cw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, diff --git a/gf180/fet.py b/gf180/fet.py index 28ff641..d29be75 100644 --- a/gf180/fet.py +++ b/gf180/fet.py @@ -127,13 +127,13 @@ def alter_interdig( pat_o.append(pat[i]) nt = [] - [nt.append(x) for x in pat if x not in nt] + [nt.append(dx) for dx in pat if dx not in nt] nt_o = [] - [nt_o.append(x) for x in pat_o if x not in nt_o] + [nt_o.append(dx) for dx in pat_o if dx not in nt_o] nt_e = [] - [nt_e.append(x) for x in pat_e if x not in nt_e] + [nt_e.append(dx) for dx in pat_e if dx not in nt_e] nl = len(nt) nl_b = len(nt_e) @@ -144,7 +144,7 @@ def alter_interdig( m2_y = via_size[1] + 2 * via_enc[1] m2 = gf.components.rectangle( - size=(sd_diff.xmax - sd_diff.xmin, m2_y), + size=(sd_diff.dxmax - sd_diff.dxmin, m2_y), layer=layer["metal2"], ) @@ -154,7 +154,7 @@ def alter_interdig( rows=nl_b, spacing=(0, -m2_y - m2_spacing), ) - m2_arrb.movey(pc1.ymin - m2_spacing - m2_y) + m2_arrb.dmovey(pc1.dymin - m2_spacing - m2_y) m2_arru = c_inst.add_array( component=m2, @@ -162,7 +162,7 @@ def alter_interdig( rows=nl_u, spacing=(0, m2_y + m2_spacing), ) - m2_arru.movey(pc2.ymax + m2_spacing) + m2_arru.dmovey(pc2.dymax + m2_spacing) for i in range(nl_u): for j in range(floor(nf / 2)): @@ -171,19 +171,19 @@ def alter_interdig( gf.components.rectangle( size=( pc_x, - ((pc2.ymax + (i + 1) * (m2_spacing + m2_y)) - pc2.ymin), + ((pc2.dymax + (i + 1) * (m2_spacing + m2_y)) - pc2.dymin), ), layer=layer["metal1"], ) ) - m1.xmin = pc2.xmin + j * (pc_spacing) - m1.ymin = pc2.ymin + m1.dxmin = pc2.dxmin + j * (pc_spacing) + m1.dymin = pc2.dymin via1_dr = via_generator( - x_range=(m1.xmin, m1.xmax), + x_range=(m1.dxmin, m1.dxmax), y_range=( - m2_arru.ymin + i * (m2_y + m2_spacing), - m2_arru.ymin + i * (m2_y + m2_spacing) + m2_y, + m2_arru.dymin + i * (m2_y + m2_spacing), + m2_arru.dymin + i * (m2_y + m2_spacing) + m2_y, ), via_enclosure=via_enc, via_layer=layer["via1"], @@ -196,8 +196,8 @@ def alter_interdig( labels_gen( label_str="None", position=( - (via1.xmax + via1.xmin) / 2, - (via1.ymax + via1.ymin) / 2, + (via1.dxmax + via1.dxmin) / 2, + (via1.dymax + via1.dymin) / 2, ), layer=layer["metal2_label"], label=patt_label, @@ -212,8 +212,8 @@ def alter_interdig( labels_gen( label_str="None", position=( - m1.xmin + (m1.size[0] / 2), - pc2.ymin + (pc2.size[1] / 2), + m1.dxmin + (m1.size[0] / 2), + pc2.dymin + (pc2.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -229,20 +229,20 @@ def alter_interdig( m1 = c_inst.add_ref( gf.components.rectangle( size=( - # poly_con.xmax - poly_con.xmin, + # poly_con.dxmax - poly_con.dxmin, pc_x, - ((pc1.ymax + (i + 1) * (m2_spacing + m2_y)) - pc1.ymin), + ((pc1.dymax + (i + 1) * (m2_spacing + m2_y)) - pc1.dymin), ), layer=layer["metal1"], ) ) - m1.xmin = pc1.xmin + j * (pc_spacing) - m1.ymin = -(m1.ymax - m1.ymin) + (pc1.ymax) + m1.dxmin = pc1.dxmin + j * (pc_spacing) + m1.dymin = -(m1.dymax - m1.dymin) + (pc1.dymax) via1_dr = via_generator( - x_range=(m1.xmin, m1.xmax), + x_range=(m1.dxmin, m1.dxmax), y_range=( - m2_arrb.ymax - i * (m2_spacing + m2_y) - m2_y, - m2_arrb.ymax - i * (m2_spacing + m2_y), + m2_arrb.dymax - i * (m2_spacing + m2_y) - m2_y, + m2_arrb.dymax - i * (m2_spacing + m2_y), ), via_enclosure=via_enc, via_layer=layer["via1"], @@ -255,8 +255,8 @@ def alter_interdig( labels_gen( label_str="None", position=( - (via1.xmax + via1.xmin) / 2, - (via1.ymax + via1.ymin) / 2, + (via1.dxmax + via1.dxmin) / 2, + (via1.dymax + via1.dymin) / 2, ), layer=layer["metal2_label"], label=patt_label, @@ -271,8 +271,8 @@ def alter_interdig( labels_gen( label_str="None", position=( - m1.xmin + (m1.size[0] / 2), - pc1.ymin + (pc1.size[1] / 2), + m1.dxmin + (m1.size[0] / 2), + pc1.dymin + (pc1.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -295,11 +295,11 @@ def alter_interdig( m2_y, ), layer=layer["metal2"], - ).move( + ).dmove( ( - m2_arrb.xmin + m2_arrb.dxmin - (m2_y + sd_l + (i + 1) * (m3_spacing + m3_x)), - m2_arrb.ymax - i * (m2_spacing + m2_y) - m2_y, + m2_arrb.dymax - i * (m2_spacing + m2_y) - m2_y, ) ) ) @@ -310,11 +310,11 @@ def alter_interdig( m2_y, ), layer=layer["metal2"], - ).move( + ).dmove( ( - m2_arru.xmin + m2_arru.dxmin - (m2_y + sd_l + (i + 1) * (m3_spacing + m3_x)), - m2_arru.ymin + j * (m2_spacing + m2_y), + m2_arru.dymin + j * (m2_spacing + m2_y), ) ) ) @@ -322,15 +322,15 @@ def alter_interdig( gf.components.rectangle( size=( m3_x, - m2_join_u.ymax - m2_join_b.ymin, + m2_join_u.dymax - m2_join_b.dymin, ), layer=layer["metal1"], ) ) - m3.move((m2_join_b.xmin, m2_join_b.ymin)) + m3.dmove((m2_join_b.dxmin, m2_join_b.dymin)) via2_dr = via_generator( - x_range=(m3.xmin, m3.xmax), - y_range=(m2_join_b.ymin, m2_join_b.ymax), + x_range=(m3.dxmin, m3.dxmax), + y_range=(m2_join_b.dymin, m2_join_b.dymax), via_enclosure=via_enc, via_size=via_size, via_layer=layer["via1"], @@ -342,7 +342,7 @@ def alter_interdig( rows=2, spacing=( 0, - m2_join_u.ymin - m2_join_b.ymin, + m2_join_u.dymin - m2_join_b.dymin, ), ) # via2_draw return c_inst @@ -388,7 +388,7 @@ def interdigit( if nf == len(patt): pat = list(patt) nt = [] # list to store the symbols of transistors and their number nt(number of transistors) - [nt.append(x) for x in pat if x not in nt] + [nt.append(dx) for dx in pat if dx not in nt] nl = int(len(nt)) m2_spacing = 0.28 @@ -398,7 +398,7 @@ def interdigit( m2_y = via_size[1] + 2 * via_enc[1] m2 = gf.components.rectangle( - size=(sd_diff.xmax - sd_diff.xmin, m2_y), layer=layer["metal2"] + size=(sd_diff.dxmax - sd_diff.dxmin, m2_y), layer=layer["metal2"] ) if gate_con_pos == "alternating": @@ -424,9 +424,9 @@ def interdigit( component=m2, columns=1, rows=nl, - spacing=(0, m2.ymax - m2.ymin + m2_spacing), + spacing=(0, m2.dymax - m2.dymin + m2_spacing), ) - m2_arr.movey(pc2.ymax + m2_spacing) + m2_arr.dmovey(pc2.dymax + m2_spacing) for i in range(nl): for j in range(int(nf)): @@ -435,24 +435,24 @@ def interdigit( gf.components.rectangle( size=( pc_x, - # poly_con.xmax - poly_con.xmin, + # poly_con.dxmax - poly_con.dxmin, ( - (pc2.ymax + (i + 1) * (m2_spacing + m2_y)) - - ((1 - j % 2) * pc1.ymin) - - (j % 2) * pc2.ymin + (pc2.dymax + (i + 1) * (m2_spacing + m2_y)) + - ((1 - j % 2) * pc1.dymin) + - (j % 2) * pc2.dymin ), ), layer=layer["metal1"], ) ) - m1.xmin = pc1.xmin + j * (pc2.xmin - pc1.xmin) - m1.ymin = pc1.ymin + m1.dxmin = pc1.dxmin + j * (pc2.dxmin - pc1.dxmin) + m1.dymin = pc1.dymin via1_dr = via_generator( - x_range=(m1.xmin, m1.xmax), + x_range=(m1.dxmin, m1.dxmax), y_range=( - m2_arr.ymin + i * (m2_spacing + m2_y), - m2_arr.ymin + i * (m2_spacing + m2_y) + m2_y, + m2_arr.dymin + i * (m2_spacing + m2_y), + m2_arr.dymin + i * (m2_spacing + m2_y) + m2_y, ), via_enclosure=via_enc, via_layer=layer["via1"], @@ -465,8 +465,8 @@ def interdigit( labels_gen( label_str="None", position=( - (via1.xmax + via1.xmin) / 2, - (via1.ymax + via1.ymin) / 2, + (via1.dxmax + via1.dxmin) / 2, + (via1.dymax + via1.dymin) / 2, ), layer=layer["metal2_label"], label=patt_label, @@ -481,8 +481,8 @@ def interdigit( labels_gen( label_str="None", position=( - m1.xmin + (m1.size[0] / 2), - pc1.ymin + (pc1.size[1] / 2), + m1.dxmin + (m1.size[0] / 2), + pc1.dymin + (pc1.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -499,7 +499,7 @@ def interdigit( rows=nl, spacing=(0, -m2_y - m2_spacing), ) - m2_arr.movey(pc2.ymin - m2_spacing - m2_y) + m2_arr.dmovey(pc2.dymin - m2_spacing - m2_y) for i in range(nl): for j in range(int(nf)): @@ -507,25 +507,25 @@ def interdigit( m1 = c_inst.add_ref( gf.components.rectangle( size=( - # poly_con.xmax - poly_con.xmin, + # poly_con.dxmax - poly_con.dxmin, pc_x, ( - (pc1.ymax + (i + 1) * (m2_spacing + m2_y)) - - (j % 2) * pc1.ymin - - (1 - j % 2) * pc2.ymin + (pc1.dymax + (i + 1) * (m2_spacing + m2_y)) + - (j % 2) * pc1.dymin + - (1 - j % 2) * pc2.dymin ), ), layer=layer["metal1"], ) ) - m1.xmin = pc1.xmin + j * (pc2.xmin - pc1.xmin) - m1.ymax = pc1.ymax + m1.dxmin = pc1.dxmin + j * (pc2.dxmin - pc1.dxmin) + m1.dymax = pc1.dymax via1_dr = via_generator( - x_range=(m1.xmin, m1.xmax), + x_range=(m1.dxmin, m1.dxmax), y_range=( - m2_arr.ymax - i * (m2_spacing + m2_y) - m2_y, - m2_arr.ymax - i * (m2_spacing + m2_y), + m2_arr.dymax - i * (m2_spacing + m2_y) - m2_y, + m2_arr.dymax - i * (m2_spacing + m2_y), ), via_enclosure=via_enc, via_layer=layer["via1"], @@ -538,8 +538,8 @@ def interdigit( labels_gen( label_str="None", position=( - (via1.xmax + via1.xmin) / 2, - (via1.ymax + via1.ymin) / 2, + (via1.dxmax + via1.dxmin) / 2, + (via1.dymax + via1.dymin) / 2, ), layer=layer["metal2_label"], label=patt_label, @@ -554,8 +554,8 @@ def interdigit( labels_gen( label_str="None", position=( - m1.xmin + (m1.size[0] / 2), - pc1.ymin + (pc1.size[1] / 2), + m1.dxmin + (m1.size[0] / 2), + pc1.dymin + (pc1.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -588,8 +588,8 @@ def hv_gen(c, c_inst, volt, dg_encx: float = 0.1, dg_ency: float = 0.1): layer=layer["dualgate"], ) ) - dg.xmin = c_inst.xmin - dg_encx - dg.ymin = c_inst.ymin - dg_ency + dg.dxmin = c_inst.dxmin - dg_encx + dg.dymin = c_inst.dymin - dg_ency if volt == "5V": v5x = c.add_ref( @@ -597,8 +597,8 @@ def hv_gen(c, c_inst, volt, dg_encx: float = 0.1, dg_ency: float = 0.1): size=(dg.size[0], dg.size[1]), layer=layer["v5_xtor"] ) ) - v5x.xmin = dg.xmin - v5x.ymin = dg.ymin + v5x.dxmin = dg.dxmin + v5x.dymin = dg.dymin # return c @@ -643,23 +643,23 @@ def bulk_gr_gen( rect_bulk_in = c_temp.add_ref( gf.components.rectangle( size=( - (c_inst.xmax - c_inst.xmin) + 2 * comp_spacing, - (c_inst.ymax - c_inst.ymin) + 2 * poly2_comp_spacing, + (c_inst.dxmax - c_inst.dxmin) + 2 * comp_spacing, + (c_inst.dymax - c_inst.dymin) + 2 * poly2_comp_spacing, ), layer=layer["comp"], ) ) - rect_bulk_in.move((c_inst.xmin - comp_spacing, c_inst.ymin - poly2_comp_spacing)) + rect_bulk_in.dmove((c_inst.dxmin - comp_spacing, c_inst.dymin - poly2_comp_spacing)) rect_bulk_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) + 2 * grw, - (rect_bulk_in.ymax - rect_bulk_in.ymin) + 2 * grw, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) + 2 * grw, + (rect_bulk_in.dymax - rect_bulk_in.dymin) + 2 * grw, ), layer=layer["comp"], ) ) - rect_bulk_out.move((rect_bulk_in.xmin - grw, rect_bulk_in.ymin - grw)) + rect_bulk_out.dmove((rect_bulk_in.dxmin - grw, rect_bulk_in.dymin - grw)) B = c.add_ref( gf.geometry.boolean( A=rect_bulk_out, @@ -672,26 +672,26 @@ def bulk_gr_gen( psdm_in = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) - 2 * comp_pp_enc, - (rect_bulk_in.ymax - rect_bulk_in.ymin) - 2 * comp_pp_enc, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) - 2 * comp_pp_enc, + (rect_bulk_in.dymax - rect_bulk_in.dymin) - 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_in.move((rect_bulk_in.xmin + comp_pp_enc, rect_bulk_in.ymin + comp_pp_enc)) + psdm_in.dmove((rect_bulk_in.dxmin + comp_pp_enc, rect_bulk_in.dymin + comp_pp_enc)) psdm_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_out.xmax - rect_bulk_out.xmin) + 2 * comp_pp_enc, - (rect_bulk_out.ymax - rect_bulk_out.ymin) + 2 * comp_pp_enc, + (rect_bulk_out.dxmax - rect_bulk_out.dxmin) + 2 * comp_pp_enc, + (rect_bulk_out.dymax - rect_bulk_out.dymin) + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_bulk_out.xmin - comp_pp_enc, - rect_bulk_out.ymin - comp_pp_enc, + rect_bulk_out.dxmin - comp_pp_enc, + rect_bulk_out.dymin - comp_pp_enc, ) ) c.add_ref( @@ -703,10 +703,10 @@ def bulk_gr_gen( c.add_ref( via_generator( x_range=( - rect_bulk_in.xmin + con_size, - rect_bulk_in.xmax - con_size, + rect_bulk_in.dxmin + con_size, + rect_bulk_in.dxmax - con_size, ), - y_range=(rect_bulk_out.ymin, rect_bulk_in.ymin), + y_range=(rect_bulk_out.dymin, rect_bulk_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -717,10 +717,10 @@ def bulk_gr_gen( c.add_ref( via_generator( x_range=( - rect_bulk_in.xmin + con_size, - rect_bulk_in.xmax - con_size, + rect_bulk_in.dxmin + con_size, + rect_bulk_in.dxmax - con_size, ), - y_range=(rect_bulk_in.ymax, rect_bulk_out.ymax), + y_range=(rect_bulk_in.dymax, rect_bulk_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -730,10 +730,10 @@ def bulk_gr_gen( c.add_ref( via_generator( - x_range=(rect_bulk_out.xmin, rect_bulk_in.xmin), + x_range=(rect_bulk_out.dxmin, rect_bulk_in.dxmin), y_range=( - rect_bulk_in.ymin + con_size, - rect_bulk_in.ymax - con_size, + rect_bulk_in.dymin + con_size, + rect_bulk_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -744,10 +744,10 @@ def bulk_gr_gen( c.add_ref( via_generator( - x_range=(rect_bulk_in.xmax, rect_bulk_out.xmax), + x_range=(rect_bulk_in.dxmax, rect_bulk_out.dxmax), y_range=( - rect_bulk_in.ymin + con_size, - rect_bulk_in.ymax - con_size, + rect_bulk_in.dymin + con_size, + rect_bulk_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -760,22 +760,22 @@ def bulk_gr_gen( gf.components.rectangle( size=( (l_d) + 2 * comp_spacing, - (c_inst.ymax - c_inst.ymin) + 2 * poly2_comp_spacing, + (c_inst.dymax - c_inst.dymin) + 2 * poly2_comp_spacing, ), layer=layer["metal1"], ) ) - comp_m1_in.move((-comp_spacing, c_inst.ymin - poly2_comp_spacing)) + comp_m1_in.dmove((-comp_spacing, c_inst.dymin - poly2_comp_spacing)) comp_m1_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) + 2 * grw, - (rect_bulk_in.ymax - rect_bulk_in.ymin) + 2 * grw, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) + 2 * grw, + (rect_bulk_in.dymax - rect_bulk_in.dymin) + 2 * grw, ), layer=layer["metal1"], ) ) - comp_m1_out.move((rect_bulk_in.xmin - grw, rect_bulk_in.ymin - grw)) + comp_m1_out.dmove((rect_bulk_in.dxmin - grw, rect_bulk_in.dymin - grw)) c.add_ref( gf.geometry.boolean( A=rect_bulk_out, @@ -792,8 +792,8 @@ def bulk_gr_gen( labels_gen( label_str=sub_label, position=( - B.xmin + (grw + 2 * (comp_pp_enc)) / 2, - B.ymin + (B.size[1] / 2), + B.dxmin + (grw + 2 * (comp_pp_enc)) / 2, + B.dymin + (B.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -808,8 +808,8 @@ def bulk_gr_gen( deepnwell=deepnwell, pcmpgr=pcmpgr, inst_size=(B.size[0], B.size[1]), - inst_xmin=B.xmin, - inst_ymin=B.ymin, + inst_xmin=B.dxmin, + inst_ymin=B.dymin, grw=grw, ) ) @@ -819,8 +819,8 @@ def bulk_gr_gen( deepnwell=deepnwell, pcmpgr=pcmpgr, enc_size=(B.size[0], B.size[1]), - enc_xmin=B.xmin, - enc_ymin=B.ymin, + enc_xmin=B.dxmin, + enc_ymin=B.dymin, nw_enc_pcmp=nw_enc_pcmp, grw=grw, ) @@ -844,8 +844,8 @@ def nfet_deep_nwell( deepnwell : boolean of having deepnwell pcmpgr : boolean of having deepnwell guardring inst_size : deepnwell enclosed size - inst_xmin : deepnwell enclosed xmin - inst_ymin : deepnwell enclosed ymin + inst_xmin : deepnwell enclosed dxmin + inst_ymin : deepnwell enclosed dymin grw : guardring width """ @@ -865,8 +865,8 @@ def nfet_deep_nwell( ) ) - lvp_rect.xmin = inst_xmin - lvpwell_enc_ncmp - lvp_rect.ymin = inst_ymin - lvpwell_enc_ncmp + lvp_rect.dxmin = inst_xmin - lvpwell_enc_ncmp + lvp_rect.dymin = inst_ymin - lvpwell_enc_ncmp dn_rect = c.add_ref( gf.components.rectangle( @@ -878,8 +878,8 @@ def nfet_deep_nwell( ) ) - dn_rect.xmin = lvp_rect.xmin - dn_enc_lvpwell - dn_rect.ymin = lvp_rect.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvp_rect.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvp_rect.dymin - dn_enc_lvpwell if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=grw)) @@ -915,8 +915,8 @@ def add_inter_sd_labels( labels_gen( label_str="None", position=( - poly1.xmin + l_gate + (inter_sd_l / 2) + i * (l_gate + inter_sd_l), - sd_diff_intr.ymin + (sd_diff_intr.size[1] / 2), + poly1.dxmin + l_gate + (inter_sd_l / 2) + i * (l_gate + inter_sd_l), + sd_diff_intr.dymin + (sd_diff_intr.size[1] / 2), ), layer=label_layer, label=label, @@ -949,8 +949,8 @@ def add_gate_labels(c, g_label, pc1, c_pc, pc_spacing, nc1, nc2, pc2, label, lay labels_gen( label_str="None", position=( - pc1.xmin + (c_pc.size[0] / 2) + i * (pc_spacing), - pc1.ymin + (c_pc.size[1] / 2), + pc1.dxmin + (c_pc.size[0] / 2) + i * (pc_spacing), + pc1.dymin + (c_pc.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -965,8 +965,8 @@ def add_gate_labels(c, g_label, pc1, c_pc, pc_spacing, nc1, nc2, pc2, label, lay labels_gen( label_str="None", position=( - pc2.xmin + (c_pc.size[0] / 2) + i * (pc_spacing), - pc2.ymin + (c_pc.size[1] / 2), + pc2.dxmin + (c_pc.size[0] / 2) + i * (pc_spacing), + pc2.dymin + (c_pc.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -1075,12 +1075,12 @@ def nfet( spacing=(cmpc_size[0] + sd_diff_intr.size[0], 0), ) - sd_diff.xmin = sd_diff_intr.xmin - cmpc_size[0] - sd_diff.ymin = sd_diff_intr.ymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 + sd_diff.dxmin = sd_diff_intr.dxmin - cmpc_size[0] + sd_diff.dymin = sd_diff_intr.dymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 sd_con = via_stack( - x_range=(sd_diff.xmin, sd_diff_intr.xmin), - y_range=(sd_diff.ymin, sd_diff.ymax), + x_range=(sd_diff.dxmin, sd_diff_intr.dxmin), + y_range=(sd_diff.dymin, sd_diff.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1097,8 +1097,8 @@ def nfet( if con_bet_fin == 1 and nf > 1: inter_sd_con = via_stack( x_range=( - sd_diff_intr.xmin + con_comp_enc + l_gate, - sd_diff_intr.xmin + con_comp_enc + l_gate + inter_sd_l, + sd_diff_intr.dxmin + con_comp_enc + l_gate, + sd_diff_intr.dxmin + con_comp_enc + l_gate + inter_sd_l, ), y_range=(0, w_gate), base_layer=layer["comp"], @@ -1115,7 +1115,10 @@ def nfet( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmin + (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmin + (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, labels=sd_label, @@ -1127,7 +1130,10 @@ def nfet( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmax - (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmax - (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, labels=sd_label, @@ -1151,8 +1157,8 @@ def nfet( rect_pc = c_pc.add_ref(gf.components.rectangle(size=pc_size, layer=layer["poly2"])) poly_con = via_stack( - x_range=(rect_pc.xmin, rect_pc.xmax), - y_range=(rect_pc.ymin, rect_pc.ymax), + x_range=(rect_pc.dxmin, rect_pc.dxmax), + y_range=(rect_pc.dymin, rect_pc.dymax), base_layer=layer["poly2"], metal_level=1, li_enc_dir="H", @@ -1165,8 +1171,8 @@ def nfet( size=(l_gate, w_gate + 2 * end_cap), layer=layer["poly2"] ) ) - poly.xmin = sd_diff_intr.xmin + con_comp_enc - poly.ymin = sd_diff_intr.ymin - end_cap + poly.dxmin = sd_diff_intr.dxmin + con_comp_enc + poly.dymin = sd_diff_intr.dymin - end_cap if gate_con_pos == "bottom": mv = 0 @@ -1184,13 +1190,13 @@ def nfet( columns=1, spacing=(0, pc_size[1] + w_gate + 2 * end_cap), ) - pc.move((poly.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) + pc.dmove((poly.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) # gate_lablel c.add_ref( labels_gen( label_str="None", - position=(pc.xmin + c_pc.size[0] / 2, pc.ymin + c_pc.size[1] / 2), + position=(pc.dxmin + c_pc.size[0] / 2, pc.dymin + c_pc.size[1] / 2), layer=layer["metal1_label"], label=label, labels=g_label, @@ -1229,8 +1235,8 @@ def nfet( columns=ceil(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly1.xmin = sd_diff_intr.xmin + con_comp_enc - poly1.ymin = sd_diff_intr.ymin - end_cap - e_c + poly1.dxmin = sd_diff_intr.dxmin + con_comp_enc + poly1.dymin = sd_diff_intr.dymin - end_cap - e_c poly2 = c_inst.add_array( rect_p2, @@ -1238,8 +1244,8 @@ def nfet( columns=floor(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly2.xmin = poly1.xmin + l_gate + inter_sd_l - poly2.ymin = p_mv + poly2.dxmin = poly1.dxmin + l_gate + inter_sd_l + poly2.dymin = p_mv # generating poly contacts setups @@ -1263,14 +1269,14 @@ def nfet( pc1 = c_inst.add_array( component=c_pc, rows=1, columns=nc1, spacing=(pc_spacing, 0) ) - pc1.move((poly1.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) + pc1.dmove((poly1.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) pc2 = c_inst.add_array( component=c_pc, rows=1, columns=nc2, spacing=(pc_spacing, 0) ) - pc2.move( + pc2.dmove( ( - poly1.xmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), + poly1.dxmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), -pc_size[1] - end_cap + mv_2, ) ) @@ -1321,8 +1327,8 @@ def nfet( layer=layer["nplus"], ) ) - nplus.xmin = sd_diff.xmin - comp_np_enc - nplus.ymin = sd_diff_intr.ymin - gate_np_enc + nplus.dxmin = sd_diff.dxmin - comp_np_enc + nplus.dymin = sd_diff_intr.dymin - gate_np_enc elif bulk == "Bulk Tie": rect_bulk = c_inst.add_ref( @@ -1330,33 +1336,33 @@ def nfet( size=(sd_l + con_sp, sd_diff.size[1]), layer=layer["comp"] ) ) - rect_bulk.xmin = sd_diff.xmax - rect_bulk.ymin = sd_diff.ymin + rect_bulk.dxmin = sd_diff.dxmax + rect_bulk.dymin = sd_diff.dymin nsdm = c_inst.add_ref( gf.components.rectangle( size=( - sd_diff.xmax - sd_diff.xmin + comp_np_enc, + sd_diff.dxmax - sd_diff.dxmin + comp_np_enc, w_gate + 2 * gate_np_enc, ), layer=layer["nplus"], ) ) - nsdm.xmin = sd_diff.xmin - comp_np_enc - nsdm.ymin = sd_diff_intr.ymin - gate_np_enc + nsdm.dxmin = sd_diff.dxmin - comp_np_enc + nsdm.dymin = sd_diff_intr.dymin - gate_np_enc psdm = c_inst.add_ref( gf.components.rectangle( size=( - rect_bulk.xmax - rect_bulk.xmin + comp_pp_enc, + rect_bulk.dxmax - rect_bulk.dxmin + comp_pp_enc, w_gate + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm.connect("e1", destination=nsdm.ports["e3"]) + psdm.connect("e1", nsdm.ports["e3"]) bulk_con = via_stack( - x_range=(rect_bulk.xmin + 0.1, rect_bulk.xmax - 0.1), - y_range=(rect_bulk.ymin, rect_bulk.ymax), + x_range=(rect_bulk.dxmin + 0.1, rect_bulk.dxmax - 0.1), + y_range=(rect_bulk.dymin, rect_bulk.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1366,8 +1372,8 @@ def nfet( labels_gen( label_str=sub_label, position=( - bulk_con.xmin + bulk_con.size[0] / 2, - bulk_con.ymin + bulk_con.size[1] / 2, + bulk_con.dxmin + bulk_con.size[0] / 2, + bulk_con.dymin + bulk_con.size[1] / 2, ), layer=layer["metal1_label"], label=label, @@ -1383,8 +1389,8 @@ def nfet( layer=layer["nplus"], ) ) - nsdm.xmin = sd_diff.xmin - comp_np_enc - nsdm.ymin = sd_diff_intr.ymin - gate_np_enc + nsdm.dxmin = sd_diff.dxmin - comp_np_enc + nsdm.dymin = sd_diff_intr.dymin - gate_np_enc c.add_ref(c_inst) # b_gr = c.add_ref( @@ -1408,8 +1414,8 @@ def nfet( c.add_ref(c_inst) inst_size = (c_inst.size[0], c_inst.size[1]) - inst_xmin = c_inst.xmin - inst_ymin = c_inst.ymin + inst_xmin = c_inst.dxmin + inst_ymin = c_inst.dymin # c.add_ref( # hv_gen(c_inst=c_inst, volt=volt, dg_encx=dg_enc_cmp, dg_ency=dg_enc_poly) @@ -1446,8 +1452,8 @@ def pfet_deep_nwell( deepnwell : boolaen of having deepnwell pcmpgr : boolean of having deepnwell guardring enc_size : enclosed size - enc_xmin : enclosed xmin - enc_ymin : enclosed ymin + enc_xmin : enclosed dxmin + enc_ymin : enclosed dymin nw_enc_pcmp : nwell enclosure of pcomp grw : guardring width """ @@ -1467,8 +1473,8 @@ def pfet_deep_nwell( ) ) - dn_rect.xmin = enc_xmin - dnwell_enc_pcmp - dn_rect.ymin = enc_ymin - dnwell_enc_pcmp + dn_rect.dxmin = enc_xmin - dnwell_enc_pcmp + dn_rect.dymin = enc_ymin - dnwell_enc_pcmp if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=grw)) @@ -1484,8 +1490,8 @@ def pfet_deep_nwell( layer=layer["nwell"], ) ) - nw.xmin = enc_xmin - nw_enc_pcmp - nw.ymin = enc_ymin - nw_enc_pcmp + nw.dxmin = enc_xmin - nw_enc_pcmp + nw.dymin = enc_ymin - nw_enc_pcmp return c @@ -1590,12 +1596,12 @@ def pfet( spacing=(cmpc_size[0] + sd_diff_intr.size[0], 0), ) - sd_diff.xmin = sd_diff_intr.xmin - cmpc_size[0] - sd_diff.ymin = sd_diff_intr.ymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 + sd_diff.dxmin = sd_diff_intr.dxmin - cmpc_size[0] + sd_diff.dymin = sd_diff_intr.dymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 sd_con = via_stack( - x_range=(sd_diff.xmin, sd_diff_intr.xmin), - y_range=(sd_diff.ymin, sd_diff.ymax), + x_range=(sd_diff.dxmin, sd_diff_intr.dxmin), + y_range=(sd_diff.dymin, sd_diff.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1612,8 +1618,8 @@ def pfet( if con_bet_fin == 1 and nf > 1: inter_sd_con = via_stack( x_range=( - sd_diff_intr.xmin + con_comp_enc + l_gate, - sd_diff_intr.xmin + con_comp_enc + l_gate + inter_sd_l, + sd_diff_intr.dxmin + con_comp_enc + l_gate, + sd_diff_intr.dxmin + con_comp_enc + l_gate + inter_sd_l, ), y_range=(0, w_gate), base_layer=layer["comp"], @@ -1630,7 +1636,10 @@ def pfet( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmin + (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmin + (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, labels=sd_label, @@ -1642,7 +1651,10 @@ def pfet( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmax - (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmax - (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, labels=sd_label, @@ -1666,8 +1678,8 @@ def pfet( rect_pc = c_pc.add_ref(gf.components.rectangle(size=pc_size, layer=layer["poly2"])) poly_con = via_stack( - x_range=(rect_pc.xmin, rect_pc.xmax), - y_range=(rect_pc.ymin, rect_pc.ymax), + x_range=(rect_pc.dxmin, rect_pc.dxmax), + y_range=(rect_pc.dymin, rect_pc.dymax), base_layer=layer["poly2"], metal_level=1, li_enc_dir="H", @@ -1680,8 +1692,8 @@ def pfet( size=(l_gate, w_gate + 2 * end_cap), layer=layer["poly2"] ) ) - poly.xmin = sd_diff_intr.xmin + con_comp_enc - poly.ymin = sd_diff_intr.ymin - end_cap + poly.dxmin = sd_diff_intr.dxmin + con_comp_enc + poly.dymin = sd_diff_intr.dymin - end_cap if gate_con_pos == "bottom": mv = 0 @@ -1699,13 +1711,13 @@ def pfet( columns=1, spacing=(0, pc_size[1] + w_gate + 2 * end_cap), ) - pc.move((poly.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) + pc.dmove((poly.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) # gate_lablel c.add_ref( labels_gen( label_str="None", - position=(pc.xmin + c_pc.size[0] / 2, pc.ymin + c_pc.size[1] / 2), + position=(pc.dxmin + c_pc.size[0] / 2, pc.dymin + c_pc.size[1] / 2), layer=layer["metal1_label"], label=label, labels=g_label, @@ -1744,8 +1756,8 @@ def pfet( columns=ceil(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly1.xmin = sd_diff_intr.xmin + con_comp_enc - poly1.ymin = sd_diff_intr.ymin - end_cap - e_c + poly1.dxmin = sd_diff_intr.dxmin + con_comp_enc + poly1.dymin = sd_diff_intr.dymin - end_cap - e_c poly2 = c_inst.add_array( rect_p2, @@ -1753,8 +1765,8 @@ def pfet( columns=floor(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly2.xmin = poly1.xmin + l_gate + inter_sd_l - poly2.ymin = p_mv + poly2.dxmin = poly1.dxmin + l_gate + inter_sd_l + poly2.dymin = p_mv # generating poly contacts setups @@ -1778,14 +1790,14 @@ def pfet( pc1 = c_inst.add_array( component=c_pc, rows=1, columns=nc1, spacing=(pc_spacing, 0) ) - pc1.move((poly1.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) + pc1.dmove((poly1.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) pc2 = c_inst.add_array( component=c_pc, rows=1, columns=nc2, spacing=(pc_spacing, 0) ) - pc2.move( + pc2.dmove( ( - poly1.xmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), + poly1.dxmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), -pc_size[1] - end_cap + mv_2, ) ) @@ -1834,8 +1846,8 @@ def pfet( layer=layer["pplus"], ) ) - pplus.xmin = sd_diff.xmin - comp_pp_enc - pplus.ymin = sd_diff_intr.ymin - gate_pp_enc + pplus.dxmin = sd_diff.dxmin - comp_pp_enc + pplus.dymin = sd_diff_intr.dymin - gate_pp_enc c.add_ref(c_inst) @@ -1846,8 +1858,8 @@ def pfet( deepnwell=deepnwell, pcmpgr=pcmpgr, enc_size=(sd_diff.size[0], sd_diff.size[1]), - enc_xmin=sd_diff.xmin, - enc_ymin=sd_diff.ymin, + enc_xmin=sd_diff.dxmin, + enc_ymin=sd_diff.dymin, nw_enc_pcmp=nw_enc_pcmp, grw=grw, ) @@ -1866,33 +1878,33 @@ def pfet( size=(sd_l + con_sp, sd_diff.size[1]), layer=layer["comp"] ) ) - rect_bulk.xmin = sd_diff.xmax - rect_bulk.ymin = sd_diff.ymin + rect_bulk.dxmin = sd_diff.dxmax + rect_bulk.dymin = sd_diff.dymin psdm = c_inst.add_ref( gf.components.rectangle( size=( - sd_diff.xmax - sd_diff.xmin + comp_pp_enc, + sd_diff.dxmax - sd_diff.dxmin + comp_pp_enc, w_gate + 2 * gate_pp_enc, ), layer=layer["pplus"], ) ) - psdm.xmin = sd_diff.xmin - comp_pp_enc - psdm.ymin = sd_diff_intr.ymin - gate_pp_enc + psdm.dxmin = sd_diff.dxmin - comp_pp_enc + psdm.dymin = sd_diff_intr.dymin - gate_pp_enc nsdm = c_inst.add_ref( gf.components.rectangle( size=( - rect_bulk.xmax - rect_bulk.xmin + comp_np_enc, + rect_bulk.dxmax - rect_bulk.dxmin + comp_np_enc, w_gate + 2 * comp_np_enc, ), layer=layer["nplus"], ) ) - nsdm.connect("e1", destination=psdm.ports["e3"]) + nsdm.connect("e1", psdm.ports["e3"]) bulk_con = via_stack( - x_range=(rect_bulk.xmin + 0.1, rect_bulk.xmax - 0.1), - y_range=(rect_bulk.ymin, rect_bulk.ymax), + x_range=(rect_bulk.dxmin + 0.1, rect_bulk.dxmax - 0.1), + y_range=(rect_bulk.dymin, rect_bulk.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -1904,8 +1916,8 @@ def pfet( labels_gen( label_str=sub_label, position=( - bulk_con.xmin + bulk_con.size[0] / 2, - bulk_con.ymin + bulk_con.size[1] / 2, + bulk_con.dxmin + bulk_con.size[0] / 2, + bulk_con.dymin + bulk_con.size[1] / 2, ), layer=layer["metal1_label"], label=label, @@ -1921,8 +1933,8 @@ def pfet( deepnwell=deepnwell, pcmpgr=pcmpgr, enc_size=(sd_diff.size[0] + rect_bulk.size[0], sd_diff.size[1]), - enc_xmin=sd_diff.xmin, - enc_ymin=sd_diff.ymin, + enc_xmin=sd_diff.dxmin, + enc_ymin=sd_diff.dymin, nw_enc_pcmp=nw_enc_pcmp, grw=grw, ) @@ -1941,8 +1953,8 @@ def pfet( layer=layer["pplus"], ) ) - psdm.xmin = sd_diff.xmin - comp_pp_enc - psdm.ymin = sd_diff_intr.ymin - gate_pp_enc + psdm.dxmin = sd_diff.dxmin - comp_pp_enc + psdm.dymin = sd_diff_intr.dymin - gate_pp_enc c.add_ref(c_inst) bulk_gr_gen( @@ -2052,12 +2064,12 @@ def nfet_06v0_nvt( spacing=(cmpc_size[0] + sd_diff_intr.size[0], 0), ) - sd_diff.xmin = sd_diff_intr.xmin - cmpc_size[0] - sd_diff.ymin = sd_diff_intr.ymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 + sd_diff.dxmin = sd_diff_intr.dxmin - cmpc_size[0] + sd_diff.dymin = sd_diff_intr.dymin - (sd_diff.size[1] - sd_diff_intr.size[1]) / 2 sd_con = via_stack( - x_range=(sd_diff.xmin, sd_diff_intr.xmin), - y_range=(sd_diff.ymin, sd_diff.ymax), + x_range=(sd_diff.dxmin, sd_diff_intr.dxmin), + y_range=(sd_diff.dymin, sd_diff.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -2074,8 +2086,8 @@ def nfet_06v0_nvt( if con_bet_fin == 1 and nf > 1: inter_sd_con = via_stack( x_range=( - sd_diff_intr.xmin + con_comp_enc + l_gate, - sd_diff_intr.xmin + con_comp_enc + l_gate + inter_sd_l, + sd_diff_intr.dxmin + con_comp_enc + l_gate, + sd_diff_intr.dxmin + con_comp_enc + l_gate + inter_sd_l, ), y_range=(0, w_gate), base_layer=layer["comp"], @@ -2092,7 +2104,10 @@ def nfet_06v0_nvt( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmin + (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmin + (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, labels=sd_label, @@ -2104,7 +2119,10 @@ def nfet_06v0_nvt( c.add_ref( labels_gen( label_str="None", - position=(sd_diff.xmax - (sd_l / 2), sd_diff.ymin + (sd_diff.size[1] / 2)), + position=( + sd_diff.dxmax - (sd_l / 2), + sd_diff.dymin + (sd_diff.size[1] / 2), + ), layer=layer["metal1_label"], label=label, labels=sd_label, @@ -2128,8 +2146,8 @@ def nfet_06v0_nvt( rect_pc = c_pc.add_ref(gf.components.rectangle(size=pc_size, layer=layer["poly2"])) poly_con = via_stack( - x_range=(rect_pc.xmin, rect_pc.xmax), - y_range=(rect_pc.ymin, rect_pc.ymax), + x_range=(rect_pc.dxmin, rect_pc.dxmax), + y_range=(rect_pc.dymin, rect_pc.dymax), base_layer=layer["poly2"], metal_level=1, li_enc_dir="H", @@ -2142,8 +2160,8 @@ def nfet_06v0_nvt( size=(l_gate, w_gate + 2 * end_cap), layer=layer["poly2"] ) ) - poly.xmin = sd_diff_intr.xmin + con_comp_enc - poly.ymin = sd_diff_intr.ymin - end_cap + poly.dxmin = sd_diff_intr.dxmin + con_comp_enc + poly.dymin = sd_diff_intr.dymin - end_cap if gate_con_pos == "bottom": mv = 0 @@ -2161,13 +2179,13 @@ def nfet_06v0_nvt( columns=1, spacing=(0, pc_size[1] + w_gate + 2 * end_cap), ) - pc.move((poly.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) + pc.dmove((poly.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv)) # gate_lablel c.add_ref( labels_gen( label_str="None", - position=(pc.xmin + c_pc.size[0] / 2, pc.ymin + c_pc.size[1] / 2), + position=(pc.dxmin + c_pc.size[0] / 2, pc.dymin + c_pc.size[1] / 2), layer=layer["metal1_label"], label=label, labels=g_label, @@ -2206,8 +2224,8 @@ def nfet_06v0_nvt( columns=ceil(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly1.xmin = sd_diff_intr.xmin + con_comp_enc - poly1.ymin = sd_diff_intr.ymin - end_cap - e_c + poly1.dxmin = sd_diff_intr.dxmin + con_comp_enc + poly1.dymin = sd_diff_intr.dymin - end_cap - e_c poly2 = c_inst.add_array( rect_p2, @@ -2215,8 +2233,8 @@ def nfet_06v0_nvt( columns=floor(nf / 2), spacing=[2 * (inter_sd_l + l_gate), 0], ) - poly2.xmin = poly1.xmin + l_gate + inter_sd_l - poly2.ymin = p_mv + poly2.dxmin = poly1.dxmin + l_gate + inter_sd_l + poly2.dymin = p_mv # generating poly contacts setups @@ -2240,14 +2258,14 @@ def nfet_06v0_nvt( pc1 = c_inst.add_array( component=c_pc, rows=1, columns=nc1, spacing=(pc_spacing, 0) ) - pc1.move((poly1.xmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) + pc1.dmove((poly1.dxmin - ((pc_x - l_gate) / 2), -pc_size[1] - end_cap + mv_1)) pc2 = c_inst.add_array( component=c_pc, rows=1, columns=nc2, spacing=(pc_spacing, 0) ) - pc2.move( + pc2.dmove( ( - poly1.xmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), + poly1.dxmin - ((pc_x - l_gate) / 2) + (inter_sd_l + l_gate), -pc_size[1] - end_cap + mv_2, ) ) @@ -2296,8 +2314,8 @@ def nfet_06v0_nvt( layer=layer["nplus"], ) ) - nplus.xmin = sd_diff.xmin - comp_np_enc - nplus.ymin = sd_diff_intr.ymin - gate_np_enc + nplus.dxmin = sd_diff.dxmin - comp_np_enc + nplus.dymin = sd_diff_intr.dymin - gate_np_enc elif bulk == "Bulk Tie": rect_bulk = c_inst.add_ref( @@ -2305,33 +2323,33 @@ def nfet_06v0_nvt( size=(sd_l + con_sp, sd_diff.size[1]), layer=layer["comp"] ) ) - rect_bulk.xmin = sd_diff.xmax - rect_bulk.ymin = sd_diff.ymin + rect_bulk.dxmin = sd_diff.dxmax + rect_bulk.dymin = sd_diff.dymin nsdm = c_inst.add_ref( gf.components.rectangle( size=( - sd_diff.xmax - sd_diff.xmin + comp_np_enc, + sd_diff.dxmax - sd_diff.dxmin + comp_np_enc, w_gate + 2 * gate_np_enc, ), layer=layer["nplus"], ) ) - nsdm.xmin = sd_diff.xmin - comp_np_enc - nsdm.ymin = sd_diff_intr.ymin - gate_np_enc + nsdm.dxmin = sd_diff.dxmin - comp_np_enc + nsdm.dymin = sd_diff_intr.dymin - gate_np_enc psdm = c_inst.add_ref( gf.components.rectangle( size=( - rect_bulk.xmax - rect_bulk.xmin + comp_pp_enc, + rect_bulk.dxmax - rect_bulk.dxmin + comp_pp_enc, w_gate + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm.connect("e1", destination=nsdm.ports["e3"]) + psdm.connect("e1", nsdm.ports["e3"]) bulk_con = via_stack( - x_range=(rect_bulk.xmin + 0.1, rect_bulk.xmax - 0.1), - y_range=(rect_bulk.ymin, rect_bulk.ymax), + x_range=(rect_bulk.dxmin + 0.1, rect_bulk.dxmax - 0.1), + y_range=(rect_bulk.dymin, rect_bulk.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -2341,8 +2359,8 @@ def nfet_06v0_nvt( labels_gen( label_str=sub_label, position=( - bulk_con.xmin + bulk_con.size[0] / 2, - bulk_con.ymin + bulk_con.size[1] / 2, + bulk_con.dxmin + bulk_con.size[0] / 2, + bulk_con.dymin + bulk_con.size[1] / 2, ), layer=layer["metal1_label"], label=label, @@ -2358,33 +2376,33 @@ def nfet_06v0_nvt( layer=layer["nplus"], ) ) - nsdm.xmin = sd_diff.xmin - comp_np_enc - nsdm.ymin = sd_diff_intr.ymin - gate_np_enc + nsdm.dxmin = sd_diff.dxmin - comp_np_enc + nsdm.dymin = sd_diff_intr.dymin - gate_np_enc c.add_ref(c_inst) c_temp = gf.Component("temp_store") rect_bulk_in = c_temp.add_ref( gf.components.rectangle( size=( - (c_inst.xmax - c_inst.xmin) + 2 * comp_spacing, - (c_inst.ymax - c_inst.ymin) + 2 * poly2_comp_spacing, + (c_inst.dxmax - c_inst.dxmin) + 2 * comp_spacing, + (c_inst.dymax - c_inst.dymin) + 2 * poly2_comp_spacing, ), layer=layer["comp"], ) ) - rect_bulk_in.move( - (c_inst.xmin - comp_spacing, c_inst.ymin - poly2_comp_spacing) + rect_bulk_in.dmove( + (c_inst.dxmin - comp_spacing, c_inst.dymin - poly2_comp_spacing) ) rect_bulk_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) + 2 * grw, - (rect_bulk_in.ymax - rect_bulk_in.ymin) + 2 * grw, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) + 2 * grw, + (rect_bulk_in.dymax - rect_bulk_in.dymin) + 2 * grw, ), layer=layer["comp"], ) ) - rect_bulk_out.move((rect_bulk_in.xmin - grw, rect_bulk_in.ymin - grw)) + rect_bulk_out.dmove((rect_bulk_in.dxmin - grw, rect_bulk_in.dymin - grw)) B = c.add_ref( gf.geometry.boolean( A=rect_bulk_out, @@ -2397,26 +2415,28 @@ def nfet_06v0_nvt( psdm_in = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) - 2 * comp_pp_enc, - (rect_bulk_in.ymax - rect_bulk_in.ymin) - 2 * comp_pp_enc, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) - 2 * comp_pp_enc, + (rect_bulk_in.dymax - rect_bulk_in.dymin) - 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_in.move((rect_bulk_in.xmin + comp_pp_enc, rect_bulk_in.ymin + comp_pp_enc)) + psdm_in.dmove( + (rect_bulk_in.dxmin + comp_pp_enc, rect_bulk_in.dymin + comp_pp_enc) + ) psdm_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_out.xmax - rect_bulk_out.xmin) + 2 * comp_pp_enc, - (rect_bulk_out.ymax - rect_bulk_out.ymin) + 2 * comp_pp_enc, + (rect_bulk_out.dxmax - rect_bulk_out.dxmin) + 2 * comp_pp_enc, + (rect_bulk_out.dymax - rect_bulk_out.dymin) + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_bulk_out.xmin - comp_pp_enc, - rect_bulk_out.ymin - comp_pp_enc, + rect_bulk_out.dxmin - comp_pp_enc, + rect_bulk_out.dymin - comp_pp_enc, ) ) psdm = c.add_ref( @@ -2430,10 +2450,10 @@ def nfet_06v0_nvt( c.add_ref( via_generator( x_range=( - rect_bulk_in.xmin + con_size, - rect_bulk_in.xmax - con_size, + rect_bulk_in.dxmin + con_size, + rect_bulk_in.dxmax - con_size, ), - y_range=(rect_bulk_out.ymin, rect_bulk_in.ymin), + y_range=(rect_bulk_out.dymin, rect_bulk_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -2444,10 +2464,10 @@ def nfet_06v0_nvt( c.add_ref( via_generator( x_range=( - rect_bulk_in.xmin + con_size, - rect_bulk_in.xmax - con_size, + rect_bulk_in.dxmin + con_size, + rect_bulk_in.dxmax - con_size, ), - y_range=(rect_bulk_in.ymax, rect_bulk_out.ymax), + y_range=(rect_bulk_in.dymax, rect_bulk_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -2457,10 +2477,10 @@ def nfet_06v0_nvt( c.add_ref( via_generator( - x_range=(rect_bulk_out.xmin, rect_bulk_in.xmin), + x_range=(rect_bulk_out.dxmin, rect_bulk_in.dxmin), y_range=( - rect_bulk_in.ymin + con_size, - rect_bulk_in.ymax - con_size, + rect_bulk_in.dymin + con_size, + rect_bulk_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -2471,10 +2491,10 @@ def nfet_06v0_nvt( c.add_ref( via_generator( - x_range=(rect_bulk_in.xmax, rect_bulk_out.xmax), + x_range=(rect_bulk_in.dxmax, rect_bulk_out.dxmax), y_range=( - rect_bulk_in.ymin + con_size, - rect_bulk_in.ymax - con_size, + rect_bulk_in.dymin + con_size, + rect_bulk_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -2487,22 +2507,22 @@ def nfet_06v0_nvt( gf.components.rectangle( size=( (l_d) + 2 * comp_spacing, - (c_inst.ymax - c_inst.ymin) + 2 * poly2_comp_spacing, + (c_inst.dymax - c_inst.dymin) + 2 * poly2_comp_spacing, ), layer=layer["metal1"], ) ) - comp_m1_in.move((-comp_spacing, c_inst.ymin - poly2_comp_spacing)) + comp_m1_in.dmove((-comp_spacing, c_inst.dymin - poly2_comp_spacing)) comp_m1_out = c_temp.add_ref( gf.components.rectangle( size=( - (rect_bulk_in.xmax - rect_bulk_in.xmin) + 2 * grw, - (rect_bulk_in.ymax - rect_bulk_in.ymin) + 2 * grw, + (rect_bulk_in.dxmax - rect_bulk_in.dxmin) + 2 * grw, + (rect_bulk_in.dymax - rect_bulk_in.dymin) + 2 * grw, ), layer=layer["metal1"], ) ) - comp_m1_out.move((rect_bulk_in.xmin - grw, rect_bulk_in.ymin - grw)) + comp_m1_out.dmove((rect_bulk_in.dxmin - grw, rect_bulk_in.dymin - grw)) b_gr = c.add_ref( gf.geometry.boolean( A=rect_bulk_out, @@ -2516,8 +2536,8 @@ def nfet_06v0_nvt( labels_gen( label_str=sub_label, position=( - b_gr.xmin + (grw + 2 * (comp_pp_enc)) / 2, - b_gr.ymin + (b_gr.size[1] / 2), + b_gr.dxmin + (grw + 2 * (comp_pp_enc)) / 2, + b_gr.dymin + (b_gr.size[1] / 2), ), layer=layer["metal1_label"], label=label, @@ -2535,8 +2555,8 @@ def nfet_06v0_nvt( layer=layer["dualgate"], ) ) - dg.xmin = B.xmin - dg_enc_cmp - dg.ymin = B.ymin - dg_enc_cmp + dg.dxmin = B.dxmin - dg_enc_cmp + dg.dymin = B.dymin - dg_enc_cmp if bulk != "Guard Ring": c.add_ref(c_inst) @@ -2550,16 +2570,16 @@ def nfet_06v0_nvt( layer=layer["dualgate"], ) ) - dg.xmin = c_inst.xmin - dg_enc_cmp - dg.ymin = c_inst.ymin - dg_enc_poly + dg.dxmin = c_inst.dxmin - dg_enc_cmp + dg.dymin = c_inst.dymin - dg_enc_poly # generating native layer nat = c.add_ref( gf.components.rectangle(size=(dg.size[0], dg.size[1]), layer=layer["nat"]) ) - nat.xmin = dg.xmin - nat.ymin = dg.ymin + nat.dxmin = dg.dxmin + nat.dymin = dg.dymin return c diff --git a/gf180/guardring.py b/gf180/guardring.py index c08a94b..b925902 100644 --- a/gf180/guardring.py +++ b/gf180/guardring.py @@ -31,23 +31,23 @@ def pcmpgr_gen(dn_rect=dn_rect, grw: float = 0.36) -> gf.Component: rect_pcmpgr_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (dn_rect.xmax - dn_rect.xmin) + 2 * pcmpgr_enc_dn, - (dn_rect.ymax - dn_rect.ymin) + 2 * pcmpgr_enc_dn, + (dn_rect.dxmax - dn_rect.dxmin) + 2 * pcmpgr_enc_dn, + (dn_rect.dymax - dn_rect.dymin) + 2 * pcmpgr_enc_dn, ), layer=layer["comp"], ) ) - rect_pcmpgr_in.move((dn_rect.xmin - pcmpgr_enc_dn, dn_rect.ymin - pcmpgr_enc_dn)) + rect_pcmpgr_in.dmove((dn_rect.dxmin - pcmpgr_enc_dn, dn_rect.dymin - pcmpgr_enc_dn)) rect_pcmpgr_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) + 2 * grw, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) + 2 * grw, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) + 2 * grw, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) + 2 * grw, ), layer=layer["comp"], ) ) - rect_pcmpgr_out.move((rect_pcmpgr_in.xmin - grw, rect_pcmpgr_in.ymin - grw)) + rect_pcmpgr_out.dmove((rect_pcmpgr_in.dxmin - grw, rect_pcmpgr_in.dymin - grw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, @@ -60,31 +60,31 @@ def pcmpgr_gen(dn_rect=dn_rect, grw: float = 0.36) -> gf.Component: psdm_in = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_in.xmax - rect_pcmpgr_in.xmin) - 2 * comp_pp_enc, - (rect_pcmpgr_in.ymax - rect_pcmpgr_in.ymin) - 2 * comp_pp_enc, + (rect_pcmpgr_in.dxmax - rect_pcmpgr_in.dxmin) - 2 * comp_pp_enc, + (rect_pcmpgr_in.dymax - rect_pcmpgr_in.dymin) - 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_in.move( + psdm_in.dmove( ( - rect_pcmpgr_in.xmin + comp_pp_enc, - rect_pcmpgr_in.ymin + comp_pp_enc, + rect_pcmpgr_in.dxmin + comp_pp_enc, + rect_pcmpgr_in.dymin + comp_pp_enc, ) ) psdm_out = c_temp_gr.add_ref( gf.components.rectangle( size=( - (rect_pcmpgr_out.xmax - rect_pcmpgr_out.xmin) + 2 * comp_pp_enc, - (rect_pcmpgr_out.ymax - rect_pcmpgr_out.ymin) + 2 * comp_pp_enc, + (rect_pcmpgr_out.dxmax - rect_pcmpgr_out.dxmin) + 2 * comp_pp_enc, + (rect_pcmpgr_out.dymax - rect_pcmpgr_out.dymin) + 2 * comp_pp_enc, ), layer=layer["pplus"], ) ) - psdm_out.move( + psdm_out.dmove( ( - rect_pcmpgr_out.xmin - comp_pp_enc, - rect_pcmpgr_out.ymin - comp_pp_enc, + rect_pcmpgr_out.dxmin - comp_pp_enc, + rect_pcmpgr_out.dymin - comp_pp_enc, ) ) c.add_ref( @@ -98,10 +98,10 @@ def pcmpgr_gen(dn_rect=dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_out.ymin, rect_pcmpgr_in.ymin), + y_range=(rect_pcmpgr_out.dymin, rect_pcmpgr_in.dymin), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -112,10 +112,10 @@ def pcmpgr_gen(dn_rect=dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( x_range=( - rect_pcmpgr_in.xmin + con_size, - rect_pcmpgr_in.xmax - con_size, + rect_pcmpgr_in.dxmin + con_size, + rect_pcmpgr_in.dxmax - con_size, ), - y_range=(rect_pcmpgr_in.ymax, rect_pcmpgr_out.ymax), + y_range=(rect_pcmpgr_in.dymax, rect_pcmpgr_out.dymax), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], via_size=(con_size, con_size), @@ -125,10 +125,10 @@ def pcmpgr_gen(dn_rect=dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( - x_range=(rect_pcmpgr_out.xmin, rect_pcmpgr_in.xmin), + x_range=(rect_pcmpgr_out.dxmin, rect_pcmpgr_in.dxmin), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -139,10 +139,10 @@ def pcmpgr_gen(dn_rect=dn_rect, grw: float = 0.36) -> gf.Component: c.add_ref( via_generator( - x_range=(rect_pcmpgr_in.xmax, rect_pcmpgr_out.xmax), + x_range=(rect_pcmpgr_in.dxmax, rect_pcmpgr_out.dxmax), y_range=( - rect_pcmpgr_in.ymin + con_size, - rect_pcmpgr_in.ymax - con_size, + rect_pcmpgr_in.dymin + con_size, + rect_pcmpgr_in.dymax - con_size, ), via_enclosure=(con_comp_enc, con_comp_enc), via_layer=layer["contact"], @@ -167,7 +167,7 @@ def pcmpgr_gen(dn_rect=dn_rect, grw: float = 0.36) -> gf.Component: layer=layer["metal1"], ) ) - comp_m1_out.move((rect_pcmpgr_in.xmin - grw, rect_pcmpgr_in.ymin - grw)) + comp_m1_out.dmove((rect_pcmpgr_in.dxmin - grw, rect_pcmpgr_in.dymin - grw)) c.add_ref( gf.geometry.boolean( A=rect_pcmpgr_out, diff --git a/gf180/layers.py b/gf180/layers.py index 3511404..6525dc8 100644 --- a/gf180/layers.py +++ b/gf180/layers.py @@ -1,11 +1,11 @@ import gdsfactory as gf +from gdsfactory.technology import LayerMap from gdsfactory.typings import Layer -from pydantic import BaseModel from gf180.config import PATH -class LayerMap(BaseModel): +class LAYER(LayerMap): comp: Layer = (22, 0) dnwell: Layer = (12, 0) nwell: Layer = (21, 0) @@ -114,8 +114,7 @@ class LayerMap(BaseModel): border: Layer = (63, 0) -LAYER = LayerMap() -layer = dict(LAYER) +layer = LAYER LAYER_VIEWS = gf.technology.LayerViews(PATH.lyp_yaml) if __name__ == "__main__": diff --git a/gf180/res.py b/gf180/res.py index 866ccd9..6d98c06 100644 --- a/gf180/res.py +++ b/gf180/res.py @@ -52,24 +52,24 @@ def res( m_rect = c.add_ref( gf.components.rectangle(size=(l_res + (2 * m_ext), w_res), layer=m_layer) ) - m_rect.xmin = res_mk.xmin - m_ext - m_rect.ymin = res_mk.ymin + m_rect.dxmin = res_mk.dxmin - m_ext + m_rect.dymin = res_mk.dymin # labels generation if label == 1: c.add_label( r0_label, position=( - res_mk.xmin + (res_mk.size[0] / 2), - res_mk.ymin + (res_mk.size[1] / 2), + res_mk.dxmin + (res_mk.size[0] / 2), + res_mk.dymin + (res_mk.size[1] / 2), ), layer=m_label_layer, ) c.add_label( r1_label, position=( - m_rect.xmin + (res_mk.xmin - m_rect.xmin) / 2, - m_rect.ymin + (m_rect.size[1] / 2), + m_rect.dxmin + (res_mk.dxmin - m_rect.dxmin) / 2, + m_rect.dymin + (m_rect.size[1] / 2), ), layer=m_label_layer, ) @@ -112,8 +112,8 @@ def plus_res_inst( layer=layer["sab"], ) ) - sab_rect.xmin = res_mk.xmin - sab_rect.ymin = res_mk.ymin - sab_res_ext + sab_rect.dxmin = res_mk.dxmin + sab_rect.dymin = res_mk.dymin - sab_res_ext cmp = c.add_ref( gf.components.rectangle( @@ -121,12 +121,12 @@ def plus_res_inst( layer=layer["comp"], ) ) - cmp.xmin = res_mk.xmin - cmp_res_ext - cmp.ymin = res_mk.ymin + cmp.dxmin = res_mk.dxmin - cmp_res_ext + cmp.dymin = res_mk.dymin cmp_con = via_stack( - x_range=(cmp.xmin, res_mk.xmin + con_enc), - y_range=(cmp.ymin, cmp.ymax), + x_range=(cmp.dxmin, res_mk.dxmin + con_enc), + y_range=(cmp.dymin, cmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -143,16 +143,16 @@ def plus_res_inst( c.add_label( r0_label, position=( - cmp_con_arr.xmin + (cmp_con.size[0] / 2), - cmp_con_arr.ymin + (cmp_con.size[1] / 2), + cmp_con_arr.dxmin + (cmp_con.size[0] / 2), + cmp_con_arr.dymin + (cmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) c.add_label( r1_label, position=( - cmp_con_arr.xmax - (cmp_con.size[0] / 2), - cmp_con_arr.ymin + (cmp_con.size[1] / 2), + cmp_con_arr.dxmax - (cmp_con.size[0] / 2), + cmp_con_arr.dymin + (cmp_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -163,21 +163,21 @@ def plus_res_inst( layer=cmp_imp_layer, ) ) - cmp_imp.xmin = cmp.xmin - np_enc_cmp - cmp_imp.ymin = cmp.ymin - np_enc_cmp + cmp_imp.dxmin = cmp.dxmin - np_enc_cmp + cmp_imp.dymin = cmp.dymin - np_enc_cmp if sub == 1: sub_rect = c.add_ref( gf.components.rectangle(size=(sub_w, w_res), layer=layer["comp"]) ) - sub_rect.xmax = cmp.xmin - comp_spacing - sub_rect.ymin = cmp.ymin + sub_rect.dxmax = cmp.dxmin - comp_spacing + sub_rect.dymin = cmp.dymin # sub_rect contact sub_con = c.add_ref( via_stack( - x_range=(sub_rect.xmin, sub_rect.xmax), - y_range=(sub_rect.ymin, sub_rect.ymax), + x_range=(sub_rect.dxmin, sub_rect.dxmax), + y_range=(sub_rect.dymin, sub_rect.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -192,16 +192,16 @@ def plus_res_inst( layer=sub_imp_layer, ) ) - sub_imp.xmin = sub_rect.xmin - pp_enc_cmp - sub_imp.ymin = sub_rect.ymin - pp_enc_cmp + sub_imp.dxmin = sub_rect.dxmin - pp_enc_cmp + sub_imp.dymin = sub_rect.dymin - pp_enc_cmp # label generation if label == 1: c.add_label( sub_label, position=( - sub_con.xmin + (sub_con.size[0] / 2), - sub_con.ymin + (sub_con.size[1] / 2), + sub_con.dxmin + (sub_con.size[0] / 2), + sub_con.dymin + (sub_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -263,8 +263,8 @@ def nplus_res( layer=layer["lvpwell"], ) ) - lvpwell.xmin = r_inst.xmin - lvpwell_enc_cmp - lvpwell.ymin = r_inst.ymin - lvpwell_enc_cmp + lvpwell.dxmin = r_inst.dxmin - lvpwell_enc_cmp + lvpwell.dymin = r_inst.dymin - lvpwell_enc_cmp dn_rect = c.add_ref( gf.components.rectangle( @@ -275,8 +275,8 @@ def nplus_res( layer=layer["dnwell"], ) ) - dn_rect.xmin = lvpwell.xmin - dn_enc_lvpwell - dn_rect.ymin = lvpwell.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvpwell.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvpwell.dymin - dn_enc_lvpwell if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=sub_w)) @@ -339,8 +339,8 @@ def pplus_res( layer=layer["dnwell"], ) ) - dn_rect.xmax = r_inst.xmax + dn_enc_pcmp - dn_rect.ymin = r_inst.ymin - dn_enc_pcmp + dn_rect.dxmax = r_inst.dxmax + dn_enc_pcmp + dn_rect.dymin = r_inst.dymin - dn_enc_pcmp if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=sub_w)) @@ -355,8 +355,8 @@ def pplus_res( layer=layer["nwell"], ) ) - nw_rect.xmin = r_inst.xmin - nw_enc_pcmp - nw_rect.ymin = r_inst.ymin - nw_enc_pcmp + nw_rect.dxmin = r_inst.dxmin - nw_enc_pcmp + nw_rect.dymin = r_inst.dymin - nw_enc_pcmp return c @@ -394,8 +394,8 @@ def polyf_res_inst( layer=layer["sab"], ) ) - sab_rect.xmin = res_mk.xmin - sab_rect.ymin = res_mk.ymin - sab_res_ext + sab_rect.dxmin = res_mk.dxmin + sab_rect.dymin = res_mk.dymin - sab_res_ext pl = c.add_ref( gf.components.rectangle( @@ -403,12 +403,12 @@ def polyf_res_inst( layer=layer["poly2"], ) ) - pl.xmin = res_mk.xmin - pl_res_ext - pl.ymin = res_mk.ymin + pl.dxmin = res_mk.dxmin - pl_res_ext + pl.dymin = res_mk.dymin pl_con = via_stack( - x_range=(pl.xmin, res_mk.xmin + con_enc), - y_range=(pl.ymin, pl.ymax), + x_range=(pl.dxmin, res_mk.dxmin + con_enc), + y_range=(pl.dymin, pl.dymax), base_layer=layer["poly2"], metal_level=1, ) @@ -426,20 +426,20 @@ def polyf_res_inst( layer=pl_imp_layer, ) ) - pl_imp.xmin = pl.xmin - np_enc_poly2 - pl_imp.ymin = pl.ymin - np_enc_poly2 + pl_imp.dxmin = pl.dxmin - np_enc_poly2 + pl_imp.dymin = pl.dymin - np_enc_poly2 sub_rect = c.add_ref( gf.components.rectangle(size=(sub_w, w_res), layer=layer["comp"]) ) - sub_rect.xmax = pl.xmin - comp_spacing - sub_rect.ymin = pl.ymin + sub_rect.dxmax = pl.dxmin - comp_spacing + sub_rect.dymin = pl.dymin # sub_rect contact sub_con = c.add_ref( via_stack( - x_range=(sub_rect.xmin, sub_rect.xmax), - y_range=(sub_rect.ymin, sub_rect.ymax), + x_range=(sub_rect.dxmin, sub_rect.dxmax), + y_range=(sub_rect.dymin, sub_rect.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -454,24 +454,24 @@ def polyf_res_inst( layer=sub_imp_layer, ) ) - sub_imp.xmin = sub_rect.xmin - pp_enc_cmp - sub_imp.ymin = sub_rect.ymin - pp_enc_cmp + sub_imp.dxmin = sub_rect.dxmin - pp_enc_cmp + sub_imp.dymin = sub_rect.dymin - pp_enc_cmp # labels generation if label == 1: c.add_label( r0_label, position=( - pl_con_arr.xmin + (pl_con.size[0] / 2), - pl_con_arr.ymin + (pl_con.size[1] / 2), + pl_con_arr.dxmin + (pl_con.size[0] / 2), + pl_con_arr.dymin + (pl_con.size[1] / 2), ), layer=layer["metal1_label"], ) c.add_label( r1_label, position=( - pl_con_arr.xmax - (pl_con.size[0] / 2), - pl_con_arr.ymin + (pl_con.size[1] / 2), + pl_con_arr.dxmax - (pl_con.size[0] / 2), + pl_con_arr.dymin + (pl_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -479,8 +479,8 @@ def polyf_res_inst( c.add_label( sub_label, position=( - sub_con.xmin + (sub_con.size[0] / 2), - sub_con.ymin + (sub_con.size[1] / 2), + sub_con.dxmin + (sub_con.size[0] / 2), + sub_con.dymin + (sub_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -540,8 +540,8 @@ def npolyf_res( layer=layer["lvpwell"], ) ) - lvpwell.xmin = r_inst.xmin - lvpwell_enc_cmp - lvpwell.ymin = r_inst.ymin - lvpwell_enc_cmp + lvpwell.dxmin = r_inst.dxmin - lvpwell_enc_cmp + lvpwell.dymin = r_inst.dymin - lvpwell_enc_cmp dn_rect = c.add_ref( gf.components.rectangle( @@ -552,8 +552,8 @@ def npolyf_res( layer=layer["dnwell"], ) ) - dn_rect.xmin = lvpwell.xmin - dn_enc_lvpwell - dn_rect.ymin = lvpwell.ymin - dn_enc_lvpwell + dn_rect.dxmin = lvpwell.dxmin - dn_enc_lvpwell + dn_rect.dymin = lvpwell.dymin - dn_enc_lvpwell if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=sub_w)) @@ -618,8 +618,8 @@ def ppolyf_res( layer=layer["dnwell"], ) ) - dn_rect.xmax = r_inst.xmax + dn_enc_poly2 - dn_rect.ymin = r_inst.ymin - dn_enc_poly2 + dn_rect.dxmax = r_inst.dxmax + dn_enc_poly2 + dn_rect.dymin = r_inst.dymin - dn_enc_poly2 if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=sub_w)) @@ -669,8 +669,8 @@ def ppolyf_u_high_Rs_res( ) ) - resis_mk.xmin = res_mk.xmin - resis_enc[0] - resis_mk.ymin = res_mk.ymin - resis_enc[1] + resis_mk.dxmin = res_mk.dxmin - resis_enc[0] + resis_mk.dymin = res_mk.dymin - resis_enc[1] sab_rect = c.add_ref( gf.components.rectangle( @@ -681,8 +681,8 @@ def ppolyf_u_high_Rs_res( layer=layer["sab"], ) ) - sab_rect.xmin = res_mk.xmin - sab_res_ext[0] - sab_rect.ymin = res_mk.ymin - sab_res_ext[1] + sab_rect.dxmin = res_mk.dxmin - sab_res_ext[0] + sab_rect.dymin = res_mk.dymin - sab_res_ext[1] pl = c.add_ref( gf.components.rectangle( @@ -690,12 +690,12 @@ def ppolyf_u_high_Rs_res( layer=layer["poly2"], ) ) - pl.xmin = res_mk.xmin - pl_res_ext - pl.ymin = res_mk.ymin + pl.dxmin = res_mk.dxmin - pl_res_ext + pl.dymin = res_mk.dymin pl_con = via_stack( - x_range=(pl.xmin, pl.xmin + con_size), - y_range=(pl.ymin, pl.ymax), + x_range=(pl.dxmin, pl.dxmin + con_size), + y_range=(pl.dymin, pl.dymax), base_layer=layer["poly2"], metal_level=1, ) @@ -716,20 +716,20 @@ def ppolyf_u_high_Rs_res( component=pplus, rows=1, columns=2, spacing=(pplus.size[0] + res_mk.size[0], 0) ) - pplus_arr.xmin = pl.xmin - pp_enc_poly2 - pplus_arr.ymin = pl.ymin - pp_enc_poly2 + pplus_arr.dxmin = pl.dxmin - pp_enc_poly2 + pplus_arr.dymin = pl.dymin - pp_enc_poly2 sub_rect = c.add_ref( gf.components.rectangle(size=(sub_w, w_res), layer=layer["comp"]) ) - sub_rect.xmax = pl.xmin - comp_spacing - sub_rect.ymin = pl.ymin + sub_rect.dxmax = pl.dxmin - comp_spacing + sub_rect.dymin = pl.dymin # sub_rect contact sub_con = c.add_ref( via_stack( - x_range=(sub_rect.xmin, sub_rect.xmax), - y_range=(sub_rect.ymin, sub_rect.ymax), + x_range=(sub_rect.dxmin, sub_rect.dxmax), + y_range=(sub_rect.dymin, sub_rect.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -740,16 +740,16 @@ def ppolyf_u_high_Rs_res( c.add_label( r0_label, position=( - pl_con_arr.xmin + (pl_con.size[0] / 2), - pl_con_arr.ymin + (pl_con.size[1] / 2), + pl_con_arr.dxmin + (pl_con.size[0] / 2), + pl_con_arr.dymin + (pl_con.size[1] / 2), ), layer=layer["metal1_label"], ) c.add_label( r1_label, position=( - pl_con_arr.xmax - (pl_con.size[0] / 2), - pl_con_arr.ymin + (pl_con.size[1] / 2), + pl_con_arr.dxmax - (pl_con.size[0] / 2), + pl_con_arr.dymin + (pl_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -757,8 +757,8 @@ def ppolyf_u_high_Rs_res( c.add_label( sub_label, position=( - sub_con.xmin + (sub_con.size[0] / 2), - sub_con.ymin + (sub_con.size[1] / 2), + sub_con.dxmin + (sub_con.size[0] / 2), + sub_con.dymin + (sub_con.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -777,21 +777,21 @@ def ppolyf_u_high_Rs_res( layer=sub_layer, ) ) - sub_imp.xmin = sub_rect.xmin - pp_enc_cmp - sub_imp.ymin = sub_rect.ymin - pp_enc_cmp + sub_imp.dxmin = sub_rect.dxmin - pp_enc_cmp + sub_imp.dymin = sub_rect.dymin - pp_enc_cmp if deepnwell == 1: dn_rect = c.add_ref( gf.components.rectangle( size=( - (pl.xmax - sub_rect.xmin) + (dn_enc_poly2 + dn_enc_ncmp), + (pl.dxmax - sub_rect.dxmin) + (dn_enc_poly2 + dn_enc_ncmp), pl.size[1] + (2 * dn_enc_poly2), ), layer=layer["dnwell"], ) ) - dn_rect.xmax = pl.xmax + dn_enc_poly2 - dn_rect.ymin = pl.ymin - dn_enc_poly2 + dn_rect.dxmax = pl.dxmax + dn_enc_poly2 + dn_rect.dymin = pl.dymin - dn_enc_poly2 if volt == "5/6V": dg = c.add_ref( @@ -804,8 +804,8 @@ def ppolyf_u_high_Rs_res( ) ) - dg.xmin = dn_rect.xmin - dg_enc_dn - dg.ymin = dn_rect.ymin - dg_enc_dn + dg.dxmin = dn_rect.dxmin - dg_enc_dn + dg.dymin = dn_rect.dymin - dg_enc_dn if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=sub_w)) @@ -818,8 +818,8 @@ def ppolyf_u_high_Rs_res( ) ) - dg.xmin = resis_mk.xmin - dg.ymin = resis_mk.ymin + dg.dxmin = resis_mk.dxmin + dg.dymin = resis_mk.dymin return c @@ -866,21 +866,21 @@ def well_res( size=(res_mk.size[0] + (2 * nw_res_ext), w_res), layer=well_layer ) ) - well_rect.xmin = res_mk.xmin - nw_res_ext - well_rect.ymin = res_mk.ymin + nw_res_enc + well_rect.dxmin = res_mk.dxmin - nw_res_ext + well_rect.dymin = res_mk.dymin + nw_res_enc @gf.cell def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: c = gf.Component() cmp = c.add_ref(gf.components.rectangle(size=size, layer=layer["comp"])) - cmp.xmin = well_rect.xmin + nw_enc_cmp - cmp.ymin = well_rect.ymin + nw_enc_cmp + cmp.dxmin = well_rect.dxmin + nw_enc_cmp + cmp.dymin = well_rect.dymin + nw_enc_cmp c.add_ref( via_stack( - x_range=(cmp.xmin, cmp.xmax), - y_range=(cmp.ymin, cmp.ymax), + x_range=(cmp.dxmin, cmp.dxmax), + y_range=(cmp.dymin, cmp.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -890,7 +890,7 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: con_polys = comp_related_gen( size=( - res_mk.xmin - well_rect.xmin - nw_enc_cmp, + res_mk.dxmin - well_rect.dxmin - nw_enc_cmp, well_rect.size[1] - (2 * nw_enc_cmp), ) ) @@ -915,20 +915,20 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: columns=2, spacing=(well_rect.size[0] - (2 * nw_enc_cmp) - con_polys.size[0], 0), ) - nplus_arr.xmin = con_polys.xmin - pp_enc_cmp - nplus_arr.ymin = con_polys.ymin - pp_enc_cmp + nplus_arr.dxmin = con_polys.dxmin - pp_enc_cmp + nplus_arr.dymin = con_polys.dymin - pp_enc_cmp sub_rect = c.add_ref( gf.components.rectangle(size=(sub_w, well_rect.size[1]), layer=layer["comp"]) ) - sub_rect.xmax = well_rect.xmin - nw_comp_spacing - sub_rect.ymin = well_rect.ymin + sub_rect.dxmax = well_rect.dxmin - nw_comp_spacing + sub_rect.dymin = well_rect.dymin # sub_rect contact sub_con = c.add_ref( via_stack( - x_range=(sub_rect.xmin, sub_rect.xmax), - y_range=(sub_rect.ymin, sub_rect.ymax), + x_range=(sub_rect.dxmin, sub_rect.dxmax), + y_range=(sub_rect.dymin, sub_rect.dymax), base_layer=layer["comp"], metal_level=1, ) @@ -943,8 +943,8 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: layer=sub_imp_layer, ) ) - sub_imp.xmin = sub_rect.xmin - pp_enc_cmp - sub_imp.ymin = sub_rect.ymin - pp_enc_cmp + sub_imp.dxmin = sub_rect.dxmin - pp_enc_cmp + sub_imp.dymin = sub_rect.dymin - pp_enc_cmp if res_type == "pwell": dn_rect = c.add_ref( @@ -956,8 +956,8 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: layer=layer["dnwell"], ) ) - dn_rect.xmin = well_rect.xmin - dn_enc_lvpwell - dn_rect.ymin = well_rect.ymin - dn_enc_lvpwell + dn_rect.dxmin = well_rect.dxmin - dn_enc_lvpwell + dn_rect.dymin = well_rect.dymin - dn_enc_lvpwell if pcmpgr == 1: c.add_ref(pcmpgr_gen(dn_rect=dn_rect, grw=sub_w)) @@ -967,16 +967,16 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: c.add_label( r0_label, position=( - con_polys_arr.xmin + (con_polys.size[0] / 2), - con_polys_arr.ymin + (con_polys.size[1] / 2), + con_polys_arr.dxmin + (con_polys.size[0] / 2), + con_polys_arr.dymin + (con_polys.size[1] / 2), ), layer=layer["metal1_label"], ) c.add_label( r1_label, position=( - con_polys_arr.xmax - (con_polys.size[0] / 2), - con_polys_arr.ymin + (con_polys.size[1] / 2), + con_polys_arr.dxmax - (con_polys.size[0] / 2), + con_polys_arr.dymin + (con_polys.size[1] / 2), ), layer=layer["metal1_label"], ) @@ -984,8 +984,8 @@ def comp_related_gen(size: Float2 = (0.42, 0.42)) -> gf.Component: c.add_label( sub_label, position=( - sub_con.xmin + (sub_con.size[0] / 2), - sub_con.ymin + (sub_con.size[1] / 2), + sub_con.dxmin + (sub_con.size[0] / 2), + sub_con.dymin + (sub_con.size[1] / 2), ), layer=layer["metal1_label"], ) diff --git a/gf180/via_generator.py b/gf180/via_generator.py index 103daae..6e32bf7 100644 --- a/gf180/via_generator.py +++ b/gf180/via_generator.py @@ -20,8 +20,8 @@ def via_generator( and set number of rows and number of columns according to ranges and via size and spacing Args: - x_range: x range. - y_range: y range. + x_range: dx range. + y_range: dy range. via_size: via size. via_layer: via layer. via_enclosure: via enclosure. @@ -50,10 +50,10 @@ def via_generator( via_arr = c.add_array(rect_via, rows=nr, columns=nc, spacing=via_sp) - via_arr.move((x_range[0], y_range[0])) + via_arr.dmove((x_range[0], y_range[0])) - via_arr.movex((width - nc * via_size[0] - (nc - 1) * via_spacing[0]) / 2) - via_arr.movey((length - nr * via_size[1] - (nr - 1) * via_spacing[1]) / 2) + via_arr.dmovex((width - nc * via_size[0] - (nc - 1) * via_spacing[0]) / 2) + via_arr.dmovey((length - nr * via_size[1] - (nr - 1) * via_spacing[1]) / 2) return c @@ -75,8 +75,8 @@ def via_stack( """Returns a via stack withen the range xrange and yrange and expecting the base_layer to be drawen Args: - x_range: x range. - y_range: y range. + x_range: dx range. + y_range: dy range. metal_level: metal level. con_size: contact size. con_enc: contact enclosure. @@ -109,13 +109,13 @@ def via_stack( m1_x = con.size[0] + 2 * m_enc m1_y = con.size[1] + 2 * m_enc m1 = c.add_ref(gf.components.rectangle(size=(m1_x, m1_y), layer=base_layer)) - m1.xmin = con.xmin - m_enc - m1.ymin = con.ymin - m_enc + m1.dxmin = con.dxmin - m_enc + m1.dymin = con.dymin - m_enc if metal_level >= 2: via1_gen = via_generator( - x_range=(m1.xmin, m1.xmax), - y_range=(m1.ymin, m1.ymax), + x_range=(m1.dxmin, m1.dxmax), + y_range=(m1.dymin, m1.dymax), via_size=via_size, via_enclosure=via_enc, via_layer=layer["via1"], @@ -123,29 +123,29 @@ def via_stack( ) via1 = c.add_ref(via1_gen) - if (via1.xmax - via1.xmin + 2 * m_enc[0]) < ( + if (via1.dxmax - via1.dxmin + 2 * m_enc[0]) < ( via_size[0] + 2 * via_enc[0] ) and metal_level >= 3: m2_x = via_size[0] + 2 * via_enc[0] else: - m2_x = via1.xmax - via1.xmin + 2 * m_enc[0] + m2_x = via1.dxmax - via1.dxmin + 2 * m_enc[0] - if (via1.ymax - via1.ymin + 2 * m_enc[1]) < ( + if (via1.dymax - via1.dymin + 2 * m_enc[1]) < ( via_size[1] + 2 * via_enc[1] ) and metal_level >= 3: m2_y = via_size[1] + 2 * via_enc[1] else: - m2_y = via1.ymax - via1.ymin + 2 * m_enc[1] + m2_y = via1.dymax - via1.dymin + 2 * m_enc[1] - m2_mx = (m2_x - (via1.xmax - via1.xmin)) / 2 - m2_my = (m2_y - (via1.ymax - via1.ymin)) / 2 + m2_mx = (m2_x - (via1.dxmax - via1.dxmin)) / 2 + m2_my = (m2_y - (via1.dymax - via1.dymin)) / 2 m2 = c.add_ref( gf.components.rectangle(size=(m2_x, m2_y), layer=layer["metal2"]) ) - m2.move((via1.xmin - m2_mx, via1.ymin - m2_my)) + m2.dmove((via1.dxmin - m2_mx, via1.dymin - m2_my)) return c diff --git a/pyproject.toml b/pyproject.toml index a56d1fa..4ea1d50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ classifiers = [ "Operating System :: OS Independent" ] dependencies = [ - "gdsfactory~=7.26.1" + "gdsfactory~=8.7.3" ] description = "GlobalFoundries 180nm MCU" keywords = ["python"] diff --git a/tests/gds_ref/alter_interdig_alter_in_a0369a3e.gds b/tests/gds_ref/alter_interdig_alter_in_a0369a3e.gds new file mode 100644 index 0000000000000000000000000000000000000000..20e9ef755d1c0bee3d3b009f412f7ab5356a52ad GIT binary patch literal 3048 zcmchZ%TC)+5QZlqG2vD&rL>h;L`u{^n}%a2gv3%SQ7#fHmjx^k2pt*6PA!aM*@iY% z*OmGV-LUH`^a=VbUG@bkdM>#(J`QD3Btl5$_so3$J!e3Ic>EX^V{s7uq~g-<&KrRF zk>u<3FKcgqeEU`1{JwJY_2dW^lVaV1BxSSNjf4H8t>YuSv%h^n{)I#eK$@Z|=>dJs z&y0u?4}31Yh(jC-d1-I!XniSnVQPBN@S3V`1cBw$ef8S#e5>K)mS5#iL9P@^IiQ+Y zl;+Y1G;B7!OD&+fYlUk7%Hlj1w$^N11-LJtQZ20JATbM&7zfDCNuHqxnp3w8d|1NB zEmrU@OC}q|RkMr?nC$7D*7+2WIHzxYG)RF8f)e|U*Rc^xzaL{zA zG-uePBG1w_oA>w_wudMio@F?J77(aDOK!^*l+V~z`a*wSR?#x6VgZ)K*CMzKkLWYD zEVJlGkQYbmB&FdQH6k!I+c%hE9-a>9-XmVb0I|AS|L!ToP}q?Djn^T--VVdXP_dCZ38=HZ&YdsoDkAb)ZsM7 zh3=4hXms5%Cd?)e@Tj)TL0Fz~Z>5ApLJqhM?&Zi zG{A#QfON|q%v&Qu8fXZOxR3_w(vaITT=cY{JNN@aP5|@D(dl5rZ7X)>b>9@%Y%+|n zMMqN2s^i1WZ5D@Xx>-3lE2V)cJ{jW0&I#q$uuUfw9pGi|rU^J1m;=4>HOn-KB**iz z^JK4H^IM0Xt2Zv)hC@cC?{*r%hr9G+PHsHJ37zY^I{whAhfn6Q5K_I-zN_ivtnJgJ z;Ip^`S65i|n&)XvEU27+*=YqIZrr!q(db&_|5=L^$x;gfY-{HR^+WfZOF}k+CEro_ zeN99~I?QD@zo#RSkku+42A;$ICoV_!DY{dQ zLgcoYm4@$I?cFmg+C5{R0H$vM+JAdC&^y-9Uwg>3_{ZJw_V%}ZznwDmv%@WsfIt1V BE-U~5 literal 0 HcmV?d00001 diff --git a/tests/gds_ref/labels_gen_labels_gen_L_f6da3bfa.gds b/tests/gds_ref/labels_gen_labels_gen_L_f6da3bfa.gds new file mode 100644 index 0000000000000000000000000000000000000000..2bcad70c14c315ec214a7a81eaa2a474f07f7fbd GIT binary patch literal 874 zcmah{K~BOz6#bMk5TizoamB7p3QB4rV1+~zR7{8nCU!yGOe#!C!_bm;AaVrH;KrR- z@C2U6BRJD8)R2}*W|En__y2qU4Iq%DArvzbB&~vkdfh94!))%d{c7HQeS9}>K2P7@ zo-8Qll6gl6sj7NC=v$qkg}eRR0l$J=06;r}g?7bR*~=z1UVBF;5=fv|(0#{hm$a#4 zkC-2X2oINrnynb4)h6PGsPIo7dhNaFgLG#9QnCNGg1BSr%lYigW@HxeVoo;@Q%$ZujA TPf;Y9htxl=qRlCb8nO&O@KMIG literal 0 HcmV?d00001 diff --git a/tests/gds_ref/nfet_deep_nwell_nfet_de_970c9e54.gds b/tests/gds_ref/nfet_deep_nwell_nfet_de_970c9e54.gds new file mode 100644 index 0000000000000000000000000000000000000000..9d762fee1a703eae1debd0850f32ffe06b4293c8 GIT binary patch literal 840 zcmaiyPfo%>6o((BjKru>V_dPLNkK`KifBnRL4ky*u<3%hnT$9k4gEvf0mK`41~=}! zf+z4i9>JMHj7nN&G09Bw&G+8#4Iq%D9^_II#I3A^ZrfJ?d+E$&{pIZD^Zmp;K z-kXri#B=)yDT;F4?U>D;iQAo4mmfjS0-#Mnp)IkOw$pLqrF(QJfdpC!-8Id6K^<2^%%%=|IK ze|);3ovI-30LbeA$}aLO%J3tlBkWD7~Dl7SS}P$rKQwoE6Q z;}bZ_P_jyf^yCuk3CG5`&iRY(_K4%;%NpK7n}Zx532A64G!}(4 zG<}=~%2S3aXAcl_IHkN*1xPb@_x ld(V!~FKeRn%ajT*dXJo9_}L&khq2s~efK}-i#WC{!#~3NemMXD literal 0 HcmV?d00001 diff --git a/tests/gds_ref/via_generator_via_gener_cc16eff4.gds b/tests/gds_ref/via_generator_via_gener_cc16eff4.gds new file mode 100644 index 0000000000000000000000000000000000000000..788875e0e2eb3fcb7ec6c2a494c7476cefc68c32 GIT binary patch literal 2540 zcma);+iuf95Qe9Y zTc2zDzrO!&JpZ}z?aSLHtY*c!6-6l&3eS!Xn>)u%YwvLPh<*h*2cXP`DrGJ_tMeJr z!m;0#hZ0CoR+X1K&8<@LyoK$c>-9~a1VP7b`{ot#{7%;`u0JWFvQ{rwiV$ih(li$& zz*ej4UEm+duhX0GKP#(5uf@tS_;6QKc?@_CwCP34z$mft<7h;_ZL7g#~R7mAC-p)q+K z8#_G9yRdtMvg>t-8{mLq_1W@{R!3^yX@sZnc+@~ViWNZO|DwQ%$MuFmRh7y*tpJ+y z9ZT89tb0J@de+BL2b?_P#eZKgm%JiOvBiyRCsK+g$(or26Mtp zbn{;ZXpNFn>s7waY>G0S!HkfBZjKmi@+zDbGSE#igDD{cErG$Ug!h?q)?y4AtPCiJ zQ(mJvAqCA$r!Xm`pp7XE97hpS&{8O5g%nT%1zDI0icz5N`P#S=GAYV*29l5g8Z*#_ zP966UzDp>D0VMc)>(aGD)3S!eHge;LM_+ZY)g~_SFzqDP@hfC$)*E`(QG-+)n8Z9f zX_rR*r*Bb5X>*%q=BN!^E}O8oBh^QdN(M9LBO_H9x!=P!ZG6mEqiuotP$r?~qk3^q zkrMVhq8+}NrMwe$^a*&J9yM`or|VyOqjrX9N1)*&V?YZM`e1B7BReQNaRU1Cr|(1{E%CcAVVjjRW?WL(?I^v;o}9r P0{x!(%I6UplPtqua6flS literal 0 HcmV?d00001