code-comments
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 17 Nov 2021 16:15:01 +0000 (16:15 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 17 Nov 2021 16:15:01 +0000 (16:15 +0000)
src/openpower/test/general/overlap_hazards.py [new file with mode: 0644]

diff --git a/src/openpower/test/general/overlap_hazards.py b/src/openpower/test/general/overlap_hazards.py
new file mode 100644 (file)
index 0000000..fa186e0
--- /dev/null
@@ -0,0 +1,27 @@
+import random
+from openpower.test.common import TestAccumulatorBase
+from openpower.endian import bigendian
+from openpower.simulator.program import Program
+from openpower.decoder.selectable_int import SelectableInt
+from openpower.decoder.power_enums import XER_bits
+from openpower.decoder.isa.caller import special_sprs
+from openpower.test.state import ExpectedState
+import unittest
+
+
+class HazardTestCase(TestAccumulatorBase):
+
+    def case_div_add_overlap(self):
+        lst = ["divd 3, 1, 2",
+               "add 5, 3, 4"]
+        initial_regs = [0] * 32
+        initial_regs[1] = 6
+        initial_regs[2] = 2
+        initial_regs[4] = 4
+        e = ExpectedState(pc=8)
+        e.intregs[1] = 6
+        e.intregs[2] = 2
+        e.intregs[3] = 3 # 6 divided by 2 == 3
+        e.intregs[4] = 4
+        e.intregs[5] = 7 # 3 plus 4 == 7
+        self.add_case(Program(lst, bigendian), initial_regs, expected=e)