From 5e98d67504532996bea112a909ea99c7b8b5ad9b Mon Sep 17 00:00:00 2001 From: Cole Poirier Date: Thu, 6 Aug 2020 17:19:49 -0700 Subject: [PATCH] Update mulli to try to use immediates not registers --- src/soc/fu/mul/test/test_pipe_caller.py | 27 ++++++++++--------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/soc/fu/mul/test/test_pipe_caller.py b/src/soc/fu/mul/test/test_pipe_caller.py index 3033e2a5..82974d38 100644 --- a/src/soc/fu/mul/test/test_pipe_caller.py +++ b/src/soc/fu/mul/test/test_pipe_caller.py @@ -287,22 +287,17 @@ class MulTestCase(TestAccumulatorBase): def case_mulli(self): - test_values = [-32768, -32767, -32766, -2, -1, 0, 1, 2, 32766, 32767, - random.randint(-1 << 15, (1 << 15)-1), random.randint( - -1 << 15, (1 << 15) - 1), random.randint(-1 << 15, - (1 << 15)-1), random.randint(-1 << 15, (1 << 15)-1), - random.randint(-1 << 15, (1 << 15)-1) - ] - - l = ["mulli 3, 1, 2"] - for ra in test_values: - for rb in test_values: - initial_regs = [0] * 32 - initial_regs[1] = ra - initial_regs[2] = rb - # use "with" so as to close the files used - with Program(l, bigendian) as prog: - self.add_case(prog, initial_regs) + test_values = [-32768, -32767, -32766, -2, -1, 0, 1, 2, 32766, 32767] + + for i in range(40): + choice = random.choice(test_values) + l = [f"mulli 1, 0, {choice}"] + initial_regs = [0] * 32 + initial_regs[1] = random.randint(-1 << 15, (1 << 15) - 1) + initial_regs[2] = random.randint(-1 << 15, (1 << 15) - 1) + # use "with" so as to close the files used + with Program(l, bigendian) as prog: + self.add_case(prog, initial_regs) # TODO add test case for these 3 operand cases (madd # needs to be implemented) -- 2.30.2