add write-after-write hazard test for inorder core
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 23 Nov 2021 15:16:28 +0000 (15:16 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 23 Nov 2021 15:16:58 +0000 (15:16 +0000)
src/openpower/test/general/overlap_hazards.py

index 13aa9c3ada48aaa13061615be59cc0c3be57af3c..a5a8da0ab0f05c02fe6d1223add530901e5b1776 100644 (file)
@@ -46,18 +46,37 @@ class HazardTestCase(TestAccumulatorBase):
         e.intregs[7] = 4
         self.add_case(Program(lst, bigendian), initial_regs, expected=e)
 
+    def case_div_add_overlap_write_after_write(self):
+        lst = ["divd 3, 1, 2",
+               "add 3, 7, 6", # 2+4=6, overwrites divd
+               "add 5, 3, 2"  # 3+2=5
+               ]
+        initial_regs = [0] * 32
+        initial_regs[1] = 6
+        initial_regs[2] = 2
+        initial_regs[6] = 2
+        initial_regs[7] = 4
+        e = ExpectedState(pc=12)
+        e.intregs[1] = 6
+        e.intregs[2] = 2
+        e.intregs[3] = 3 # 2 plus 4 == 6, overwriting div
+        e.intregs[5] = 5 # 3 plus 2 == 5
+        e.intregs[6] = 2
+        e.intregs[7] = 4
+        self.add_case(Program(lst, bigendian), initial_regs, expected=e)
+
     def cse_div_add_overlap_3(self):
         lst = ["divd 3, 1, 2",
                "mullw 5, 7, 6", # 2*4=6, overwritten later by add
-               "addi 5, 5, 2",  # add 2 to 6 = 8
-               "divd 4, 5, 6",
+               "addi 9, 5, 2",  # add 2 to 6 = 8
+               "divd 4, 9, 6",
                "add 5, 3, 4"]
         initial_regs = [0] * 32
         initial_regs[1] = 6
         initial_regs[2] = 2
         initial_regs[6] = 2
         initial_regs[7] = 4
-        e = ExpectedState(pc=16)
+        e = ExpectedState(pc=20)
         e.intregs[1] = 6
         e.intregs[2] = 2
         e.intregs[3] = 3 # 6 divided by 2 == 3