From 71e4a5ab6c547624ce58b870e6b3d349b80df32d Mon Sep 17 00:00:00 2001 From: Eren Dogan Date: Thu, 13 Jul 2023 12:07:55 -0700 Subject: [PATCH] Rename gridless router files --- compiler/router/{hanan_graph.py => graph.py} | 30 +++++++++---------- .../router/{hanan_node.py => graph_node.py} | 8 ++--- .../router/{hanan_probe.py => graph_probe.py} | 2 +- .../{hanan_router.py => graph_router.py} | 21 ++++++------- .../router/{hanan_shape.py => graph_shape.py} | 6 ++-- 5 files changed, 34 insertions(+), 33 deletions(-) rename compiler/router/{hanan_graph.py => graph.py} (91%) rename compiler/router/{hanan_node.py => graph_node.py} (93%) rename compiler/router/{hanan_probe.py => graph_probe.py} (95%) rename compiler/router/{hanan_router.py => graph_router.py} (97%) rename compiler/router/{hanan_shape.py => graph_shape.py} (91%) diff --git a/compiler/router/hanan_graph.py b/compiler/router/graph.py similarity index 91% rename from compiler/router/hanan_graph.py rename to compiler/router/graph.py index d82f1fec..3835f366 100644 --- a/compiler/router/hanan_graph.py +++ b/compiler/router/graph.py @@ -10,16 +10,16 @@ from openram.base.vector import vector from openram.base.vector3d import vector3d from openram.tech import drc from .direction import direction -from .hanan_node import hanan_node -from .hanan_probe import hanan_probe +from .graph_node import graph_node +from .graph_probe import graph_probe -class hanan_graph: - """ This is the Hanan graph created from the blockages. """ +class graph: + """ This is the graph created from the blockages. """ def __init__(self, router): - # This is the Hanan router that uses this graph + # This is the graph router that uses this graph self.router = router self.source_nodes = [] self.target_nodes = [] @@ -43,7 +43,7 @@ class hanan_graph: This function assumes that p1 and p2 are on the same layer. """ - probe_shape = hanan_probe(p1, p2, self.router.vert_lpp if p1.z else self.router.horiz_lpp) + probe_shape = graph_probe(p1, p2, self.router.vert_lpp if p1.z else self.router.horiz_lpp) # Check if any blockage blocks this probe for blockage in self.graph_blockages: # Check if two shapes overlap @@ -54,8 +54,8 @@ class hanan_graph: def create_graph(self, source, target): - """ Create the Hanan graph to run routing on later. """ - debug.info(2, "Creating the Hanan graph for source '{}' and target'{}'.".format(source, target)) + """ Create the graph to run routing on later. """ + debug.info(2, "Creating the graph for source '{}' and target'{}'.".format(source, target)) self.source = source self.target = target @@ -79,9 +79,9 @@ class hanan_graph: self.graph_blockages.append(blockage) debug.info(3, "Number of blockages detected in the routing region: {}".format(len(self.graph_blockages))) - # Create the Hanan graph + # Create the graph x_values, y_values = self.generate_cartesian_values() - self.generate_hanan_nodes(x_values, y_values) + self.generate_graph_nodes(x_values, y_values) self.remove_blocked_nodes() debug.info(3, "Number of nodes in the routing graph: {}".format(len(self.nodes))) @@ -128,9 +128,9 @@ class hanan_graph: return x_values, y_values - def generate_hanan_nodes(self, x_values, y_values): + def generate_graph_nodes(self, x_values, y_values): """ - Generate all Hanan nodes using the cartesian values and connect the + Generate all graph nodes using the cartesian values and connect the orthogonal neighbors. """ @@ -139,8 +139,8 @@ class hanan_graph: self.nodes = [] for x in x_values: for y in y_values: - below_node = hanan_node([x, y, 0]) - above_node = hanan_node([x, y, 1]) + below_node = graph_node([x, y, 0]) + above_node = graph_node([x, y, 1]) # Connect these two neighbors below_node.add_neighbor(above_node) @@ -178,7 +178,7 @@ class hanan_graph: def remove_blocked_nodes(self): - """ Remove the Hanan nodes that are blocked by a blockage. """ + """ Remove the graph nodes that are blocked by a blockage. """ for i in range(len(self.nodes) - 1, -1, -1): node = self.nodes[i] diff --git a/compiler/router/hanan_node.py b/compiler/router/graph_node.py similarity index 93% rename from compiler/router/hanan_node.py rename to compiler/router/graph_node.py index 16c2e124..78642b22 100644 --- a/compiler/router/hanan_node.py +++ b/compiler/router/graph_node.py @@ -8,16 +8,16 @@ from openram.base.vector3d import vector3d from openram.tech import drc -class hanan_node: - """ This class represents a node on the Hanan graph. """ +class graph_node: + """ This class represents a node on the graph. """ # This is used to assign unique ids to nodes next_id = 0 def __init__(self, center): - self.id = hanan_node.next_id - hanan_node.next_id += 1 + self.id = graph_node.next_id + graph_node.next_id += 1 if isinstance(center, vector3d): self.center = center else: diff --git a/compiler/router/hanan_probe.py b/compiler/router/graph_probe.py similarity index 95% rename from compiler/router/hanan_probe.py rename to compiler/router/graph_probe.py index 87788227..31f06a57 100644 --- a/compiler/router/hanan_probe.py +++ b/compiler/router/graph_probe.py @@ -4,7 +4,7 @@ # All rights reserved. # -class hanan_probe: +class graph_probe: """ This class represents a probe sent from one point to another on Hanan graph. This is used to mimic the pin_layout class to utilize its methods. diff --git a/compiler/router/hanan_router.py b/compiler/router/graph_router.py similarity index 97% rename from compiler/router/hanan_router.py rename to compiler/router/graph_router.py index db508773..85f9de3b 100644 --- a/compiler/router/hanan_router.py +++ b/compiler/router/graph_router.py @@ -11,13 +11,14 @@ from openram.tech import GDS from openram.tech import layer as tech_layer from openram import OPTS from .router_tech import router_tech -from .hanan_graph import hanan_graph -from .hanan_shape import hanan_shape +from .graph import graph +from .graph_shape import graph_shape -class hanan_router(router_tech): +class graph_router(router_tech): """ - This is the router class that implements Hanan graph routing algorithm. + This is the router class that uses the Hanan grid method to route pins using + a graph. """ def __init__(self, layers, design, bbox=None, pin_type=None): @@ -96,8 +97,8 @@ class hanan_router(router_tech): pins = self.pins[pin_name] # Route closest pins according to the minimum spanning tree for source, target in self.get_mst_pairs(list(pins)): - # Create the Hanan graph - hg = hanan_graph(self) + # Create the graph + hg = graph(self) hg.create_graph(source, target) # Find the shortest path from source to target path = hg.find_shortest_path() @@ -134,7 +135,7 @@ class hanan_router(router_tech): ll = vector(boundary[0], boundary[1]) ur = vector(boundary[2], boundary[3]) rect = [ll, ur] - new_pin = hanan_shape(pin_name, rect, layer) + new_pin = graph_shape(pin_name, rect, layer) # Skip this pin if it's contained by another pin of the same type if new_pin.contained_by_any(pin_set): continue @@ -171,7 +172,7 @@ class hanan_router(router_tech): name = "blockage{}".format(len(blockages)) else: name = shape_name - new_shape = hanan_shape(name, rect, lpp) + new_shape = graph_shape(name, rect, lpp) # If there is a rectangle that is the same in the pins, # it isn't a blockage # Also ignore the new pins @@ -283,7 +284,7 @@ class hanan_router(router_tech): ll = vector(offset.x - self.track_wire, offset.y) ur = vector(offset.x, offset.y + wideness) rect = [ll, ur] - fake_pin = hanan_shape(name=pin_name, + fake_pin = graph_shape(name=pin_name, rect=rect, layer_name_pp=layer) fake_pins.append(fake_pin) @@ -302,7 +303,7 @@ class hanan_router(router_tech): ll, ur = new_shape.rect rect = [ll, ur] layer = self.get_layer(side in ["left", "right"]) - new_pin = hanan_shape(name=pin_name, + new_pin = graph_shape(name=pin_name, rect=rect, layer_name_pp=layer) new_pins.append(new_pin) diff --git a/compiler/router/hanan_shape.py b/compiler/router/graph_shape.py similarity index 91% rename from compiler/router/hanan_shape.py rename to compiler/router/graph_shape.py index 39af5bbf..448319b3 100644 --- a/compiler/router/hanan_shape.py +++ b/compiler/router/graph_shape.py @@ -8,10 +8,10 @@ from openram.base.vector import vector from openram.tech import drc -class hanan_shape(pin_layout): +class graph_shape(pin_layout): """ This class inherits the pin_layout class to change some of its behavior for - the Hanan router. + the graph router. """ def __init__(self, name, rect, layer_name_pp, inflated_from=None): @@ -29,7 +29,7 @@ class hanan_shape(pin_layout): newll = ll - extra newur = ur + extra inflated_area = (newll, newur) - return hanan_shape(self.name, inflated_area, self.layer, self if keep_link else None) + return graph_shape(self.name, inflated_area, self.layer, self if keep_link else None) def aligns(self, other):