From 7877252e79c5e6105de1d7088ad6325cd1b03344 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 30 Nov 2021 16:18:18 +0000 Subject: [PATCH] add two more hazard tests --- src/openpower/test/general/overlap_hazards.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/openpower/test/general/overlap_hazards.py b/src/openpower/test/general/overlap_hazards.py index e3959dbe..78fe9795 100644 --- a/src/openpower/test/general/overlap_hazards.py +++ b/src/openpower/test/general/overlap_hazards.py @@ -138,3 +138,45 @@ class HazardTestCase(TestAccumulatorBase): e.intregs[6] = 2 e.intregs[7] = 4 self.add_case(Program(lst, bigendian), initial_regs, expected=e) + + def case_self_overlap_and_waw_6(self): + """also serves a secondary purpose of demonstrating a 2-operand + instruction followed by a 1-operand. + """ + lst = ["mullw 5, 7, 6", # r5 = 2*4 r5=8 + "addi 1, 8, 2", # r5 = 8+2 r5=10 + ] + initial_regs = [0] * 32 + initial_regs[2] = 2 + initial_regs[3] = 4 + initial_regs[6] = 2 + initial_regs[7] = 4 + e = ExpectedState(pc=8) + e.intregs[2] = 2 + e.intregs[3] = 4 + e.intregs[5] = 10 # 4 plus 5 == 9 + e.intregs[6] = 2 + e.intregs[7] = 4 + self.add_case(Program(lst, bigendian), initial_regs, expected=e) + + def case_regression_1(self): + lst = ["mullw 5, 7, 6", # r5 = 2*4 r5=8 + "addi 9, 5, 2", # r9 = 8+2 r9=10 + "divd 4, 9, 6", # r4 = 10//2 r4=5 + ] # r5 = 4+5 r5=9 + initial_regs = [0] * 32 + initial_regs[1] = 8 + initial_regs[2] = 2 + initial_regs[6] = 2 + initial_regs[7] = 4 + e = ExpectedState(pc=20) + e.intregs[1] = 8 + e.intregs[2] = 2 + e.intregs[3] = 4 # 8 divided by 2 == 4 + e.intregs[4] = 5 # 10 divided by 2 == 5 + e.intregs[5] = 9 # 4 plus 5 == 9 + e.intregs[6] = 2 + e.intregs[7] = 4 + e.intregs[9] = 10 # 8+2 == 10 + self.add_case(Program(lst, bigendian), initial_regs, expected=e) + -- 2.30.2