Skip to content

Commit

Permalink
[Sim][#50] Refine getting effective node states.
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Sep 27, 2022
1 parent a36c40a commit 1b636a0
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions tests/z80sim/z80sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -2569,6 +2569,17 @@ def process_instr(instrs, base_state, *, test=False):
# to reach their nodes.
EXTRA_TICKS = 3

def get_effective_states(s):
s = State(s)

s.set_db(0x00) # nop
for t in range(EXTRA_TICKS):
for ht in (0, 1):
with s.status(f'extra tick {t}.{ht}'):
s.half_tick()
s.cache()
return s.get_node_states(SAMPLED_NODES)

TESTED_NODES = {CF, NF, PF, XF, HF, YF, ZF, SF, IFF2}
for r in 'awz':
for i in range(8):
Expand Down Expand Up @@ -2606,13 +2617,7 @@ def process_instr(instrs, base_state, *, test=False):

# Status.print('; '.join(instr_ids))

s.set_db(0x00) # nop
for t in range(EXTRA_TICKS):
for ht in (0, 1):
with s.status(f'extra tick {t}.{ht}'):
s.half_tick()
s.cache()
after = s.get_node_states(SAMPLED_NODES)
after = get_effective_states(s)

def swap(a, b):
for ns in (before, after):
Expand Down

0 comments on commit 1b636a0

Please sign in to comment.