Don't scale the routing region if no path is found

This commit is contained in:
Eren Dogan 2023-08-27 15:42:09 -07:00
parent ea02aae40f
commit 141a4e3380
4 changed files with 32 additions and 75 deletions

View File

@ -184,7 +184,7 @@ class graph:
return False return False
def create_graph(self, source, target, scale=1): def create_graph(self, source, target):
""" 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))
@ -195,7 +195,6 @@ 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))
@ -221,9 +220,6 @@ 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. """

View File

@ -72,17 +72,6 @@ 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 core_contained_by_any(self, shape_list): def core_contained_by_any(self, shape_list):
""" """
Return if the core of this shape is contained by any shape's core in the Return if the core of this shape is contained by any shape's core in the

View File

@ -56,36 +56,22 @@ class signal_escape_router(router):
for source, target, _ in self.get_route_pairs(pin_names): for source, target, _ in self.get_route_pairs(pin_names):
# Change fake pin's name so the graph will treat it as routable # Change fake pin's name so the graph will treat it as routable
target.name = source.name target.name = source.name
# This is the routing region scale # Create the graph
scale = 1 g = graph(self)
while True: g.create_graph(source, target)
# Create the graph # Find the shortest path from source to target
g = graph(self) path = g.find_shortest_path()
region = g.create_graph(source, target, scale) # If no path is found, throw an error
# Find the shortest path from source to target if path is None:
path = g.find_shortest_path() self.write_debug_gds(gds_name="{}error.gds".format(OPTS.openram_temp), g=g, source=source, target=target)
# If there is no path found, exponentially try again with a debug.error("Couldn't route from {} to {}.".format(source, target), -1)
# larger routing region # Create the path shapes on layout
if path is None: new_shapes = self.add_path(path)
rll, rur = region self.new_pins[source.name] = new_shapes[0]
bll, bur = self.bbox # Find the recently added shapes
# Stop scaling the region and throw an error self.prepare_gds_reader()
if rll.x < bll.x and rll.y < bll.y and \ self.find_blockages(name)
rur.x > bur.x and rur.y > bur.y: self.find_vias()
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
new_shapes = self.add_path(path)
self.new_pins[source.name] = new_shapes[0]
# Find the recently added shapes
self.prepare_gds_reader()
self.find_blockages(name)
self.find_vias()
break
self.replace_layout_pins() self.replace_layout_pins()

View File

@ -71,35 +71,21 @@ class supply_router(router):
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)):
# This is the routing region scale # Create the graph
scale = 1 g = graph(self)
while True: region = g.create_graph(source, target)
# Create the graph # Find the shortest path from source to target
g = graph(self) path = g.find_shortest_path()
region = g.create_graph(source, target, scale) # If no path is found, throw an error
# Find the shortest path from source to target if path is None:
path = g.find_shortest_path() self.write_debug_gds(gds_name="{}error.gds".format(OPTS.openram_temp), g=g, source=source, target=target)
# If there is no path found, exponentially try again with a debug.error("Couldn't route from {} to {}.".format(source, target), -1)
# larger routing region # Create the path shapes on layout
if path is None: self.add_path(path)
rll, rur = region # Find the recently added shapes
bll, bur = self.bbox self.prepare_gds_reader()
# Stop scaling the region and throw an error self.find_blockages(pin_name)
if rll.x < bll.x and rll.y < bll.y and \ self.find_vias()
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 add_side_pin(self, pin_name, side, num_vias=3, num_fake_pins=4): def add_side_pin(self, pin_name, side, num_vias=3, num_fake_pins=4):