Skip to content

Commit

Permalink
[Sim][#37] Substitute __add_node_to_group().
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Jun 13, 2022
1 parent 8c7d692 commit 5c59697
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions tests/z80sim/z80sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,20 +324,6 @@ def __load_defs(self):
self.__t5 = self.__nodes['t5']
self.__t6 = self.__nodes['t6']

def __add_node_to_group(self, n, group):
worklist = [n]
while worklist:
n = worklist.pop()
if n in group:
continue

group.append(n)

if n not in self.__gnd_pwr:
for t in n.conn_of:
if t.state:
worklist.append(t.get_other_conn(n))

def __get_group_state(self, group):
# 1. deal with power connections first
if self.__gnd in group:
Expand Down Expand Up @@ -375,7 +361,18 @@ def __recalc_node(self, n, recalc_nodes):
return

group = []
self.__add_node_to_group(n, group)
worklist = [n]
while worklist:
n = worklist.pop()
if n in group:
continue

group.append(n)

if n not in self.__gnd_pwr:
for t in n.conn_of:
if t.state:
worklist.append(t.get_other_conn(n))

new_state = self.__get_group_state(group)

Expand Down

0 comments on commit 5c59697

Please sign in to comment.