diff options
Diffstat (limited to 'mpm/python/tests/test_utilities.py')
-rwxr-xr-x | mpm/python/tests/test_utilities.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mpm/python/tests/test_utilities.py b/mpm/python/tests/test_utilities.py index 198eda5e8..942ad956a 100755 --- a/mpm/python/tests/test_utilities.py +++ b/mpm/python/tests/test_utilities.py @@ -90,6 +90,7 @@ class MockRegsIface(object): self.map = register_map self.recent_vals = {} self.next_vals = {} + self.recent_addrs = [] def peek32(self, addr): """ @@ -110,12 +111,32 @@ class MockRegsIface(object): """ self.map.set_reg(addr, value) + self.recent_addrs.append(addr) + # Store written value in a list if addr in self.recent_vals: self.recent_vals[addr].append(value) else: self.recent_vals[addr] = [value] + def peek16(self, addr): + """ + Pass the request to the 32 bit version + """ + return self.peek32(addr) & 0xFFFF + + def poke16(self, addr, value): + """ + Pass the request to the 32 bit version + """ + self.poke32(addr, value) + + def get_recent_addrs(self): + return self.recent_addrs + + def clear_recent_addrs(self): + self.recent_addrs = [] + def get_recent_vals(self, addr): """ Returns the past values written to a given address. @@ -123,6 +144,13 @@ class MockRegsIface(object): """ return self.recent_vals.get(addr, []) + def clear_recent_vals(self, addr): + """ + Clears the past values written to a given address. + Useful for validating HW interaction + """ + self.recent_vals[addr] = [] + def set_next_vals(self, addr, vals): """ Sets a list of the next values to be read from the |