class Resistor(spira.PCell): width = spira.NumberParameter(default=spira.RDD.R1.MIN_WIDTH, doc='Width of the shunt resistance.') length = spira.NumberParameter(default=spira.RDD.R1.MIN_LENGTH, doc='Length of the shunt resistance.') def validate_parameters(self): if self.width > self.length: raise ValueError('`Width` cannot be larger than `length`.') return True def create_elements(self, elems): elems += spira.Box(width=self.length, height=self.width, center=(0, 0), layer=spira.RDD.PLAYER.R1.METAL) return elems def create_ports(self, ports): w, l = self.width, self.length ports += spira.Port(name='P1_R1', midpoint=(-l / 2, 0), orientation=180, width=self.width) ports += spira.Port(name='P2', midpoint=(l / 2, 0), orientation=0, width=self.width, process=spira.RDD.PROCESS.R1) return ports
class Resistor(spira.PCell): width = spira.NumberParameter(default=spira.RDD.R1.MIN_WIDTH, doc='Width of the shunt resistance.') length = spira.NumberParameter(default=spira.RDD.R1.MIN_LENGTH, doc='Length of the shunt resistance.') def validate_parameters(self): if self.width > self.length: raise ValueError('`Width` cannot be larger than `length`.') return True def create_elements(self, elems): elems += spira.Box(alias='ply1', width=self.length, height=self.width, center=(0, 0), layer=spira.RDD.PLAYER.R1.METAL) return elems def create_ports(self, ports): # Process symbol will automatically be added to the port name. ports += self.elements['ply1'].ports['E1_R1'].copy(name='P1') ports += self.elements['ply1'].ports['E3_R1'].copy(name='P2') return ports
class Resistor(spira.PCell): width = spira.NumberParameter(default=spira.RDD.R1.MIN_WIDTH, doc='Width of the shunt resistance.') length = spira.NumberParameter(default=spira.RDD.R1.MIN_LENGTH, doc='Length of the shunt resistance.') p1 = spira.Parameter(fdef_name='create_p1') p2 = spira.Parameter(fdef_name='create_p2') def validate_parameters(self): if self.width > self.length: raise ValueError('`Width` cannot be larger than `length`.') return True def create_p1(self): return spira.Port(name='P1', midpoint=(-self.length/2,0), orientation=180, width=self.width, process=spira.RDD.PROCESS.R1) def create_p2(self): return spira.Port(name='P2', midpoint=(self.length/2,2), orientation=0, width=self.width, process=spira.RDD.PROCESS.R1) def create_elements(self, elems): elems += spira.RouteManhattan(ports=[self.p1, self.p2], layer=spira.RDD.PLAYER.R1.METAL) return elems def create_ports(self, ports): ports += [self.p1, self.p2] return ports
class Resistor(spira.PCell): width = spira.NumberParameter(default=spira.RDD.R1.MIN_WIDTH, doc='Width of the shunt resistance.') length = spira.NumberParameter(default=spira.RDD.R1.MIN_LENGTH, doc='Length of the shunt resistance.') def validate_parameters(self): if self.width > self.length: raise ValueError('`Width` cannot be larger than `length`.') return True
class Box(spira.Cell): width = spira.NumberParameter(default=1) height = spira.NumberParameter(default=1) layer = spira.LayerParameter(default=spira.Layer(1)) def create_elements(self, elems): shape = shapes.BoxShape(width=self.width, height=self.height) elems += spira.Polygon(shape=shape, layer=self.layer) return elems def create_ports(self, ports): ports += spira.Port(name='P1_M1', midpoint=(-0.5,0), orientation=180, width=1) ports += spira.Port(name='P2_M1', midpoint=(0.5,0), orientation=0, width=1) return ports
class BoschVia(spira.Device): __name_prefix__ = 'Bosch_Standard' radius = spira.NumberParameter(default=RDD.B0.MIN_SIZE) m0_radius = spira.Parameter( fdef_name='create_m0_radius', doc='Radius of the ground layer around the via.') al_radius = spira.Parameter( fdef_name='create_al_radius', doc='Radius of the aluminum layer around the via.') def create_m0_radius(self): return (self.radius + 2 * RDD.Al.B0_MIN_SURROUND) def create_al_radius(self): return (self.radius + 2 * RDD.Al.B0_MIN_SURROUND) def create_elements(self, elems): elems += spira.Circle(box_size=(self.radius, self.radius), layer=RDD.PLAYER.B0.VIA) elems += spira.Circle(box_size=(self.m0_radius, self.m0_radius), layer=RDD.PLAYER.M0.METAL) elems += spira.Circle(box_size=(self.al_radius, self.al_radius), layer=RDD.PLAYER.Al.METAL) return elems def create_ports(self, ports): return ports
class Resistor(spira.PCell): width = spira.NumberParameter(default=RDD.R1.MIN_WIDTH, doc='Width of the shunt resistance.') length = spira.NumberParameter(default=RDD.R1.MIN_LENGTH, doc='Length of the shunt resistance.') def validate_parameters(self): if self.width > self.length: raise ValueError('`Width` cannot be larger than `length`.') return True def create_elements(self, elems): elems += spira.Box(width=self.length, height=self.width, layer=spira.RDD.PLAYER.R1.METAL) return elems
class Resistor(spira.PCell): width = spira.NumberParameter(default=spira.RDD.R1.MIN_WIDTH, doc='Width of the shunt resistance.') length = spira.NumberParameter(default=spira.RDD.R1.MIN_LENGTH, doc='Length of the shunt resistance.') def validate_parameters(self): if self.width > self.length: raise ValueError('`Width` cannot be larger than `length`.') return True def create_elements(self, elems): w, l = self.width, self.length # shape = spira.Shape(points=[[0,0], [l,0], [l,w], [0,w]]) # elems += spira.Polygon(shape=shape, layer=spira.RDD.PLAYER.R1.METAL) return elems
class ProcessLayer(spira.Cell): ref_point = spira.Parameter(fdef_name='create_ref_point') t1 = spira.Parameter(fdef_name='create_t1') width = spira.NumberParameter(default=10) length = spira.NumberParameter(default=50) def get_transforms(self): # T = spira.Translation(Coord(10, 0)) + spira.Rotation(rotation=60) T = spira.Translation(Coord(10, 0)) T += spira.Rotation(rotation=20) return T def create_ref_point(self): return spira.Rectangle(p1=(-2.5, -2.5), p2=(2.5, 2.5), layer=spira.Layer(number=1)) def create_t1(self): T = self.get_transforms() ply = spira.Rectangle(p1=(0, 0), p2=(self.width, self.length), layer=spira.Layer(number=2)) ply.transform(transformation=T) return ply def create_elements(self, elems): # elems += self.ref_point elems += self.t1 return elems def create_ports(self, ports): T = self.get_transforms() p1 = spira.Port(name='P1_M1', midpoint=(self.width / 2, 0), orientation=-90, width=self.width) p2 = spira.Port(name='P2_M1', midpoint=(self.width / 2, self.length), orientation=90, width=self.width) ports += p1.transform_copy(T) ports += p2.transform_copy(T) return ports
class Resistor(spira.PCell): width = spira.NumberParameter(default=spira.RDD.R1.MIN_WIDTH, doc='Width of the shunt resistance.') length = spira.NumberParameter(default=spira.RDD.R1.MIN_LENGTH, doc='Length of the shunt resistance.') def validate_parameters(self): if self.width > self.length: raise ValueError('`Width` cannot be larger than `length`.') return True @spira.cache() def get_ports(self): p1 = spira.Port(name='P1', midpoint=(-self.length / 2, 0), orientation=180, width=self.width, process=spira.RDD.PROCESS.R1) p2 = spira.Port(name='P2', midpoint=(self.length / 2, 0), orientation=0, width=self.width, process=spira.RDD.PROCESS.R1) return [p1, p2] def create_elements(self, elems): p1, p2 = self.get_ports() elems += spira.RouteStraight(p1=p1, p2=p2, layer=spira.RDD.PLAYER.R1.METAL) return elems def create_ports(self, ports): ports += self.get_ports() return ports
class TsvLayout(spira.Circuit): """ Basic 2 TSV bosch via layout. """ width = spira.NumberParameter(default=1000) length = spira.NumberParameter(default=2000) # width = spira.NumberParameter( # default=RDD.R5.MIN_SIZE, # restriction=spira.RestrictRange(lower=RDD.R5.MIN_SIZE), # doc='Width of the shunt resistance.') via = spira.CellParameter(default=BoschVia, restriction=spira.RestrictType([BoschVia]), doc='TSV component for connecting M0 to Al.') via_left = spira.Parameter(fdef_name='create_via_left') via_right = spira.Parameter(fdef_name='create_via_right') p1 = spira.Parameter(fdef_name='create_p1') p2 = spira.Parameter(fdef_name='create_p2') p1_out = spira.Parameter(fdef_name='create_p1_out') def validate_parameters(self): if self.length < self.width: raise ValueError('Length cannot be less than width.') return True def create_p1(self): return spira.Port(name='Al:T1', midpoint=(-2000, 0), orientation=0, width=20) def create_p2(self): return spira.Port(name='Al:T2', midpoint=(2000, 0), orientation=180, width=20) def create_p1_out(self): return spira.Port(name='M0:T4', midpoint=(0, 500), orientation=270, width=20) def create_via_left(self): via = self.via() return spira.SRef(via, midpoint=(-1000, 0)) def create_via_right(self): via = self.via() return spira.SRef(via, midpoint=(1000, 0)) def create_elements(self, elems): elems += [self.via_left, self.via_right] d1 = spira.Port(name='Al:D1', midpoint=(-1000, 0), orientation=180, width=20) d11 = spira.Port(name='M0:D3', midpoint=(-1000, 0), orientation=0, width=20) d2 = spira.Port(name='Al:D2', midpoint=(1000, 0), orientation=0, width=20) d12 = spira.Port(name='M0:D4', midpoint=(1000, 0), orientation=180, width=20) d3 = spira.Port(name='M0:D5', midpoint=(0, 0), orientation=90, width=20) # FIXME: Throughs out with a wierd angle. # elems += spira.RouteManhattan( # ports=[self.p1, d1], # width=5, layer=RDD.PLAYER.Al.METAL) elems += spira.RouteStraight(p1=self.p1, p2=d1, layer=RDD.PLAYER.Al.METAL) elems += spira.RouteStraight(p1=d11, p2=d12, layer=RDD.PLAYER.M0.METAL) elems += spira.RouteStraight(p1=self.p2, p2=d2, layer=RDD.PLAYER.Al.METAL) elems += spira.RouteStraight(p1=self.p1_out, p2=d3, layer=RDD.PLAYER.M0.METAL) return elems def create_ports(self, ports): return ports