Skip to content

Commit

Permalink
[#37] Refine __recalc_node_list().
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Oct 1, 2021
1 parent 1c75528 commit d1b104b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tests/z80sim/z80sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,18 @@ def __recalc_node(self, n, recalc_nodes):
for t in n.gates:
self.__set_transistor(t, n.state, recalc_nodes)

def __recalc_node_list(self, nodes):
recalc_nodes = []
for j in range(100): # Loop limiter.
if len(nodes) == 0:
return

for n in nodes:
self.__recalc_node(n, recalc_nodes)
def __recalc_node_list(self, recalc_nodes):
attempt = 0
while recalc_nodes:
# Loop limiter.
attempt += 1
if attempt > 100:
break

nodes = recalc_nodes
recalc_nodes = []
for n in nodes:
self.__recalc_node(n, recalc_nodes)

def __set_node(self, n, pull):
n.pull = pull
Expand Down

0 comments on commit d1b104b

Please sign in to comment.