Example #1
0
    def create_elementals(self, elems):

        c1 = PolygonCell()

        s1 = spira.SRef(c1, midpoint=(0, 0))
        elems += s1

        T = spira.Translation((0 * 1e6, -40 * 1e6)) + spira.Rotation(180)
        s2 = spira.SRef(c1, midpoint=(0, 0), transformation=T)
        elems += s2

        # port1 = s1.ports['RES_e3']
        # port2 = s2.ports['RES_e3']

        # print(port1)
        # print(port2)

        # R = spira.Route(
        #     port1=s1.ports['RES_e3'],
        #     port2=s2.ports['RES_e3'],
        #     ps_layer=RDD.PLAYER.RES
        # )
        # elems += spira.SRef(R)

        return elems
Example #2
0
    def create_elements(self, elems):

        r1 = Row()

        s1 = spira.SRef(r1)
        # s2 = spira.SRef(r1, midpoint=(2000, -1000))
        s2 = spira.SRef(r1, transformation=spira.Translation((2000, -1000)))

        elems += s1
        elems += s2

        print(s1.ports['Al:T2'])
        print(s2.ports['Al:T2'])

        d1 = spira.Port(name='Al:D1',
                        midpoint=(1000, 7000),
                        orientation=180,
                        width=20)
        # d2 = spira.Port(name='Al:D2', midpoint=(-1000, -5000), orientation=0, width=20)

        elems += spira.RouteManhattan(
            ports=[s1.ports['Al:T2'], d1, s2.ports['Al:T2']],
            width=20,
            layer=RDD.PLAYER.Al.METAL)

        elems += spira.RouteManhattan(ports=[s1.ports['Al:T1'], self.d2],
                                      width=20,
                                      layer=RDD.PLAYER.Al.METAL)

        return elems
Example #3
0
 def create_elements(self, elems):
     t1, t2 = self.get_transforms()
     elems += spira.SRef(alias='Sj1', reference=Jj(), transformation=t1)
     elems += spira.SRef(alias='Sr1', reference=ResVia(), transformation=t2)
     elems += spira.Rectangle(p1=(-10, -23),
                              p2=(10, 10),
                              layer=RDD.PLAYER.M2.METAL)
     return elems
Example #4
0
 def create_elements(self, elems):
     t1, t2 = self.get_transforms()
     elems += spira.Rectangle(p1=(-13, -60),
                              p2=(13, 12),
                              layer=RDD.PLAYER.M1.METAL)
     elems += spira.SRef(alias='S1', reference=Top(), transformation=t1)
     elems += spira.SRef(alias='S2', reference=Bot(), transformation=t2)
     return elems
Example #5
0
    def create_elementals(self, elems):
        t1, t2 = self.get_transforms()

        jj = Junction()

        elems += spira.SRef(alias='S1', reference=jj, transformation=t1)
        elems += spira.SRef(alias='S2', reference=jj, transformation=t2)

        return elems
Example #6
0
 def create_t3(self):
     cell = spira.Cell()
     tf_1 = spira.Translation(Coord(12.5, 2.5)) + spira.Rotation(60)
     tf_2 = spira.Translation(Coord(
         12.5, 2.5)) + spira.Rotation(60) + spira.Reflection(True)
     cell += spira.Rectangle(p1=(0, 0),
                             p2=(10, 50),
                             layer=spira.Layer(number=4))
     S1 = spira.SRef(cell, transformation=tf_1)
     S2 = spira.SRef(cell, transformation=tf_2)
     return [S1, S2]
Example #7
0
 def create_t2(self):
     cell = spira.Cell()
     tf_1 = spira.GenericTransform(translation=(10, 10), rotation=45)
     tf_2 = spira.GenericTransform(translation=Coord(10, 10),
                                   rotation=45,
                                   reflection=True)
     cell += spira.Rectangle(p1=(0, 0),
                             p2=(10, 50),
                             layer=spira.Layer(number=3))
     S1 = spira.SRef(cell, transformation=tf_1)
     S2 = spira.SRef(cell, transformation=tf_2)
     return [S1, S2]
