Exemplo n.º 1
0
 def get_furthest_offgrid_pin(self, pin, insufficient_list):
     """
     Get a grid cell that is the furthest from the blocked grids.
     """
     
     # Find the coordinate with the most overlap
     best_coord = None
     best_dist = math.inf
     for coord in insufficient_list:
         min_dist = grid_utils.distance_set(coord, self.blocked_grids)
         if min_dist < best_dist:
             best_dist = min_dist
             best_coord = coord
         
     return set([best_coord])
Exemplo n.º 2
0
    def route_pins(self, pin_name):
        """
        This will route each of the remaining pin components to the other pins.
        After it is done, the cells are added to the pin blockage list.
        """

        remaining_components = sum(not x.is_routed() for x in self.pin_groups[pin_name])
        debug.info(1,"Routing {0} with {1} pin components to connect.".format(pin_name,
                                                                              remaining_components))

        # Create full graph
        debug.info(2,"Creating adjacency matrix")
        pin_size = len(self.pin_groups[pin_name])
        adj_matrix = [[0] * pin_size for i in range(pin_size)]

        for index1,pg1 in enumerate(self.pin_groups[pin_name]):
            for index2,pg2 in enumerate(self.pin_groups[pin_name]):
                if index1>=index2:
                    continue
                dist = int(grid_utils.distance_set(list(pg1.grids)[0], pg2.grids))
                adj_matrix[index1][index2] = dist

        # Find MST
        debug.info(2,"Finding MinimumSpanning Tree")
        X = csr_matrix(adj_matrix)
        Tcsr = minimum_spanning_tree(X)
        mst = Tcsr.toarray().astype(int)
        connections = []
        for x in range(pin_size):
            for y in range(pin_size):
                if x >= y:
                    continue
                if mst[x][y]>0:
                    connections.append((x, y))

        # Route MST components
        for (src, dest) in connections:
            self.route_signal(pin_name, src, dest)