isa/caller: initialize helper and redirect XLEN
[openpower-isa.git] / src / openpower / test / div / long_div_cases.py
1 from openpower.simulator.program import Program
2 from openpower.endian import bigendian
3
4 from openpower.test.common import TestAccumulatorBase
5
6
7 class DivTestLong(TestAccumulatorBase):
8 def case_all(self):
9 instrs = []
10 for width in ("w", "d"):
11 for sign in ("", "u"):
12 for ov in ("", "o"):
13 for cnd in ("", "."):
14 instrs += ["div" + width + sign + ov + cnd,
15 "div" + width + "e" + sign + ov + cnd]
16 for sign in ("s", "u"):
17 instrs += ["mod" + sign + width]
18 test_values = [
19 0x0,
20 0x1,
21 0x2,
22 0xFFFF_FFFF_FFFF_FFFF,
23 0xFFFF_FFFF_FFFF_FFFE,
24 0x7FFF_FFFF_FFFF_FFFF,
25 0x8000_0000_0000_0000,
26 0x1234_5678_0000_0000,
27 0x1234_5678_8000_0000,
28 0x1234_5678_FFFF_FFFF,
29 0x1234_5678_7FFF_FFFF,
30 ]
31 for instr in instrs:
32 l = [f"{instr} 3, 1, 2"]
33 for ra in test_values:
34 for rb in test_values:
35 initial_regs = [0] * 32
36 initial_regs[1] = ra
37 initial_regs[2] = rb
38 # use "with" so as to close the files used
39 with Program(l, bigendian) as prog:
40 self.add_case(prog, initial_regs)
41