Example #8
0
    def create_elements(self, elems):
        t1, t2 = self.get_transforms()

        jj = Junction()

        elems += spira.SRef(alias='ref_jj1', reference=jj, transformation=t1)
        elems += spira.SRef(alias='ref_jj2', reference=jj, midpoint=(150, 0))
        # elems += spira.SRef(alias='ref_jj2', reference=jj, transformation=t2)

        # elems += spira.Rectangle(p1=(7, -13), p2=(143, 1), layer=spira.Layer(number=2))
        elems += spira.Rectangle(p1=(7, -13), p2=(143, 1), layer=RDD.PLAYER.M2.METAL)

        return elems
Example #9
0
    def create_elements(self, elems):

        D1 = TsvCircuit()

        s1 = spira.SRef(D1)
        s2 = spira.SRef(D1, midpoint=(6000, 2000))

        s2.connect(port='Al:D2', destination=s1.ports['Al:D2'])

        elems += s1
        elems += s2

        return elems
Example #10
0
    def create_elements(self, elems):

        D1 = ThroughSiliconVia()
        D2 = ThroughSiliconVia()

        s1 = spira.SRef(reference=D1)
        s2 = spira.SRef(reference=D1, transformation=spira.Rotation(90))

        s1.connect(port='Al:T1', destination=s2.ports['Al:T2'])

        elems += s1
        elems += s2

        return elems
Example #11
0
 def create_elements(self, elems):
     t1, t2 = self.get_transforms()
     elems += spira.SRef(alias='Sr2', reference=ResVia(), midpoint=(0, -30))
     elems += spira.Rectangle(p1=(-10, -55),
                              p2=(10, -35),
                              layer=RDD.PLAYER.M2.METAL)
     return elems
Example #12
0
    def create_quadrant_three(self):

        # self.b1.connect(port=self.b1.ports['P2'], destination=self.ports['T1'])
        # # h = self.p2[1] + (self.p1[1]-self.p2[1])/2 + self.radius
        # h = (self.p1[1]-self.p2[1])/2 + self.radius
        # self.b1.move(midpoint=self.b1.ports['P2'], destination=[0, h])

        # self.b2.connect(port=self.b2.ports['P2'], destination=self.b1.ports['P1'])
        # # h = self.p2[1] + (self.p1[1]-self.p2[1])/2 - self.radius
        # h = (self.p1[1]-self.p2[1])/2 - self.radius
        # self.b2.move(midpoint=self.b2.ports['P1'], destination=[self.ports['T2'].midpoint[0], h])

        # r1 = self.route_straight(self.b2.ports['P1'], self.ports['T2'])
        # r2 = self.route_straight(self.b1.ports['P2'], self.ports['T1'])
        # r3 = self.route_straight(self.b2.ports['P2'], self.b1.ports['P1'])

        D = spira.Cell(name='Q3')
        D += self.b1
        # D += [self.b1, self.b2, r1, r2, r3]

        # D += self.ports['T1']
        # D += self.ports['T2']

        # D.rotate(angle=self.port1.orientation, center=self.p1)
        # D.move(midpoint=self.ports['T1'], destination=self.port1)

        return spira.SRef(D)
Example #13
0
    def create_quadrant_two(self):

        h = (self.p2[1] - self.p1[1]) / 2 - self.radius
        self.b1.distance_alignment(port=self.b1.ports['P1'],
                                   destination=self.ports['T1'],
                                   distance=h)
        self.b2.distance_alignment(port=self.b2.ports['P2'],
                                   destination=self.ports['T2'],
                                   distance=-h)

        r1 = self.route_straight(self.b2.ports['P2'], self.ports['T2'])
        r2 = self.route_straight(self.b1.ports['P1'], self.ports['T1'])
        r3 = self.route_straight(self.b2.ports['P1'], self.b1.ports['P2'])

        D = spira.Cell(name='Q2')
        D += self.b1
        D += self.b2
        D += r1
        D += r2
        D += r3

        # D += self.ports['T1']
        # D += self.ports['T2']

        # D.rotate(angle=self.port1.orientation, center=self.p1)
        # D.move(midpoint=self.ports['T1'], destination=self.port1)

        return spira.SRef(D)
