From: klehman Date: Wed, 22 Sep 2021 13:44:28 +0000 (-0400) Subject: made mem sizes equal for compare purposes X-Git-Tag: sv_maxu_works-initial~852 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b77c0164e6cc0d55af15da49d355b5addf9c3f05;p=openpower-isa.git made mem sizes equal for compare purposes --- diff --git a/src/openpower/test/state.py b/src/openpower/test/state.py index 95f57ef8..0e4b78af 100644 --- a/src/openpower/test/state.py +++ b/src/openpower/test/state.py @@ -67,8 +67,14 @@ class State: (self.state_type, s2.state_type, repr(self.code))) def compare_mem(self, s2): - for i in self.mem: - self.dut.assertEqual(self.mem[i], s2.mem[i], + # copy dics to preserve state mem then pad empty locs + s1mem, s2mem = self.mem.copy(), s2.mem.copy() + for i in set(self.mem).difference(set(s2.mem)): + s2mem[i] = 0 + for i in set(s2.mem).difference(set(self.mem)): + s1mem[i] = 0 + for i in s1mem: + self.dut.assertEqual(s1mem[i], s2mem[i], "mem mismatch location %d %s" % (i, self.code))