-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ab4b25
commit e343b98
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
.../generators/glayout/glayout/flow/blocks/elementary/transmission_gate/transmission_gate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,83 @@ | ||
from glayout.flow.pdk.mappedpdk import MappedPDK | ||
from glayout.flow.pdk.sky130_mapped import sky130_mapped_pdk | ||
from gdsfactory.cell import cell | ||
from gdsfactory.component import Component | ||
from gdsfactory import Component | ||
from glayout.flow.primitives.fet import nmos, pmos, multiplier | ||
from glayout.flow.pdk.util.comp_utils import evaluate_bbox, prec_center | ||
from glayout.flow.pdk.util.snap_to_grid import component_snap_to_grid | ||
from glayout.flow.pdk.util.port_utils import rename_ports_by_orientation | ||
from glayout.flow.routing.straight_route import straight_route | ||
from glayout.flow.routing.c_route import c_route | ||
from glayout.flow.routing.L_route import L_route | ||
from glayout.flow.primitives.guardring import tapring | ||
from glayout.flow.pdk.util.port_utils import add_ports_perimeter | ||
from glayout.flow.spice.netlist import Netlist | ||
from glayout.flow.primitives.via_gen import via_stack | ||
from gdsfactory.components import text_freetype, rectangle | ||
|
||
def tg_netlist(nfet: Component, pfet: Component) -> Netlist: | ||
|
||
netlist = Netlist(circuit_name='Transmission_Gate', nodes=['VIN', 'VSS', 'VOUT', 'VCC']) | ||
netlist.connect_netlist(nfet.info['netlist'], [('D', 'VOUT'), ('G', 'VCC'), ('S', 'VIN'), ('B', 'VSS')]) | ||
netlist.connect_netlist(pfet.info['netlist'], [('D', 'VOUT'), ('G', 'VSS'), ('S', 'VIN'), ('B', 'VCC')]) | ||
|
||
return netlist | ||
|
||
@cell | ||
def transmission_gate( | ||
pdk: MappedPDK, | ||
width: tuple[float,float] = (1,1), | ||
length: tuple[float,float] = (None,None), | ||
fingers: tuple[int,int] = (1,1), | ||
multipliers: tuple[int,int] = (1,1), | ||
substrate_tap: bool = False, | ||
tie_layers: tuple[str,str] = ("met2","met1"), | ||
**kwargs | ||
) -> Component: | ||
""" | ||
creates a transmission gate | ||
tuples are in (NMOS,PMOS) order | ||
**kwargs are any kwarg that is supported by nmos and pmos | ||
""" | ||
|
||
#top level component | ||
top_level = Component(name="transmission_gate") | ||
|
||
#two fets | ||
nfet = nmos(pdk, width=width[0], fingers=fingers[0], multipliers=multipliers[0], with_dummy=True, with_dnwell=False, with_substrate_tap=False, length=length[0], **kwargs) | ||
pfet = pmos(pdk, width=width[1], fingers=fingers[1], multipliers=multipliers[1], with_dummy=True, with_substrate_tap=False, length=length[1], **kwargs) | ||
nfet_ref = top_level << nfet | ||
pfet_ref = top_level << pfet | ||
pfet_ref = rename_ports_by_orientation(pfet_ref.mirror_y()) | ||
|
||
#Relative move | ||
pfet_ref.movey(nfet_ref.ymax + evaluate_bbox(pfet_ref)[1]/2 + pdk.util_max_metal_seperation()) | ||
|
||
#Routing | ||
top_level << c_route(pdk, nfet_ref.ports["multiplier_0_source_E"], pfet_ref.ports["multiplier_0_source_E"]) | ||
top_level << c_route(pdk, nfet_ref.ports["multiplier_0_drain_W"], pfet_ref.ports["multiplier_0_drain_W"], viaoffset=False) | ||
|
||
#Renaming Ports | ||
top_level.add_ports(nfet_ref.get_ports_list(), prefix="N_") | ||
top_level.add_ports(pfet_ref.get_ports_list(), prefix="P_") | ||
|
||
#substrate tap | ||
if substrate_tap: | ||
substrate_tap_encloses =((evaluate_bbox(top_level)[0]+pdk.util_max_metal_seperation()), (evaluate_bbox(top_level)[1]+pdk.util_max_metal_seperation())) | ||
guardring_ref = top_level << tapring( | ||
pdk, | ||
enclosed_rectangle=substrate_tap_encloses, | ||
sdlayer="p+s/d", | ||
horizontal_glayer='met2', | ||
vertical_glayer='met1', | ||
) | ||
guardring_ref.move(nfet_ref.center).movey(evaluate_bbox(pfet_ref)[1]/2 + pdk.util_max_metal_seperation()/2) | ||
top_level.add_ports(guardring_ref.get_ports_list(),prefix="tap_") | ||
|
||
component = component_snap_to_grid(rename_ports_by_orientation(top_level)) | ||
component.info['netlist'] = tg_netlist(nfet, pfet) | ||
|
||
|
||
return component | ||
|