Skip to content

Commit adef220

Browse files
committed
[Sim][#37] Give things some better names.
1 parent aceaf7f commit adef220

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

tests/z80sim/z80sim.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def __load_defs(self):
324324
self.__t5 = self.__nodes['t5']
325325
self.__t6 = self.__nodes['t6']
326326

327-
def __recalc_node(self, n, recalc_nodes):
327+
def __update_group_of(self, n, more):
328328
if n in self.__gnd_pwr:
329329
return
330330

@@ -369,31 +369,31 @@ def __recalc_node(self, n, recalc_nodes):
369369

370370
t.state = state
371371

372-
if t.c1 not in self.__gnd_pwr and t.c1 not in recalc_nodes:
373-
recalc_nodes.append(t.c1)
372+
if t.c1 not in self.__gnd_pwr and t.c1 not in more:
373+
more.append(t.c1)
374374

375375
# It only makes sense to update the group of the second
376376
# connection if the trasistor became closed.
377377
if not state:
378-
if t.c2 not in self.__gnd_pwr and t.c2 not in recalc_nodes:
379-
recalc_nodes.append(t.c2)
378+
if t.c2 not in self.__gnd_pwr and t.c2 not in more:
379+
more.append(t.c2)
380380

381-
def __recalc_node_list(self, recalc_nodes):
381+
def __update_nodes(self, nodes):
382382
attempt = 0
383-
while recalc_nodes:
383+
while nodes:
384384
# Loop limiter.
385385
attempt += 1
386386
if attempt > 100:
387387
break
388388

389-
nodes = recalc_nodes
390-
recalc_nodes = []
389+
more = []
391390
for n in nodes:
392-
self.__recalc_node(n, recalc_nodes)
391+
self.__update_group_of(n, more)
392+
nodes = more
393393

394394
def __set_node(self, n, pull):
395395
n.pull = pull
396-
self.__recalc_node_list([n])
396+
self.__update_nodes([n])
397397

398398
def half_tick(self):
399399
if self.clk:
@@ -429,9 +429,8 @@ def __init_chip(self, skip_reset):
429429
self.nnmi = True
430430
self.nwait = True
431431

432-
self.__recalc_node_list(
433-
[n for n in self.__indexes_to_nodes.values()
434-
if n not in self.__gnd_pwr])
432+
self.__update_nodes([n for n in self.__indexes_to_nodes.values()
433+
if n not in self.__gnd_pwr])
435434

436435
# Propagate the reset signal.
437436
for _ in range(31):

0 commit comments

Comments
 (0)