mirror of https://github.com/VLSIDA/OpenRAM.git
Find blocked nodes and probes faster
This commit is contained in:
parent
9ac82060b9
commit
ea02aae40f
|
|
@ -78,16 +78,23 @@ class graph:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
probe_shape = graph_probe(p1, p2, self.router.get_lpp(p1.z))
|
probe_shape = graph_probe(p1, p2, self.router.get_lpp(p1.z))
|
||||||
|
pll, pur = probe_shape.rect
|
||||||
# Check if any blockage blocks this probe
|
# Check if any blockage blocks this probe
|
||||||
for blockage in self.graph_blockages:
|
for blockage in self.graph_blockages:
|
||||||
# Check if two shapes overlap
|
bll, bur = blockage.rect
|
||||||
if blockage.overlaps(probe_shape):
|
# Not overlapping
|
||||||
# Probe is blocked if the shape isn't routable
|
if bll.x > pur.x or pll.x > bur.x or bll.y > pur.y or pll.y > bur.y:
|
||||||
if not self.is_routable(blockage):
|
continue
|
||||||
return True
|
# Not on the same layer
|
||||||
blockage = blockage.get_core()
|
if not blockage.same_lpp(blockage.lpp, probe_shape.lpp):
|
||||||
if blockage.overlaps(probe_shape):
|
continue
|
||||||
continue
|
# Probe is blocked if the shape isn't routable
|
||||||
|
if not self.is_routable(blockage):
|
||||||
|
return True
|
||||||
|
blockage = blockage.get_core()
|
||||||
|
bll, bur = blockage.rect
|
||||||
|
# Not overlapping
|
||||||
|
if bll.x > pur.x or pll.x > bur.x or bll.y > pur.y or pll.y > bur.y:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
@ -95,6 +102,11 @@ class graph:
|
||||||
def is_node_blocked(self, node, pin_safe=True):
|
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. """
|
||||||
|
|
||||||
|
p = node.center
|
||||||
|
x = p.x
|
||||||
|
y = p.y
|
||||||
|
z = p.z
|
||||||
|
|
||||||
def closest(value, checklist):
|
def closest(value, checklist):
|
||||||
""" Return the distance of the closest value in the checklist. """
|
""" Return the distance of the closest value in the checklist. """
|
||||||
diffs = [abs(value - other) for other in checklist]
|
diffs = [abs(value - other) for other in checklist]
|
||||||
|
|
@ -105,41 +117,47 @@ class graph:
|
||||||
spacing = snap(self.router.track_space + half_wide + drc["grid"])
|
spacing = snap(self.router.track_space + half_wide + drc["grid"])
|
||||||
blocked = False
|
blocked = False
|
||||||
for blockage in self.graph_blockages:
|
for blockage in self.graph_blockages:
|
||||||
# Check if the node is inside the blockage
|
ll, ur = blockage.rect
|
||||||
if self.inside_shape(node.center, blockage):
|
# Not overlapping
|
||||||
if not self.is_routable(blockage):
|
if ll.x > x or x > ur.x or ll.y > y or y > ur.y:
|
||||||
blocked = True
|
continue
|
||||||
continue
|
# Not on the same layer
|
||||||
blockage = blockage.get_core()
|
if self.router.get_zindex(blockage.lpp) != z:
|
||||||
# Check if the node is inside the blockage's core
|
continue
|
||||||
if self.inside_shape(node.center, blockage):
|
# Blocked if not routable
|
||||||
p = node.center
|
if not self.is_routable(blockage):
|
||||||
# Check if the node is too close to one edge of the shape
|
blocked = True
|
||||||
lengths = [blockage.width(), blockage.height()]
|
continue
|
||||||
centers = blockage.center()
|
blockage = blockage.get_core()
|
||||||
ll, ur = blockage.rect
|
ll, ur = blockage.rect
|
||||||
safe = [True, True]
|
# Not overlapping
|
||||||
for i in range(2):
|
if ll.x > x or x > ur.x or ll.y > y or y > ur.y:
|
||||||
if lengths[i] >= wide:
|
blocked = True
|
||||||
min_diff = closest(p[i], [ll[i], ur[i]])
|
continue
|
||||||
if min_diff < half_wide:
|
# Check if the node is too close to one edge of the shape
|
||||||
safe[i] = False
|
lengths = [blockage.width(), blockage.height()]
|
||||||
elif centers[i] != p[i]:
|
centers = blockage.center()
|
||||||
safe[i] = False
|
ll, ur = blockage.rect
|
||||||
if not all(safe):
|
safe = [True, True]
|
||||||
blocked = True
|
for i in range(2):
|
||||||
continue
|
if lengths[i] >= wide:
|
||||||
# Check if the node is in a safe region of the shape
|
min_diff = closest(p[i], [ll[i], ur[i]])
|
||||||
xs, ys = self.get_safe_pin_values(blockage)
|
if min_diff < half_wide:
|
||||||
xdiff = closest(p.x, xs)
|
safe[i] = False
|
||||||
ydiff = closest(p.y, ys)
|
elif centers[i] != p[i]:
|
||||||
if xdiff == 0 and ydiff == 0:
|
safe[i] = False
|
||||||
if pin_safe and blockage in [self.source, self.target]:
|
if not all(safe):
|
||||||
return False
|
blocked = True
|
||||||
elif xdiff < spacing and ydiff < spacing:
|
continue
|
||||||
blocked = True
|
# Check if the node is in a safe region of the shape
|
||||||
else:
|
xs, ys = self.get_safe_pin_values(blockage)
|
||||||
blocked = True
|
xdiff = closest(p.x, xs)
|
||||||
|
ydiff = closest(p.y, ys)
|
||||||
|
if xdiff == 0 and ydiff == 0:
|
||||||
|
if pin_safe and blockage in [self.source, self.target]:
|
||||||
|
return False
|
||||||
|
elif xdiff < spacing and ydiff < spacing:
|
||||||
|
blocked = True
|
||||||
return blocked
|
return blocked
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -151,12 +169,17 @@ class graph:
|
||||||
if self.is_node_blocked(node, pin_safe=False):
|
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
|
x = node.center.x
|
||||||
|
y = node.center.y
|
||||||
|
z = node.center.z
|
||||||
for via in self.graph_vias:
|
for via in self.graph_vias:
|
||||||
ll, ur = via.rect
|
ll, ur = via.rect
|
||||||
|
# Not overlapping
|
||||||
|
if ll.x > x or x > ur.x or ll.y > y or y > ur.y:
|
||||||
|
continue
|
||||||
center = via.center()
|
center = via.center()
|
||||||
if via.on_segment(ll, point, ur) and \
|
# If not in the center
|
||||||
(center.x != point.x or center.y != point.y):
|
if center.x != x or center.y != y:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue