From 55fb1958bc219c35d900aa37db6390906a213ca3 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 21 Sep 2021 15:45:49 +0100 Subject: [PATCH] fix borked TestState.get_mem() assumed simmem.depth existed --- src/openpower/test/state.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/openpower/test/state.py b/src/openpower/test/state.py index e5227793..d7886fe8 100644 --- a/src/openpower/test/state.py +++ b/src/openpower/test/state.py @@ -121,13 +121,13 @@ class SimState(State): def get_mem(self): if False: yield - # obtain full list of contents of memory. assume starts - # at address zero. assumes 64-bit addresses. use - # Mem.ld in order to get data in the correct byteorder - simmem = self.sim.mem - self.mem = [] - for i in range(simmem.depth): - self.mem.append((i*8), simmem.ld(i*8, 8, False)) + keys = list(self.sim.mem.mem.keys()) + self.mem = {} + # from each address in the underlying mem-simulated dictionary + # issue a 64-bit LD (with no byte-swapping) + for k in keys: + data = self.sim.mem.ld(k*8, 8, False) + self.mem[k*8] = data class ExpectedState(State): -- 2.30.2