def _draw_padded_via(self): viaref=DeviceReference(self.via.draw()) size=float(self.via.size*self.over_via) port=viaref.ports['conn'] trace=pg.rectangle(size=(size,size),layer=self.pad_layers[0]) trace.move(origin=trace.center,\ destination=viaref.center) trace2=pg.copy_layer(trace,layer=self.pad_layers[0],new_layer=self.pad_layers[1]) cell=Device(self.name) cell.absorb(cell<<trace) cell.absorb(cell<<trace2) cell.add(viaref) port.midpoint=(port.midpoint[0],cell.ymax) port.width=size cell.add_port(port) if bottom_conn==False: cell.remove_layers(layers=[self.pad_layers[1]]) return cell
def _draw_signal_routing(self): cell = Device() cell.add(self.sig1trace.draw()) cell.add(self.sig2trace.draw()) return cell
def _draw_ground_extensions(self,cell): device_cell=cell["Device"] output_cell=Device() lx_device_ports=[] rx_device_ports=[] gnd_ports=ppt.find_ports(device_cell,'Ground',depth=0) if not gnd_ports: return output_cell for p in gnd_ports: if "LX" in p.name: lx_device_ports.append(p) elif "RX" in p.name: rx_device_ports.append(p) for p in lx_device_ports: ext_length=abs(cell.xmin-p.midpoint[0]+self.gnd_routing_width) output_cell.add(ppt.extend_port(p, width=p.width, length=ext_length, layer=self.gndlefttrace.layer)) for p in rx_device_ports: ext_length=abs(cell.xmax-p.midpoint[0]-self.gnd_routing_width) output_cell.add(ppt.extend_port(p, width=p.width, length=ext_length, layer=self.gndlefttrace.layer)) return output_cell
def from_phidl(component: Device, **kwargs) -> Component: """Returns gf.Component from a phidl Device or function""" device = call_if_func(component, **kwargs) component = Component(name=device.name) for ref in device.references: new_ref = ComponentReference( component=ref.parent, origin=ref.origin, rotation=ref.rotation, magnification=ref.magnification, x_reflection=ref.x_reflection, ) new_ref.owner = component component.add(new_ref) for alias_name, alias_ref in device.aliases.items(): if alias_ref == ref: component.aliases[alias_name] = new_ref for p in device.ports.values(): component.add_port( port=Port( name=p.name, midpoint=p.midpoint, width=p.width, orientation=p.orientation, parent=p.parent, ) ) for poly in device.polygons: component.add_polygon(poly) for label in device.labels: component.add_label( text=label.text, position=label.position, layer=(label.layer, label.texttype), ) return component
def alignment_marks_4layers(scale=[0.2, 0.5, 1]): def dr(cell): return DeviceReference(cell) BElayer = pt.LayoutDefault.layerBottom TElayer = pt.LayoutDefault.layerTop VIAlayer = pt.LayoutDefault.layerVias ETCHlayer = pt.LayoutDefault.layerEtch PETCHlayer = pt.LayoutDefault.layerPartialEtch Zerolayer = pt.LayoutDefault.layerPad align1 = verniers(scale, layers=[BElayer, VIAlayer], label='VIA', reversed=True) align_ph = pg.bbox(align1.bbox) #only for space align2 = verniers(scale, layers=[BElayer, TElayer], label='TE') align3 = verniers(scale, layers=[BElayer, ETCHlayer], label='ETCH') align4 = verniers(scale, layers=[BElayer, PETCHlayer], label='PETCH') text = pc.Text() text.size = 300 text.layer = (BElayer, TElayer, ETCHlayer, PETCHlayer, VIAlayer) text.label = "Align to BE" t1 = text.draw() g = Group([align1, dr(align_ph), align2, align3, align4, t1]) g.distribute(direction='x', spacing=150) g.align(alignment='y') align5 = verniers(scale, layers=[TElayer, VIAlayer], label='VIA', reversed=True) align6 = verniers(scale, layers=[TElayer, ETCHlayer], label='ETCH') align7 = verniers(scale, layers=[TElayer, PETCHlayer], label='PETCH') text.layer = (TElayer, ETCHlayer, PETCHlayer, VIAlayer) text.label = 'Align to TE' t2 = text.draw() g2 = Group([align5, dr(align_ph), dr(align_ph), align6, align7, t2]) g2.distribute(direction='x', spacing=150) g2.align(alignment='y') align8 = verniers(scale, layers=[Zerolayer, VIAlayer], label='VIA', reversed=True) align9 = verniers(scale, layers=[Zerolayer, BElayer], label='BE') align10 = verniers(scale, layers=[Zerolayer, TElayer], label='TE') align11 = verniers(scale, layers=[Zerolayer, ETCHlayer], label='ETCH') align12 = verniers(scale, layers=[Zerolayer, PETCHlayer], label='PETCH') text.layer = (Zerolayer, BElayer, TElayer, ETCHlayer, PETCHlayer, VIAlayer) text.label = "Align to Pad" t3 = text.draw() g3 = Group([align8, align9, align10, align11, align12, t3]) g3.distribute(direction='x', spacing=150) g3.align(alignment='y') g_tot = Group([g, g2, g3]) g_tot.distribute(direction='y', spacing=150) g_tot.align(alignment='xmin') cell = Device("Alignments") for c in [align1, align2, align3, align4, t1]: cell.add(c) for c in [align5, align6, align7, t2]: cell.add(c) for c in [align8, align9, align10, align11, align12, t3]: cell.add(c) return cell