From 7e5d02d82ef93c7a592dae25707959987e06f3e4 Mon Sep 17 00:00:00 2001 From: Cole Poirier Date: Wed, 5 Aug 2020 13:56:11 -0700 Subject: [PATCH] Add second case_all test where rb is randint --- src/soc/fu/mul/test/test_pipe_caller.py | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/soc/fu/mul/test/test_pipe_caller.py b/src/soc/fu/mul/test/test_pipe_caller.py index 3274f012..1f27cefc 100644 --- a/src/soc/fu/mul/test/test_pipe_caller.py +++ b/src/soc/fu/mul/test/test_pipe_caller.py @@ -199,6 +199,40 @@ class MulTestCase(TestAccumulatorBase): with Program(l, bigendian) as prog: self.add_case(prog, initial_regs) + def case_all_rb_randint(self): + instrs = ["mulli","mulhw", + "mulhw.","mullw", + "mullw.","mullwo", + "mullwo.","mulhwu", + "mulhwu.","mulld", + "mulld.","mulldo", + "mulldo.","mulhd", + "mulhd.","mulhdu", + "mulhdu."] + + test_values = [ + 0x0, + 0x1, + 0x2, + 0xFFFF_FFFF_FFFF_FFFF, + 0xFFFF_FFFF_FFFF_FFFE, + 0x7FFF_FFFF_FFFF_FFFF, + 0x8000_0000_0000_0000, + 0x1234_5678_0000_0000, + 0x1234_5678_8000_0000, + 0x1234_5678_FFFF_FFFF, + 0x1234_5678_7FFF_FFFF, + ] + + for instr in instrs: + l = [f"{instr} 3, 1, 2"] + for ra in test_values: + initial_regs = [0] * 32 + initial_regs[1] = ra + initial_regs[2] = random.randint(0, (1 << 64)-1) + # use "with" so as to close the files used + with Program(l, bigendian) as prog: + self.add_case(prog, initial_regs) def case_ilang(self): pspec = MulPipeSpec(id_wid=2) -- 2.30.2