From 5d4c224e880bef04944ef5fb9fe4ad3810f468ce Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 27 Aug 2020 17:23:17 +0100 Subject: [PATCH] add addze and addme uni tests --- src/soc/fu/alu/test/test_pipe_caller.py | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/soc/fu/alu/test/test_pipe_caller.py b/src/soc/fu/alu/test/test_pipe_caller.py index 4e55dadc..15e33280 100644 --- a/src/soc/fu/alu/test/test_pipe_caller.py +++ b/src/soc/fu/alu/test/test_pipe_caller.py @@ -99,6 +99,46 @@ class ALUTestCase(TestAccumulatorBase): initial_regs[2] = random.randint(0, (1 << 64)-1) self.add_case(Program(lst, bigendian), initial_regs) + def case_addme_ca_0(self): + insns = ["addme", "addme.", "addmeo", "addmeo."] + for choice in insns: + lst = [f"{choice} 6, 16"] + initial_regs = [0] * 32 + initial_regs[16] = 0x7ffffffff + initial_sprs = {} + xer = SelectableInt(0, 64) + xer[XER_bits['CA']] = 0 + initial_sprs[special_sprs['XER']] = xer + self.add_case(Program(lst, bigendian), + initial_regs, initial_sprs) + + self.add_case(Program(lst, bigendian), initial_regs) + + def case_addme_ca_1(self): + insns = ["addme", "addme.", "addmeo", "addmeo."] + for choice in insns: + lst = [f"{choice} 6, 16"] + initial_regs = [0] * 32 + initial_regs[16] = 0x7ffffffff + initial_sprs = {} + xer = SelectableInt(0, 64) + xer[XER_bits['CA']] = 1 + initial_sprs[special_sprs['XER']] = xer + self.add_case(Program(lst, bigendian), + initial_regs, initial_sprs) + + self.add_case(Program(lst, bigendian), initial_regs) + + def case_addze(self): + insns = ["addze", "addze.", "addzeo", "addzeo."] + for choice in insns: + lst = [f"{choice} 6, 16"] + initial_regs = [0] * 32 + initial_regs[16] = 0x00ff00ff00ff0080 + self.add_case(Program(lst, bigendian), initial_regs) + + self.add_case(Program(lst, bigendian), initial_regs) + def case_addis_nonzero_r0_regression(self): lst = [f"addis 3, 0, 1"] print(lst) -- 2.30.2