From 1cf1ef2cd7dde134ee301f2a9f406dee9b8b8d78 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 1 Jun 2021 14:41:15 +0100 Subject: [PATCH] move spot-check mem compare to a function use for further debugging by checking a corrupted address --- src/openpower/decoder/isa/pypowersim.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/openpower/decoder/isa/pypowersim.py b/src/openpower/decoder/isa/pypowersim.py index f49fe17b..99380877 100644 --- a/src/openpower/decoder/isa/pypowersim.py +++ b/src/openpower/decoder/isa/pypowersim.py @@ -37,6 +37,14 @@ def write_data(mem, fname, offset, sz): val = mem.ld(addr, 8) f.write(struct.pack('>Q', val)) # unsigned long +def sim_check_data(simulator, qemu, check_addr): + addr = check_addr & ~0x7 # align + sim_data = simulator.mem.ld(addr, 8, swap=False) + qdata = qemu.get_mem(addr, 8)[0] + log ("last", msg, hex(check_addr), hex(sim_data), hex(qdata)) + if sim_data != qdata: + log("expect mem %x, %x got %x" % (addr, qdata, sim_data)) + exit(0) def convert_to_num(num): # detect number types @@ -233,12 +241,7 @@ def run_tst(args, generator, qemu, check_addr = simulator.last_ld_addr msg = "ld" if check_addr is not None: - addr = check_addr & ~0x7 # align - sim_data = simulator.mem.ld(addr, 8, swap=False) - qdata = qemu.get_mem(addr, 8)[0] - log ("last", msg, hex(check_addr), hex(sim_data), hex(qdata)) - if sim_data != qdata: - log("expect mem %x, %x got %x" % (addr, qdata, sim_data)) + sim_check_data(simulator, qemu, check_addr) if _pc is None: break -- 2.30.2