Example #14
0
    def create_q4_180(self):

        b1 = self.b1
        b2 = self.b2

        b2.connect(port=b2.ports['P1'], destination=self.ports['T1'])
        h = self.p1[1] + self.radius + self.length
        b2.move(midpoint=b2.ports['P1'], destination=[0, h])

        b1.connect(port=b1.ports['P2'], destination=b2.ports['P2'])
        b1.move(midpoint=b1.ports['P1'],
                destination=[self.ports['T2'].midpoint[0], h])

        r1 = self.route_straight(b2.ports['P1'], self.ports['T1'])
        r2 = self.route_straight(b1.ports['P1'], self.ports['T2'])
        r3 = self.route_straight(b1.ports['P2'], b2.ports['P2'])

        D = spira.Cell(name='SameQ4')
        D += [self.b1, self.b2, r1, r2, r3]

        D += self.ports['T1']
        D += self.ports['T2']

        D.rotate(angle=self.port1.orientation, center=self.p1)
        D.move(midpoint=self.ports['T1'], destination=self.port1)

        return spira.SRef(D)
Example #15
0
    def create_t1(self):
        cell = spira.Cell()
        cell += spira.Rectangle(p1=(0, 0),
                                p2=(10, 50),
                                layer=spira.Layer(number=2))

        S1 = spira.SRef(cell)
        S1.rotate(rotation=45)
        S1.translate(Coord(15, 15))

        S = spira.SRef(cell)
        S.rotate(rotation=45)
        S.translate(Coord(15, 15))
        S.reflect(True)

        return [S1, S]
Example #16
0
    def create_quadrant_two(self):

        p1, p2 = self.p1, self.p2

        h = (p2[1] - p1[1]) - self.radius
        self.b1.distance_alignment(port=self.b1.ports['P1'],
                                   destination=self.ports['T1'],
                                   distance=h)

        r1 = self.route_straight(self.b1.ports['P1'], self.ports['T1'])
        r2 = self.route_straight(self.b1.ports['P2'], self.ports['T2'])

        D = spira.Cell(name='Route_Q2_90')

        D += self.b1
        D += r1
        D += r2

        # D += self.ports['T1']
        # D += self.ports['T2']

        # D._rotate(rotation=self.port1.orientation, center=self.p1)
        # D.move(midpoint=self.ports['T1'], destination=self.port1)

        return spira.SRef(D)
Example #17
0
    def create_quadrant_three(self):

        p1, p2 = self.p1, self.p2

        # t1 = deepcopy(self.ports['T1'])
        # t2 = deepcopy(self.ports['T2'])

        # self.b2.connect(port=self.b2.ports['P1'], destination=t1)
        # h = p2[1] + self.radius
        # self.b2.move(midpoint=self.b2.ports['P1'], destination=[0, h])

        # # r1 = self.route_straight(self.b2.ports['P1'], t1)
        # # r2 = self.route_straight(self.b2.ports['P2'], t2)

        # # self.b2.connect(port=self.b2.ports['P1'], destination=self.ports['T1'])
        # # h = p2[1] + self.radius
        # # self.b2.move(midpoint=self.b2.ports['P1'], destination=[0, h])

        # # r1 = self.route_straight(self.b2.ports['P1'], self.ports['T1'])
        # # r2 = self.route_straight(self.b2.ports['P2'], self.ports['T2'])

        D = spira.Cell(name='Route_Q4_90')

        D += self.b1

        # D += self.ports['T1']
        # D += self.ports['T2']

        # D._rotate(rotation=self.port1.orientation, center=self.p1)
        # D.move(midpoint=self.ports['T1'], destination=self.port1)

        return spira.SRef(D)
