mirror of https://github.com/VLSIDA/OpenRAM.git
Simplify 'remove' attribute of graph_node
This commit is contained in:
parent
ad05fde099
commit
9ac82060b9
|
|
@ -301,12 +301,12 @@ class graph:
|
||||||
def search(index, condition, shift):
|
def search(index, condition, shift):
|
||||||
""" Search and connect neighbor nodes. """
|
""" Search and connect neighbor nodes. """
|
||||||
base_nodes = self.nodes[index:index+2]
|
base_nodes = self.nodes[index:index+2]
|
||||||
found = [hasattr(base_nodes[0], "remove"),
|
found = [base_nodes[0].remove,
|
||||||
hasattr(base_nodes[1], "remove")]
|
base_nodes[1].remove]
|
||||||
while condition(index) and not all(found):
|
while condition(index) and not all(found):
|
||||||
nodes = self.nodes[index - shift:index - shift + 2]
|
nodes = self.nodes[index - shift:index - shift + 2]
|
||||||
for k in range(2):
|
for k in range(2):
|
||||||
if not found[k] and not hasattr(nodes[k], "remove"):
|
if not found[k] and not nodes[k].remove:
|
||||||
found[k] = True
|
found[k] = True
|
||||||
if not self.is_probe_blocked(base_nodes[k].center, nodes[k].center):
|
if not self.is_probe_blocked(base_nodes[k].center, nodes[k].center):
|
||||||
base_nodes[k].add_neighbor(nodes[k])
|
base_nodes[k].add_neighbor(nodes[k])
|
||||||
|
|
@ -315,8 +315,8 @@ class graph:
|
||||||
for i in range(0, len(self.nodes), 2):
|
for i in range(0, len(self.nodes), 2):
|
||||||
search(i, lambda count: (count / 2) % y_len, 2) # Down
|
search(i, lambda count: (count / 2) % y_len, 2) # Down
|
||||||
search(i, lambda count: (count / 2) >= y_len, y_len * 2) # Left
|
search(i, lambda count: (count / 2) >= y_len, y_len * 2) # Left
|
||||||
if not hasattr(self.nodes[i], "remove") and \
|
if not self.nodes[i].remove and \
|
||||||
not hasattr(self.nodes[i + 1], "remove") and \
|
not self.nodes[i + 1].remove and \
|
||||||
not self.is_via_blocked(self.nodes[i:i+2]):
|
not self.is_via_blocked(self.nodes[i:i+2]):
|
||||||
self.nodes[i].add_neighbor(self.nodes[i + 1])
|
self.nodes[i].add_neighbor(self.nodes[i + 1])
|
||||||
|
|
||||||
|
|
@ -338,7 +338,7 @@ class graph:
|
||||||
|
|
||||||
for i in range(len(self.nodes) - 1, -1, -1):
|
for i in range(len(self.nodes) - 1, -1, -1):
|
||||||
node = self.nodes[i]
|
node = self.nodes[i]
|
||||||
if hasattr(node, "remove"):
|
if node.remove:
|
||||||
node.remove_all_neighbors()
|
node.remove_all_neighbors()
|
||||||
self.nodes.remove(node)
|
self.nodes.remove(node)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ class graph_node:
|
||||||
else:
|
else:
|
||||||
self.center = vector3d(center)
|
self.center = vector3d(center)
|
||||||
self.neighbors = []
|
self.neighbors = []
|
||||||
|
self.remove = False
|
||||||
|
|
||||||
|
|
||||||
def add_neighbor(self, other):
|
def add_neighbor(self, other):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue