def attach_taper(cell : Device , port : Port , length : float , \ width2 : float, layer=LayoutDefault.layerTop) : t = pg.taper(length=length, width1=port.width, width2=width2, layer=layer) t_ref = cell.add_ref(t) t_ref.connect(1, destination=port) new_port = t_ref.ports[2] new_port.name = port.name cell.absorb(t_ref) cell.remove(port) cell.add_port(new_port)
def draw(self): ''' Generates layout cell based on current parameters. 'conn' port is included in the cell. Returns ------- cell : phidl.Device. ''' self._check_anchor() o = self.origin anchor=pg.rectangle(\ size=(self.size-Point(2*self.etch_margin.x,-2*self.etch_margin.y)).coord,\ layer=self.layer) etch_size=Point(\ (self.etch_x-self.size.x)/2,\ self.size.y) offset = Point(self.x_offset, 0) cell = Device(self.name) etch_sx=pg.rectangle(\ size=(etch_size-offset).coord,\ layer=self.etch_layer) etch_dx=pg.rectangle(\ size=(etch_size+offset).coord,\ layer=self.etch_layer) etch_sx_ref=(cell<<etch_sx).move(origin=(0,0),\ destination=(o-Point(0,self.etch_margin.y)).coord) anchor_transl = o + Point(etch_sx.size[0] + self.etch_margin.x, -2 * self.etch_margin.y) anchor_ref=(cell<<anchor).move(origin=(0,0),\ destination=anchor_transl.coord) etchdx_transl = anchor_transl + Point( anchor.size[0] + self.etch_margin.x, +self.etch_margin.y) etch_dx_ref=(cell<<etch_dx).move(origin=(0,0),\ destination=etchdx_transl.coord) cell.add_port(name='conn',\ midpoint=(anchor_transl+Point(self.size.x/2-self.etch_margin.x,self.size.y+2*self.etch_margin.y)).coord,\ width=self.metalized.x,\ orientation=90) if self.etch_choice == True: cell.absorb(etch_sx_ref) cell.absorb(anchor_ref) cell.absorb(etch_dx_ref) else: cell.remove(etch_sx_ref) cell.remove(etch_dx_ref) del anchor, etch_sx, etch_dx return cell