mirror of https://github.com/VLSIDA/OpenRAM.git
Try routing in larger regions if no path is found
This commit is contained in:
parent
ed404a3ad2
commit
6cda5415a4
|
|
@ -111,7 +111,7 @@ class graph:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def create_graph(self, source, target):
|
def create_graph(self, source, target, scale=1):
|
||||||
""" Create the graph to run routing on later. """
|
""" Create the graph to run routing on later. """
|
||||||
debug.info(2, "Creating the graph for source '{}' and target'{}'.".format(source, target))
|
debug.info(2, "Creating the graph for source '{}' and target'{}'.".format(source, target))
|
||||||
|
|
||||||
|
|
@ -122,6 +122,7 @@ class graph:
|
||||||
# Find the region to be routed and only include objects inside that region
|
# Find the region to be routed and only include objects inside that region
|
||||||
region = deepcopy(source)
|
region = deepcopy(source)
|
||||||
region.bbox([target])
|
region.bbox([target])
|
||||||
|
region.multiply(scale)
|
||||||
region = region.inflated_pin(spacing=self.router.track_space)
|
region = region.inflated_pin(spacing=self.router.track_space)
|
||||||
debug.info(3, "Routing region is {}".format(region.rect))
|
debug.info(3, "Routing region is {}".format(region.rect))
|
||||||
|
|
||||||
|
|
@ -147,6 +148,9 @@ class graph:
|
||||||
debug.info(3, "Number of vias detected in the routing region: {}".format(len(self.graph_vias)))
|
debug.info(3, "Number of vias detected in the routing region: {}".format(len(self.graph_vias)))
|
||||||
debug.info(3, "Number of nodes in the routing graph: {}".format(len(self.nodes)))
|
debug.info(3, "Number of nodes in the routing graph: {}".format(len(self.nodes)))
|
||||||
|
|
||||||
|
# Return the region to scale later if no path is found
|
||||||
|
return region.rect
|
||||||
|
|
||||||
|
|
||||||
def find_graph_blockages(self, region):
|
def find_graph_blockages(self, region):
|
||||||
""" Find blockages that overlap the routing region. """
|
""" Find blockages that overlap the routing region. """
|
||||||
|
|
|
||||||
|
|
@ -96,20 +96,35 @@ class graph_router(router_tech):
|
||||||
pins = self.pins[pin_name]
|
pins = self.pins[pin_name]
|
||||||
# Route closest pins according to the minimum spanning tree
|
# Route closest pins according to the minimum spanning tree
|
||||||
for source, target in self.get_mst_pairs(list(pins)):
|
for source, target in self.get_mst_pairs(list(pins)):
|
||||||
# Create the graph
|
# This is the routing region scale
|
||||||
g = graph(self)
|
scale = 1
|
||||||
g.create_graph(source, target)
|
while True:
|
||||||
# Find the shortest path from source to target
|
# Create the graph
|
||||||
path = g.find_shortest_path()
|
g = graph(self)
|
||||||
# TODO: Exponentially increase the routing area and retry if no
|
region = g.create_graph(source, target, scale)
|
||||||
# path was found
|
# Find the shortest path from source to target
|
||||||
debug.check(path is not None, "Couldn't route from {} to {}".format(source, target))
|
path = g.find_shortest_path()
|
||||||
# Create the path shapes on layout
|
# If there is no path found, exponentially try again with a
|
||||||
self.add_path(path)
|
# larger routing region
|
||||||
# Find the recently added shapes
|
if path is None:
|
||||||
self.prepare_gds_reader()
|
rll, rur = region
|
||||||
self.find_blockages(pin_name)
|
bll, bur = self.ring_bbox
|
||||||
self.find_vias()
|
# Stop scaling the region and throw an error
|
||||||
|
if rll.x < bll.x and rll.y < bll.y and \
|
||||||
|
rur.x > bur.x and rur.y > bur.y:
|
||||||
|
self.write_debug_gds(gds_name="{}error.gds".format(OPTS.openram_temp), g=g, source=source, target=target)
|
||||||
|
debug.error("Couldn't route from {} to {}.".format(source, target), -1)
|
||||||
|
# Exponentially scale the region
|
||||||
|
scale *= 2
|
||||||
|
debug.info(0, "Retry routing in larger routing region with scale {}".format(scale))
|
||||||
|
continue
|
||||||
|
# Create the path shapes on layout
|
||||||
|
self.add_path(path)
|
||||||
|
# Find the recently added shapes
|
||||||
|
self.prepare_gds_reader()
|
||||||
|
self.find_blockages(pin_name)
|
||||||
|
self.find_vias()
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def prepare_gds_reader(self):
|
def prepare_gds_reader(self):
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,17 @@ class graph_shape(pin_layout):
|
||||||
return graph_shape(self.name, inflated_area, self.layer, self)
|
return graph_shape(self.name, inflated_area, self.layer, self)
|
||||||
|
|
||||||
|
|
||||||
|
def multiply(self, scale):
|
||||||
|
""" Multiply the width and height with the scale value. """
|
||||||
|
|
||||||
|
width = (self.width() * (scale - 1)) / 2
|
||||||
|
height = (self.height() * (scale - 1)) / 2
|
||||||
|
ll, ur = self.rect
|
||||||
|
newll = vector(ll.x - width, ll.y - height)
|
||||||
|
newur = vector(ur.x + width, ur.y + height)
|
||||||
|
self.rect = [snap(newll), snap(newur)]
|
||||||
|
|
||||||
|
|
||||||
def aligns(self, other):
|
def aligns(self, other):
|
||||||
""" Return if the other shape aligns with this shape. """
|
""" Return if the other shape aligns with this shape. """
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue