diff --git a/compiler/router/graph.py b/compiler/router/graph.py index 9d7e7afb..604456b8 100644 --- a/compiler/router/graph.py +++ b/compiler/router/graph.py @@ -57,8 +57,7 @@ class graph: # Probe is blocked if the shape isn't routable if not self.is_routable(blockage): return True - if blockage.inflated_from is not None: - blockage = blockage.inflated_from + blockage = blockage.get_inflated_from() if blockage.overlaps(probe_shape): continue return True @@ -83,8 +82,7 @@ class graph: if not self.is_routable(blockage): blocked = True continue - if blockage.inflated_from is not None: - blockage = blockage.inflated_from + blockage = blockage.get_inflated_from() if self.inside_shape(node.center, blockage): offset = self.router.offset p = node.center diff --git a/compiler/router/graph_shape.py b/compiler/router/graph_shape.py index 448319b3..76a780c6 100644 --- a/compiler/router/graph_shape.py +++ b/compiler/router/graph_shape.py @@ -21,6 +21,17 @@ class graph_shape(pin_layout): self.inflated_from = inflated_from + def get_inflated_from(self): + """ + Return `self` if `self.inflated_from` is None. Otherwise, return + `self.inflated_from`. + """ + + if self.inflated_from is None: + return self + return self.inflated_from + + def inflated_pin(self, spacing=None, multiple=0.5, extra_spacing=0, keep_link=False): """ Override the default inflated_pin behavior. """