コード例 #1
0
    def filter_Cell(self, item):
        from copy import deepcopy
        from spira.yevon.vmodel.virtual import virtual_connect
        from spira.yevon.geometry.shapes.adapters import ShapeConnected
        from spira.yevon.geometry.shapes.shape import Shape

        v_model = virtual_connect(device=item)

        D = item.expand_flat_copy()

        for i, e1 in enumerate(D.elements):
            clip_shape = Shape()
            for e2 in D.elements:
                shape1 = e1.shape.transform_copy(e1.transformation).snap_to_grid()
                shape2 = e2.shape.transform_copy(e2.transformation).snap_to_grid()
                if (shape1 != shape2) and (e1.layer == e2.layer):
                    overlap_shape = shape1.intersections(shape2)
                    if isinstance(overlap_shape, Shape):
                        if overlap_shape.is_empty() is False:
                            clip_shape.extend(overlap_shape.points.tolist())

            if clip_shape.is_empty() is False:
                original_shape = e1.shape.transform_copy(e1.transformation).snap_to_grid()
                D.elements[i].shape = ShapeConnected(
                    original_shape=original_shape,
                    clip_shape=clip_shape,
                    derived_edges=v_model.derived_edges)
                D.elements[i].ports = D.elements[i].ports.transform_copy(e1.transformation)
                D.elements[i].transformation = None

        return item
コード例 #2
0
ファイル: boolean_filter.py プロジェクト: Joshua-Sexton/spira
    def __filter___Cell____(self, item):
        from copy import deepcopy
        from spira.yevon.vmodel.virtual import virtual_connect
        from spira.yevon.geometry.shapes.modifiers import ShapeConnected
        from spira.yevon.geometry.shapes.shape import Shape

        D = item.expand_flat_copy()
        v_model = virtual_connect(device=D)

        for i, e1 in enumerate(D.elements):
            points = []
            # print('E1: {}'.format(e1))
            for e2 in D.elements:
                shape1 = deepcopy(e1).shape.transform(e1.transformation)
                shape2 = deepcopy(e2).shape.transform(e2.transformation)
                if (shape1 != shape2) and (e1.layer == e2.layer):
                    # print('E2: {}'.format(e2))
                    overlap_shape = shape1.intersections(shape2)
                    # print(overlap_shape.points)
                    if isinstance(overlap_shape, Shape):
                        if len(overlap_shape) > 0:
                            # print('YESSSS')
                            points.extend(overlap_shape.points.tolist())

            if len(points) > 0:
                # print('[--] Overlapping shape points:')
                # print(points)
                D.elements[i].shape = ShapeConnected(
                    original_shape=e1.shape,
                    overlapping_shape=Shape(points),
                    edges=v_model.connected_edges)
            # print('')

        return item
コード例 #3
0
ファイル: boolean_filter.py プロジェクト: Joshua-Sexton/spira
    def __filter___Cell____(self, item):
        from spira.yevon.gdsii.cell import Cell
        from spira.yevon.utils import clipping
        from spira.yevon.vmodel.virtual import virtual_connect
        from shapely.geometry import Polygon as ShapelyPolygon

        ports = PortList()
        elems = ElementList()

        v_model = virtual_connect(device=item)
        for e in v_model.connected_elements:
            elems += e

        for e in item.elements.sref:
            elems += e
        for e in item.elements.labels:
            elems += e
        for p in item.ports:
            ports += p

        cell = Cell(elements=elems, ports=ports)
        return cell
コード例 #4
0
    def filter_Cell(self, item):
        from spira.yevon.utils import clipping
        from spira.yevon.gdsii.cell import Cell
        from spira.yevon.geometry.ports import Port
        from spira.yevon.vmodel.virtual import virtual_connect
        from shapely.geometry import Polygon as ShapelyPolygon

        # ports = PortList()
        elems = ElementList()

        v_model = virtual_connect(device=item)

        for e1 in v_model.derived_contacts:
            ps = e1.layer.process.symbol
            for e2 in item.elements:
                for m in ['BOT_LAYER', 'TOP_LAYER']:
                    if ps in RDD.VIAS.keys:
                        if e2.layer == RDD.VIAS[ps].LAYER_STACK[m]:
                            if e2.encloses(e1.center):
                                port = Port(
                                    name='{}:Cv'.format(ps),
                                    midpoint=e1.center,
                                    process=e1.layer.process)
                                e2.ports += port
        elems += item.elements

        for e in item.elements.sref:
            elems += e
        for e in item.elements.labels:
            elems += e
        # for p in item.ports:
        #     ports += p

        # cell = Cell(elements=elems, ports=ports)
        cell = Cell(elements=elems)
        return cell
コード例 #5
0
ファイル: _2_erc_f.py プロジェクト: Joshua-Sexton/spira
# el += spira.Rectangle(p1=(8, 4), p2=(-4, 6), layer=RDD.PLAYER.M5.METAL)

# el += spira.Rectangle(p1=(-4, 4), p2=(1, 6), layer=RDD.PLAYER.M5.METAL)
# el += spira.Rectangle(p1=(3, 4), p2=(8, 6), layer=RDD.PLAYER.M5.METAL)

# el += spira.Rectangle(p1=(-4, 8), p2=(8, 12), layer=RDD.PLAYER.M5.METAL)

# el += spira.Rectangle(p1=(1, 9), p2=(3, 14), layer=RDD.PLAYER.M5.METAL)

# el += spira.Rectangle(p1=(-1, 9), p2=(5, 14), layer=RDD.PLAYER.M5.METAL)

# NOTE: Edge cases.
# el += spira.Rectangle(p1=(0, 10), p2=(4, 14), layer=RDD.PLAYER.M5.METAL)
# el += spira.Rectangle(p1=(-4, 4), p2=(0, 6), layer=RDD.PLAYER.M5.METAL)
# el += spira.Rectangle(p1=(4, 4), p2=(7, 6), layer=RDD.PLAYER.M5.METAL)
# el += spira.Rectangle(p1=(4, 9), p2=(7, 11), layer=RDD.PLAYER.M5.METAL)
# el += spira.Rectangle(p1=(3, 10), p2=(7, 11), layer=RDD.PLAYER.M5.METAL)

device = spira.Cell(name='Device', elements=el)

v_model = virtual_connect(device=device)
v_model.gdsii_output_virtual_connect()

# # F = MetalConnectFilter()
# # D = F(device)
# D = device

# D = spira.Circuit(name='TestElectricalConnections', elements=D.elements)
# # D.gdsii_output()
# D.netlist_output()
コード例 #6
0
ファイル: _04_jtl.py プロジェクト: Joshua-Sexton/spira
        return [t1, t2]

    def create_routes(self, elems):
        elems += spira.Rectangle(p1=(4, -4),
                                 p2=(146, 4),
                                 layer=RDD.PLAYER.M2.METAL)
        elems += spira.Rectangle(p1=(-3, -4),
                                 p2=(-30, 4),
                                 layer=RDD.PLAYER.M2.METAL)
        return elems

    def create_elementals(self, elems):
        t1, t2 = self.get_transforms()
        jj = Junction()
        elems += spira.SRef(alias='S1', reference=jj, transformation=t1)
        return elems


# ----------------------------------------------------------------------------------------

if __name__ == '__main__':

    D = Jtl(pcell=True)

    from spira.yevon.vmodel.virtual import virtual_connect
    v_model = virtual_connect(device=D.expand_flatcopy())
    v_model.gdsii_output_virtual_connect()

    # D.gdsii_output()
    D.netlist_output()