From 08dad8121447b452387e29a236317543159fcf9e Mon Sep 17 00:00:00 2001 From: Eren Dogan Date: Wed, 2 Aug 2023 17:48:56 -0700 Subject: [PATCH] Use the same inflating rules for all shapes in router --- compiler/router/router.py | 37 ++++++++++++------------- compiler/router/signal_escape_router.py | 3 +- compiler/router/supply_router.py | 4 +-- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/compiler/router/router.py b/compiler/router/router.py index acf1a00c..917c49d9 100644 --- a/compiler/router/router.py +++ b/compiler/router/router.py @@ -145,7 +145,7 @@ class router(router_tech): # Skip this via if it's contained by an existing via blockage if new_shape.contained_by_any(self.vias): continue - self.vias.append(self.inflate_shape(new_shape, is_via=True)) + self.vias.append(self.inflate_shape(new_shape)) def convert_vias(self): @@ -188,32 +188,31 @@ class router(router_tech): break - def inflate_shape(self, shape, is_pin=False, is_via=False): + def inflate_shape(self, shape): """ Inflate a given shape with spacing rules. """ - # Pins must keep their center lines away from any blockage to prevent - # the nodes from being unconnected - if is_pin: - xdiff = self.layer_widths[0] - shape.width() - ydiff = self.layer_widths[0] - shape.height() - diff = max(xdiff, ydiff) / 2 - spacing = self.track_space + drc["grid"] - if diff > 0: - spacing += diff - # Vias are inflated by the maximum spacing rule - elif is_via: - spacing = self.track_space - # Blockages are inflated by their layer's corresponding spacing rule + # Get the layer-specific spacing rule + if self.get_zindex(shape.lpp) == 1: + spacing = self.vert_layer_spacing else: - if self.get_zindex(shape.lpp) == 1: - spacing = self.vert_layer_spacing - else: - spacing = self.horiz_layer_spacing + spacing = self.horiz_layer_spacing # If the shape is wider than the supply wire width, its spacing can be # different wide = min(shape.width(), shape.height()) if wide > self.layer_widths[0]: spacing = self.get_layer_space(self.get_zindex(shape.lpp), wide) + + # Shapes must keep their center lines away from any blockage to prevent + # the nodes from being unconnected + xdiff = self.track_wire - shape.width() + ydiff = self.track_wire - shape.height() + diff = snap(max(xdiff, ydiff) / 2) + if diff > 0: + spacing += diff + + # Add minimum unit to the spacing to keep nodes out of inflated regions + spacing += drc["grid"] + return shape.inflated_pin(spacing=spacing, extra_spacing=self.half_wire) diff --git a/compiler/router/signal_escape_router.py b/compiler/router/signal_escape_router.py index 8e6479cb..d5b7c929 100644 --- a/compiler/router/signal_escape_router.py +++ b/compiler/router/signal_escape_router.py @@ -50,9 +50,10 @@ class signal_escape_router(router): # Add vdd and gnd pins as blockages as well # NOTE: This is done to make vdd and gnd pins DRC-safe for pin in self.all_pins: - self.blockages.append(self.inflate_shape(pin, is_pin=True)) + self.blockages.append(self.inflate_shape(pin)) # Route vdd and gnd + i = 0 for source, target, _ in self.get_route_pairs(pin_names): # Change fake pin's name so the graph will treat it as routable target.name = source.name diff --git a/compiler/router/supply_router.py b/compiler/router/supply_router.py index aa774731..d33b9ad6 100644 --- a/compiler/router/supply_router.py +++ b/compiler/router/supply_router.py @@ -65,7 +65,7 @@ class supply_router(router): # Add vdd and gnd pins as blockages as well # NOTE: This is done to make vdd and gnd pins DRC-safe for pin in self.all_pins: - self.blockages.append(self.inflate_shape(pin, is_pin=True)) + self.blockages.append(self.inflate_shape(pin)) # Route vdd and gnd for pin_name in [vdd_name, gnd_name]: @@ -239,7 +239,7 @@ class supply_router(router): # Save side pins for routing self.new_pins[pin_name] = new_pins for pin in new_pins: - self.blockages.append(self.inflate_shape(pin, is_pin=True)) + self.blockages.append(self.inflate_shape(pin)) def get_mst_pairs(self, pins):