diff --git a/compiler/router/hanan_graph.py b/compiler/router/hanan_graph.py index 4adbd28f..c10a82f5 100644 --- a/compiler/router/hanan_graph.py +++ b/compiler/router/hanan_graph.py @@ -19,6 +19,7 @@ class hanan_graph: def __init__(self, router): + # This is the Hanan router that uses this graph self.router = router @@ -57,21 +58,19 @@ class hanan_graph: bc = shape.bc() points = [vector(uc.x, uc.y - offset), vector(bc.x, bc.y + offset)] - for p in points: - x_values.append(p.x) - y_values.append(p.y) elif aspect_ratio >= 2: # Fat pin lc = shape.lc() rc = shape.rc() points = [vector(lc.x + offset, lc.y), vector(rc.x - offset, rc.y)] - for p in points: - x_values.append(p.x) - y_values.append(p.y) else: # Square-like pin center = shape.center() x_values.append(center.x) y_values.append(center.y) + continue + for p in points: + x_values.append(p.x) + y_values.append(p.y) # Add corners for blockages for blockage in self.graph_blockages: ll, ur = blockage.rect diff --git a/compiler/router/hanan_node.py b/compiler/router/hanan_node.py index 18ecf008..3eecc351 100644 --- a/compiler/router/hanan_node.py +++ b/compiler/router/hanan_node.py @@ -25,25 +25,25 @@ class hanan_node: def __lt__(self, other): - """ """ + """ Override the default less than behavior. """ return self.center < other.center - def add_neighbor(self, node): + def add_neighbor(self, other): """ Connect two nodes. """ - if node not in self.neighbors: - self.neighbors.append(node) - node.neighbors.append(self) + if other not in self.neighbors: + self.neighbors.append(other) + other.neighbors.append(self) - def remove_neighbor(self, node): + def remove_neighbor(self, other): """ Disconnect two nodes. """ - if node in self.neighbors: - self.neighbors.remove(node) - node.neighbors.remove(self) + if other in self.neighbors: + self.neighbors.remove(other) + other.neighbors.remove(self) def get_edge_cost(self, other): diff --git a/compiler/router/hanan_router.py b/compiler/router/hanan_router.py index 66180ee1..707b2e41 100644 --- a/compiler/router/hanan_router.py +++ b/compiler/router/hanan_router.py @@ -27,7 +27,6 @@ class hanan_router(router_tech): self.layers = layers self.design = design self.gds_filename = OPTS.openram_temp + "temp.gds" - self.track_width = 1 self.pins = {} self.all_pins = set() self.blockages = [] @@ -123,6 +122,10 @@ class hanan_router(router_tech): def pin_contains(self, shape): + """ + Return if this pin contains another pin or is contained by another pin. + """ + for pin in self.all_pins: if pin.contains(shape) or shape.contains(pin): return True @@ -130,7 +133,7 @@ class hanan_router(router_tech): def add_path(self, path): - """ """ + """ Add the route path to the layout. """ coordinates = [x.center for x in path] self.design.add_route(layers=self.layers,