def _normalize(self): if self._normalized == True: raise ValueError("Already normalized") p = self.idt.pitch active_area_x = self.idt.active_area.x anchor_x = self.anchor.size.x anchor_y = self.anchor.size.y self.idt.y_offset = self.idt.y_offset / p # self.idt.length=self.idt.length/p self.bus.size = pt.Point(self.bus.size.x, self.bus.size.y / p) self.etchpit.x = self.etchpit.x / active_area_x self.anchor.size = pt.Point(self.anchor.size.x / active_area_x, self.anchor.size.y / p) self.anchor.metalized = pt.Point( self.anchor.metalized.x / anchor_x, self.anchor.metalized.y / anchor_y) self._normalized = True
def _denormalize(self): if self._normalized == False: raise ValueError("Already denormalized") p = self.idt.pitch self.idt.y_offset = self.idt.y_offset * p self.bus.size = pt.Point(self.bus.size.x, self.bus.size.y * p) active_area_x = self.idt.active_area.x self.etchpit.x = self.etchpit.x * active_area_x self.anchor.size=pt.Point(\ self.anchor.size.x*active_area_x,\ self.anchor.size.y*p) self.anchor.metalized = pt.Point( self.anchor.metalized.x * self.anchor.size.x, self.anchor.metalized.y * self.anchor.size.y) self._normalized = False return self
def probe_dut_distance(self): base_dist=self.idt.probe_distance if hasattr(self,'pad'): base_dist=pt.Point(base_dist.x,self.pad.size+self.pad.distance+base_dist.y) if hasattr(self.probe,'pad'): base_dist=pt.Point(base_dist.x,self.probe.pad.size+self.probe.pad.distance+base_dist.y) return base_dist
def _setup_probe(self,device_cell): top_ports=[pt.Point(p.midpoint) for p in ppt.find_ports(device_cell,'top',depth=0)] bottom_ports=[pt.Point(p.midpoint) for p in ppt.find_ports(device_cell,'bottom',depth=0)] top_port_midpoint=st.get_centroid(*top_ports) bottom_port_midpoint=st.get_centroid(*bottom_ports) self.probe.offset=pt.Point( (top_port_midpoint.x-bottom_port_midpoint.x), (top_port_midpoint.y-bottom_port_midpoint.y)+2*self.probe_dut_distance.y)
def _bbox_mod(self, bbox): LayoutPart._bbox_mod(self, bbox) ll = pt.Point(bbox[0]) ur = pt.Point(bbox[1]) if any([_ == 'top' for _ in side]): ur = ur - pt.Point(0, float(self.pad.size + self.pad.distance)) if any([_ == 'bottom' for _ in side]): ll = ll + pt.Point(0, float(self.pad.size + self.pad.distance)) return (ll.coord, ur.coord)
def probe_conn_distance(self): tot_distance = self.probe_dut_distance return pt.Point(tot_distance.x, tot_distance.y * 3 / 4)
def active_area(self): active_area = super().active_area return pt.Point(active_area.x * self.n_blocks, active_area.y)
def connect_ports(cell: Device, tag: str = 'top', layers: tuple = (LayoutDefault.layerTop, ), distance: float = 10.0, metal_width: float = None): ''' connects all the ports in the cell with name matching a tag. Parameters: ----------- cell : Device tag: str conn_dist: pt.Point offset from port location layer : tuple. Returns: ---------- cell : Device contains routings and connection port ''' import pirel.pcells as pc ports = pt._find_ports(cell, tag, depth=0) ports.sort(key=lambda x: x.midpoint[0]) ports_centroid = pt._get_centroid_ports(ports) if len(ports) == 1: raise ValueError("pm.connect_ports() : len(ports) must be >1 ") if metal_width is None: metal_width = ports_centroid.width port_mid_norm = pt.Point(ports_centroid.normal[1]) - pt.Point( ports_centroid.normal[0]) midpoint_projected = Point( ports_centroid.midpoint) + port_mid_norm * (distance + metal_width) pad_side = ports_centroid.width new_port = Port(name=tag, orientation=ports_centroid.orientation, width=ports_centroid.width, midpoint=midpoint_projected.coord) output_cell = Device() for p in ports: straight_conn = output_cell << pt._draw_multilayer( 'compass', layers, size=(p.width, abs(midpoint_projected.y - p.midpoint[1]))) straight_conn.connect("S", p) cross_conn = output_cell << pt._draw_multilayer( 'compass', layers, size=(output_cell.xsize, metal_width)) cross_conn.connect('S', new_port, overlap=metal_width) output = pt.join(output_cell) output.add_port(new_port) return output
def __init__(self, *a, **kw): super().__init__(*a, **kw) self.connector_distance = pt.Point(0, 100)
import pirel.tools as pt import pirel.addOns.standard_parts as ps # t=pc.TwoPortRes('hey') # # t.view() # exit() t_aux = pm.addTwoPortProbe(pm.makeArray(pm.makeScaled(pc.TwoPortRes), 2), probe=pm.makeTwoPortProbe( pm.addLargeGround(pc.GSGProbe)))('hey') # t_aux=pm.makeSMDCoupledFilter(pc.TwoPortRes, # smd=pm.addPassivation(pc.SMD))('hey') # t_aux=pm.addPassivation(pc.SMD)('hey') # t_aux['Layer']=pt.LayoutDefault.layerBottom t_aux.spacing = pt.Point(0, 250) t_aux.gnd_routing_width = 150 # t_aux.smd.passivation_layer=(3,) # t_aux.smd.set_01005() # t_aux.smd.passivation_scale=pt.Point(2.5,1.5) # t_aux.smd.passivation_margin=pt.Point(50,50) t_aux.anchor.n = 1 t_aux.gndvia.size = 25 # t_aux.anchor.n=1 # t_aux.probe.ground_size=200 # t_aux['IDTLength']=250 # t_aux['AnchorSizeX']=0.2 # t_aux['AnchorSizeY']=5 # t_aux['IDTPitch']=7 # print(t)
import pirel.addOns.standard_parts as ps # t=pc.TwoPortRes('hey') # # t.view() # exit() t_aux = pm.addTwoPortProbe( pm.makeSMDCoupledFilter(pm.makeArray(pm.makeScaled(pc.TwoPortRes), 2), smd=pm.addPassivation(pc.SMD)), probe=pm.makeTwoPortProbe(pm.addLargeGround(pc.GSGProbe)))('hey') # t_aux=pm.makeSMDCoupledFilter(pc.TwoPortRes, # smd=pm.addPassivation(pc.SMD))('hey') # t_aux=pm.addPassivation(pc.SMD)('hey') # t_aux['Layer']=pt.LayoutDefault.layerBottom t_aux.spacing = pt.Point(0, 250) t_aux.gnd_routing_width = 150 t_aux.smd.passivation_layer = (3, ) t_aux.smd.set_01005() t_aux.smd.passivation_scale = pt.Point(2.5, 1.5) t_aux.smd.passivation_margin = pt.Point(50, 50) t_aux.anchor.n = 1 t_aux.gndvia.size = 25 # t_aux.anchor.n=1 # t_aux.probe.ground_size=200 # t_aux['IDTLength']=250 # t_aux['AnchorSizeX']=0.2 # t_aux['AnchorSizeY']=5 # t_aux['IDTPitch']=7 # print(t)