From b1113ba5ca58dcb7fb43ee3288a1f4cee0e6a998 Mon Sep 17 00:00:00 2001 From: Ivan Kosarev Date: Wed, 29 Sep 2021 21:34:29 +0100 Subject: [PATCH] [#37] __add_recalc_node() to take nodes instead of indexes. --- tests/z80sim/z80sim.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/z80sim/z80sim.py b/tests/z80sim/z80sim.py index cb8979e..d206ca7 100755 --- a/tests/z80sim/z80sim.py +++ b/tests/z80sim/z80sim.py @@ -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):