Cleanup Hanan router

This commit is contained in:
Eren Dogan 2023-05-29 12:43:43 -07:00
parent e1e24f6d06
commit 6079152092
3 changed files with 19 additions and 17 deletions

View File

@ -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

View File

@ -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):

View File

@ -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,