Example #18
0
def wrap_references(cell, c2dmap):
    """ Move all cell centers to the origin.
    `cell` is of type gdspy.Cell.
    """

    for e in cell.references:
        ref_device = deepcopy(c2dmap[e.ref_cell])
        center = ref_device.center
        D = ref_device.move(midpoint=center, destination=(0, 0))

        midpoint = Coord(e.origin[0], e.origin[1])
        S = spira.SRef(reference=D, midpoint=(0, 0))

        if e.x_reflection == True:
            T = Reflection(reflection=True)
            center = T.apply_to_coord(center)
            S.transform(T)

        if e.rotation is not None:
            T = Rotation(rotation=e.rotation)
            center = T.apply_to_coord(center)
            S.transform(T)

        midpoint.move(center)
        S.translate(midpoint)

        c2dmap[cell] += S
Example #19
0
    def _create_references(self, gdspy_cell, c2dmap):
        """ Move all gdspy_cell centers to the origin. """

        for e in gdspy_cell.references:
            ref_device = deepcopy(c2dmap[e.ref_cell])
            center = ref_device.center
            # print(e)
            # print(center)
            D = ref_device.move(midpoint=center, destination=(0,0))

            midpoint = Coord(e.origin[0], e.origin[1])
            S = spira.SRef(reference=D, midpoint=(0,0))

            # FIXME: Reflection still causes errors.
            if e.x_reflection == True:
                T = Reflection(reflection=True)
                center = T.apply_to_coord(center)
                S.transform(T)

            if e.rotation is not None:
                T = Rotation(rotation=e.rotation)
                center = T.apply_to_coord(center)
                S.transform(T)

            # midpoint.move(center)
            midpoint.translate(center)
            S.translate(midpoint)

            c2dmap[gdspy_cell] += S
Example #20
0
 def create_elements(self, elems):
     elems += self.ref_point
     pc = ProcessLayer()
     S = spira.SRef(pc, midpoint=(0, 0))
     p1 = self.get_ports()[0]
     S.distance_alignment(port=pc.ports[0], destination=p1, distance=20)
     elems += S
     return elems
Example #21
0
 def create_t1(self):
     cell = spira.Cell()
     cell += spira.Rectangle(p1=(0, 0),
                             p2=(10, 50),
                             layer=spira.Layer(number=2))
     T = spira.Rotation(-30)
     S = spira.SRef(cell, transformation=T)
     return S
Example #22
0
 def create_t2(self):
     cell = spira.Cell()
     cell += spira.Rectangle(p1=(0, 0),
                             p2=(10, 50),
                             layer=spira.Layer(number=3))
     T = spira.GenericTransform(rotation=-60)
     S = spira.SRef(cell, transformation=T)
     return S
Example #23
0
 def create_t3(self):
     cell = spira.Cell()
     cell += spira.Rectangle(p1=(0, 0),
                             p2=(10, 50),
                             layer=spira.Layer(number=4))
     S = spira.SRef(cell)
     S.rotate(-90)
     return S
Example #24
0
 def create_elements(self, elems):
     elems += self.ref_point
     pc = ProcessLayer()
     T = spira.Rotation(0)
     S = spira.SRef(pc, midpoint=(10, 0), transformation=T)
     p1 = self.get_ports()[0]
     S.connect(port=S.ports[0], destination=p1)
     elems += S
     return elems
Example #25
0
    def create_elements(self, elems):
        t1, t2 = self.get_transforms()

        D = PolygonCell()
        s1 = spira.SRef(reference=D, transformation=t1)
        s2 = spira.SRef(reference=D, transformation=t2)

        # print(s1.ports)
        # print(s2.ports)

        # elems += RouteStraight(
        #     p1=s1.ports['M2_P1'],
        #     p2=s2.ports['M2_P1'],
        #     layer=RDD.PLAYER.M2.METAL)

        elems += [s1, s2]

        return elems
Example #26
0
    def create_elementals(self, elems):

        elems += spira.Rectangle(p1=(60, 45), p2=(80, 80), layer=RDD.PLAYER.M2.METAL)

        c1 = spira.Cell(name='ply1')
        c1 += spira.Rectangle(p1=(60, 80), p2=(80, 100), layer=RDD.PLAYER.M2.METAL)
        c1 += spira.Rectangle(p1=(70, 60), p2=(100, 70), layer=RDD.PLAYER.M2.METAL)
        elems += spira.SRef(c1)
        
        return elems
