Skip to content

Commit

Permalink
[Sim][#37] Inline __add_recalc_node().
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Jun 13, 2022
1 parent 5c59697 commit 2ee6f52
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions tests/z80sim/z80sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,23 +338,19 @@ def __get_group_state(self, group):

return None

def __add_recalc_node(self, n, recalc_nodes):
if n in self.__gnd_pwr:
return
if n in recalc_nodes:
return
recalc_nodes.append(n)

def __set_transistor(self, t, state, recalc_nodes):
if t.state == state:
return
t.state = state
self.__add_recalc_node(t.c1, recalc_nodes)
if state:
# TODO: Why don't we do self.__add_recalc_node(t.c2)?
pass
else:
self.__add_recalc_node(t.c2, recalc_nodes)

if t.c1 not in self.__gnd_pwr and t.c1 not in recalc_nodes:
recalc_nodes.append(t.c1)

# It only makes sense to update the group of the second
# connection if the trasistor became closed.
if not state:
if t.c2 not in self.__gnd_pwr and t.c2 not in recalc_nodes:
recalc_nodes.append(t.c2)

def __recalc_node(self, n, recalc_nodes):
if n in self.__gnd_pwr:
Expand Down

0 comments on commit 2ee6f52

Please sign in to comment.