示例#1
0
 def add_supply_rails(self, name):
     """
     Add the shapes that represent the routed supply rails.
     This is after the paths have been pruned and only include rails that are
     connected with vias.
     """
     for rail in self.supply_rails[name]:
         ll = grid_utils.get_lower_left(rail)
         ur = grid_utils.get_upper_right(rail)        
         z = ll.z
         pin = self.compute_pin_enclosure(ll, ur, z, name)
         debug.info(3,"Adding supply rail {0} {1}->{2} {3}".format(name,ll,ur,pin))
         self.cell.add_layout_pin(text=name,
                                  layer=pin.layer,
                                  offset=pin.ll(),
                                  width=pin.width(),
                                  height=pin.height())
示例#2
0
    def finalize_supply_rails(self, name):
        """
        Determine which supply rails overlap and can accomodate a via.
        Remove any supply rails that do not have a via since they are disconnected.
        NOTE: It is still possible though unlikely that there are disconnected groups of rails.
        """

        all_rails = self.supply_rails[name]

        connections = set()
        via_areas = []
        for i1,r1 in enumerate(all_rails):
            # Only consider r1 horizontal rails
            e = next(iter(r1))
            if e.z==1:
                continue

            # We need to move this rail to the other layer for the z indices to match
            # during the intersection. This also makes a copy.
            new_r1 = {vector3d(i.x,i.y,1) for i in r1}

            for i2,r2 in enumerate(all_rails):
                # Never compare to yourself
                if i1==i2:
                    continue
                
                # Only consider r2 vertical rails
                e = next(iter(r2))
                if e.z==0:
                    continue

                # Determine if we have sufficient overlap and, if so,
                # remember:
                # the indices to determine a rail is connected to another
                # the overlap area for placement of a via
                overlap = new_r1 & r2
                if len(overlap) >= 1:
                    debug.info(3,"Via overlap {0} {1}".format(len(overlap),overlap))
                    connections.update([i1,i2])
                    via_areas.append(overlap)
                
        # Go through and add the vias at the center of the intersection
        for area in via_areas:
            ll = grid_utils.get_lower_left(area)
            ur = grid_utils.get_upper_right(area)
            center = (ll + ur).scale(0.5,0.5,0)
            self.add_via(center,1)

        # Determien which indices were not connected to anything above
        missing_indices = set([x for x in range(len(self.supply_rails[name]))])
        missing_indices.difference_update(connections)
        
        # Go through and remove those disconnected indices
        # (No via was added, so that doesn't need to be removed)
        for rail_index in sorted(missing_indices, reverse=True):
            ll = grid_utils.get_lower_left(all_rails[rail_index])
            ur = grid_utils.get_upper_right(all_rails[rail_index])
            debug.info(1,"Removing disconnected supply rail {0} .. {1}".format(ll,ur))
            self.supply_rails[name].pop(rail_index)

        # Make the supply rails into a big giant set of grids for easy blockages.
        # Must be done after we determine which ones are connected.
        self.create_supply_track_set(name)