Example #27
0
    def create_elementals(self, elems):

        c1 = ResistorCell()
        s1 = spira.SRef(c1)
        elems += s1

        elems += spira.Rectangle(p1=(-10 * 1e6, -15 * 1e6),
                                 p2=(10 * 1e6, 15 * 1e6),
                                 layer=RDD.PLAYER.M2.METAL)

        return elems
Example #28
0
 def create_arc_bend_2(self):
     if self.bend_type == 'circular':
         rs = RouteArcShape(radius=self.radius,
                            width=self.port1.width,
                            start_angle=0,
                            theta=-90)
     if self.bend_type == 'rectangle':
         rs = RouteSquareShape(width=self.port1.width,
                               size=(self.radius, self.radius))
     B1 = RouteGeneral(route_shape=rs, connect_layer=self.layer)
     return spira.SRef(B1)
Example #29
0
    def create_elements(self, elems):

        points = [(10.0, 0.0), (15.0, 10.0), (0.0, 10.0), (0.0, 5.0),
                  (-15.0, 5.0), (-5.0, 0.0), (-10.0, -10.0), (-5.0, -15.0),
                  (10.0, -15.0), (5.0, -10.0), (5.0, -5.0)]
        s = spira.Shape(points=points)

        S1 = spira.Cell(name='shape',
                        elements=spira.Polygon(shape=s, layer=spira.Layer(1)))

        # #translate a copy of the shape
        # t = s.move_copy((0.0, 20.0))
        # S2 = Structure("shape_trans", Boundary(Layer(0), t))

        # #rotate the shape (angle in degree)
        # t = s.rotate_copy((0.0, 0.0), 50)
        # S3 = Structure("shape_rot", Boundary(Layer(0), t))

        # #scale the shape
        # t = s.magnify_copy((0.0, 0.0), 1.2)
        # S4 = Structure("shape_scale", Boundary(Layer(0), t))

        # #stretch the shape horizontally and squeeze vertically
        # t = Stretch(stretch_center = (0.0, 0.0), stretch_factor = (1.5, 0.5))(s)
        # S5 = Structure("shape_stretch", Boundary(Layer(0), t))

        # #fit the shape in a box
        # south_west = (-7.0, -7.0)
        # north_east = (7.0, 7.0)
        # t = ShapeFit(s, south_west, north_east)
        # S6 = Structure("shape_fit", Boundary(Layer(0), t))

        # #create a shape which traces the contour with a certain line width
        # t = ShapePath(original_shape = s, path_width = 0.5)
        # S7 = Structure("ShapePath1", Boundary(Layer(0), t))

        # t = ShapePathRounded(original_shape = s, path_width = 0.5)
        # S8 = Structure("ShapePath2", Boundary(Layer(0), t))

        # #expand the shape with a certain distance
        # t = ShapeGrow(s, 1.0)
        # S9 = Structure("shape_grow", Boundary(Layer(1), t) + Boundary(Layer(0), s))

        # #round the shape with a given radius
        # t = ShapeRound(original_shape = s, radius = 2.0)
        # S10 = Structure("shape_round", Boundary(Layer(1), t) + Boundary(Layer(0), s))

        elems += [
            spira.SRef(S1, (0.0, 200.0)),
        ]

        return elems
Example #30
0
def test_elem_sref():
    class CellB(spira.Cell):
        def create_elementals(self, elems):
            elems += spira.Polygon(shape=[[[0, 0], [3, 0], [3, 1], [0, 1]]],
                                   gds_layer=spira.Layer(number=77))
            return elems

    c2 = CellB()
    s1 = spira.SRef(structure=c2)
    assert all([a == b for a, b in zip(s1.midpoint, [0, 0])])
    assert s1.rotation == 0
    assert s1.magnification == 1
    assert s1.reflection == False