Add "pin safe" functionality to is_node_blocked()

This commit is contained in:
Eren Dogan 2023-07-26 16:41:46 -07:00
parent d609ef9243
commit 53505e2ed2
1 changed files with 3 additions and 3 deletions

View File

@ -65,7 +65,7 @@ class graph:
return False return False
def is_node_blocked(self, node): def is_node_blocked(self, node, pin_safe=True):
""" Return if a node is blocked by a blockage. """ """ Return if a node is blocked by a blockage. """
blocked = False blocked = False
@ -92,7 +92,7 @@ class graph:
safe[i] = False safe[i] = False
if not all(safe): if not all(safe):
blocked = True blocked = True
elif blockage in [self.source, self.target]: elif pin_safe and blockage in [self.source, self.target]:
return False return False
else: else:
blocked = True blocked = True
@ -104,7 +104,7 @@ class graph:
# If the nodes are blocked by a blockage other than a via # If the nodes are blocked by a blockage other than a via
for node in nodes: for node in nodes:
if self.is_node_blocked(node): if self.is_node_blocked(node, pin_safe=False):
return True return True
# If the nodes are blocked by a via # If the nodes are blocked by a via
point = node.center point = node.center