Skip to content

Commit

Permalink
Updating the ports list after moving the M2 device so that c/smart ro…
Browse files Browse the repository at this point in the history
…uting can be done.
  • Loading branch information
sud_ana committed Jul 25, 2024
1 parent cf7c940 commit 19ea580
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from glayout.flow.primitives.guardring import tapring

from glayout.flow.pdk.util.comp_utils import prec_ref_center, prec_center, movey, evaluate_bbox
from glayout.flow.pdk.util.port_utils import remove_ports_with_prefix
from glayout.flow.routing.smart_route import smart_route
from glayout.flow.routing.c_route import c_route
from glayout.flow.routing.straight_route import straight_route
Expand All @@ -19,8 +20,8 @@ def Cascode_CS(pdk: MappedPDK, L1, W1, L2, W2, cs_type="nfet"):

# Add two nfets for the cascode.
if (cs_type=="nfet"):
fet_M1=nmos(pdk, length=L1, width=W1, with_tie=False, sd_route_topmet="met3", gate_route_topmet="met3")
fet_M2=nmos(pdk, length=L2, width=W2, with_tie=False, sd_route_topmet="met3", gate_route_topmet="met3")
fet_M1=nmos(pdk, length=L1, width=W1, with_tie=False)#, sd_route_topmet="met3", gate_route_topmet="met3")
fet_M2=nmos(pdk, length=L2, width=W2, with_tie=False)#, sd_route_topmet="met3", gate_route_topmet="met3")
elif (cs_type=="pfet"):
fet_M1=pmos(pdk, length=L1, width=W1)
fet_M2=pmos(pdk, length=L2, width=W2)
Expand All @@ -37,15 +38,15 @@ def Cascode_CS(pdk: MappedPDK, L1, W1, L2, W2, cs_type="nfet"):
M1_dim = prec_ref_center(M1_ref)
M2_dim = prec_ref_center(M2_ref)
movey(M2_ref, 0.5*(evaluate_bbox(M1_ref)[1]+evaluate_bbox(M2_ref)[1]) + pdk.util_max_metal_seperation())
# Remove ports and add them after moving a component as positions need to be updated from the movement
remove_ports_with_prefix(Cascode_CS, "M2_")
Cascode_CS.add_ports(M2_ref.get_ports_list(), prefix="M2_")

# Routing the Source of M2 to drain of M1:
Cascode_CS << c_route(pdk,
Cascode_CS.ports["M2_multiplier_0_source_W"],
Cascode_CS.ports["M1_multiplier_0_drain_W"])
# Cascode_CS << smart_route(pdk,
# Cascode_CS.ports["M1_multiplier_0_drain_N"],
# Cascode_CS.ports["M2_multiplier_0_source_S"],
# M1_ref, M2_ref)
Cascode_CS << smart_route(pdk,
Cascode_CS.ports["M1_multiplier_0_drain_N"],
Cascode_CS.ports["M2_multiplier_0_source_S"],
M1_ref, M2_ref)

# Add a guard tap ring around the cascode
shift_amount = -prec_center(Cascode_CS.flatten())[1]
Expand All @@ -57,7 +58,7 @@ def Cascode_CS(pdk: MappedPDK, L1, W1, L2, W2, cs_type="nfet"):
return Cascode_CS

mapped_pdk_build = sky130_mapped_pdk
Cascode_cs_component = Cascode_CS(mapped_pdk_build,2,3,4,6)
Cascode_cs_component = Cascode_CS(mapped_pdk_build,2,3,4,6, cs_type="pfet")
Cascode_cs_component.show()

magic_drc_result = sky130_mapped_pdk.drc_magic(Cascode_cs_component, Cascode_cs_component.name)
Expand Down

0 comments on commit 19ea580

Please sign in to comment.