From 1b636a0a8c2767c88af4227a731245780d6415b0 Mon Sep 17 00:00:00 2001 From: Ivan Kosarev Date: Tue, 27 Sep 2022 19:08:14 +0100 Subject: [PATCH] [Sim][#50] Refine getting effective node states. --- tests/z80sim/z80sim.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/z80sim/z80sim.py b/tests/z80sim/z80sim.py index 752cdc2..014b6b6 100755 --- a/tests/z80sim/z80sim.py +++ b/tests/z80sim/z80sim.py @@ -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): @@ -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):