add misaligned mem test
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 30 Dec 2022 13:20:56 +0000 (13:20 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 30 Dec 2022 13:20:56 +0000 (13:20 +0000)
src/openpower/decoder/isa/test_mem.py

index 4436d07f383ee95fddc7438cb36d6c39a2679745..bd847c26b130874ecdcce336b9b1ecc24e2cfbeb 100644 (file)
@@ -9,13 +9,21 @@ from openpower.util import log
 
 class TestMem(unittest.TestCase):
 
-    def test_mem_align_ld(self):
+    def test_mem_align_st(self):
         m = Mem(row_bytes=8, initial_mem={})
         m.st(4, 0x12345678, width=4, swap=False)
         d = m.dump()
         log ("dict", d)
         self.assertEqual(d, [(0, 0x1234567800000000)])
 
+    def test_mem_misalign_st(self):
+        m = Mem(row_bytes=8, initial_mem={})
+        m.st(4, 0x912345678, width=8, swap=False)
+        d = m.dump()
+        log ("dict", d)
+        self.assertEqual(d, [(0, 0x1234567800000000),
+                              8, 0x0000000000000009])
+
 
 if __name__ == '__main__':
     unittest.main()