mirror of https://github.com/VLSIDA/OpenRAM.git
Cleanup Hanan router
This commit is contained in:
parent
e1e24f6d06
commit
6079152092
|
|
@ -19,6 +19,7 @@ class hanan_graph:
|
||||||
|
|
||||||
def __init__(self, router):
|
def __init__(self, router):
|
||||||
|
|
||||||
|
# This is the Hanan router that uses this graph
|
||||||
self.router = router
|
self.router = router
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -57,21 +58,19 @@ class hanan_graph:
|
||||||
bc = shape.bc()
|
bc = shape.bc()
|
||||||
points = [vector(uc.x, uc.y - offset),
|
points = [vector(uc.x, uc.y - offset),
|
||||||
vector(bc.x, bc.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
|
elif aspect_ratio >= 2: # Fat pin
|
||||||
lc = shape.lc()
|
lc = shape.lc()
|
||||||
rc = shape.rc()
|
rc = shape.rc()
|
||||||
points = [vector(lc.x + offset, lc.y),
|
points = [vector(lc.x + offset, lc.y),
|
||||||
vector(rc.x - offset, rc.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
|
else: # Square-like pin
|
||||||
center = shape.center()
|
center = shape.center()
|
||||||
x_values.append(center.x)
|
x_values.append(center.x)
|
||||||
y_values.append(center.y)
|
y_values.append(center.y)
|
||||||
|
continue
|
||||||
|
for p in points:
|
||||||
|
x_values.append(p.x)
|
||||||
|
y_values.append(p.y)
|
||||||
# Add corners for blockages
|
# Add corners for blockages
|
||||||
for blockage in self.graph_blockages:
|
for blockage in self.graph_blockages:
|
||||||
ll, ur = blockage.rect
|
ll, ur = blockage.rect
|
||||||
|
|
|
||||||
|
|
@ -25,25 +25,25 @@ class hanan_node:
|
||||||
|
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
""" """
|
""" Override the default less than behavior. """
|
||||||
|
|
||||||
return self.center < other.center
|
return self.center < other.center
|
||||||
|
|
||||||
|
|
||||||
def add_neighbor(self, node):
|
def add_neighbor(self, other):
|
||||||
""" Connect two nodes. """
|
""" Connect two nodes. """
|
||||||
|
|
||||||
if node not in self.neighbors:
|
if other not in self.neighbors:
|
||||||
self.neighbors.append(node)
|
self.neighbors.append(other)
|
||||||
node.neighbors.append(self)
|
other.neighbors.append(self)
|
||||||
|
|
||||||
|
|
||||||
def remove_neighbor(self, node):
|
def remove_neighbor(self, other):
|
||||||
""" Disconnect two nodes. """
|
""" Disconnect two nodes. """
|
||||||
|
|
||||||
if node in self.neighbors:
|
if other in self.neighbors:
|
||||||
self.neighbors.remove(node)
|
self.neighbors.remove(other)
|
||||||
node.neighbors.remove(self)
|
other.neighbors.remove(self)
|
||||||
|
|
||||||
|
|
||||||
def get_edge_cost(self, other):
|
def get_edge_cost(self, other):
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ class hanan_router(router_tech):
|
||||||
self.layers = layers
|
self.layers = layers
|
||||||
self.design = design
|
self.design = design
|
||||||
self.gds_filename = OPTS.openram_temp + "temp.gds"
|
self.gds_filename = OPTS.openram_temp + "temp.gds"
|
||||||
self.track_width = 1
|
|
||||||
self.pins = {}
|
self.pins = {}
|
||||||
self.all_pins = set()
|
self.all_pins = set()
|
||||||
self.blockages = []
|
self.blockages = []
|
||||||
|
|
@ -123,6 +122,10 @@ class hanan_router(router_tech):
|
||||||
|
|
||||||
|
|
||||||
def pin_contains(self, shape):
|
def pin_contains(self, shape):
|
||||||
|
"""
|
||||||
|
Return if this pin contains another pin or is contained by another pin.
|
||||||
|
"""
|
||||||
|
|
||||||
for pin in self.all_pins:
|
for pin in self.all_pins:
|
||||||
if pin.contains(shape) or shape.contains(pin):
|
if pin.contains(shape) or shape.contains(pin):
|
||||||
return True
|
return True
|
||||||
|
|
@ -130,7 +133,7 @@ class hanan_router(router_tech):
|
||||||
|
|
||||||
|
|
||||||
def add_path(self, path):
|
def add_path(self, path):
|
||||||
""" """
|
""" Add the route path to the layout. """
|
||||||
|
|
||||||
coordinates = [x.center for x in path]
|
coordinates = [x.center for x in path]
|
||||||
self.design.add_route(layers=self.layers,
|
self.design.add_route(layers=self.layers,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue