Skip to content

Commit

Permalink
[#37] __add_recalc_node() to take nodes instead of indexes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Sep 29, 2021
1 parent a46f67c commit b1113ba
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/z80sim/z80sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,27 +202,27 @@ def __get_node_value(self):

return max_state

def __add_recalc_node(self, nn):
if self.__nodes[nn] in (self.__gnd, self.__pwr):
def __add_recalc_node(self, n):
if n in (self.__gnd, self.__pwr):
return
if nn in self.__recalc_hash:
if n.id in self.__recalc_hash:
return
self.__recalc_list.append(nn)
self.__recalc_hash.add(nn)
self.__recalc_list.append(n.id)
self.__recalc_hash.add(n.id)

def __turn_transistor_on(self, t):
if t.on:
return
t.on = True
self.__add_recalc_node(t.c1.id)
# TODO: Why don't we do self.__add_recalc_node(t.c2.id)?
self.__add_recalc_node(t.c1)
# TODO: Why don't we do self.__add_recalc_node(t.c2)?

def __turn_transistor_off(self, t):
if not t.on:
return
t.on = False
self.__add_recalc_node(t.c1.id)
self.__add_recalc_node(t.c2.id)
self.__add_recalc_node(t.c1)
self.__add_recalc_node(t.c2)

def __recalc_node(self, node):
if self.__nodes[node] in (self.__gnd, self.__pwr):
Expand Down

0 comments on commit b1113ba

Please sign in to comment.