tc = TestCase(prog, self.test_name, initial_regs, initial_sprs)
self.test_data.append(tc)
- def test_mullw(self):
+ def test_0_mullw(self):
lst = [f"mullw 3, 1, 2"]
initial_regs = [0] * 32
#initial_regs[1] = 0xffffffffffffffff
initial_regs[2] = 0x2
self.run_tst_program(Program(lst), initial_regs)
+ def tst_1_mullwo_(self):
+ lst = [f"mullwo. 3, 1, 2"]
+ initial_regs = [0] * 32
+ initial_regs[1] = 0x3b34b06f
+ initial_regs[2] = 0xfdeba998
+ self.run_tst_program(Program(lst), initial_regs)
+
+ def tst_2_mullwo_(self):
+ lst = [f"mullwo. 3, 1, 2"]
+ initial_regs = [0] * 32
+ initial_regs[1] = 0xffffffffffffa988 # -5678
+ initial_regs[2] = 0xffffffffffffedcc # -1234
+ self.run_tst_program(Program(lst), initial_regs)
+
+ def test_3_mullw(self):
+ for i in range(40):
+ lst = ["mullw 3, 1, 2"]
+ initial_regs = [0] * 32
+ initial_regs[1] = random.randint(0, (1<<64)-1)
+ initial_regs[2] = random.randint(0, (1<<64)-1)
+ self.run_tst_program(Program(lst), initial_regs)
+
def tst_rand_mullw(self):
insns = ["mullw", "mullw.", "mullwo", "mullwo."]
for i in range(40):
super().__init__(name)
self.test_name = name
- def test_mullw(self):
- lst = [f"addi 1, 0, 0x5678",
- f"addi 2, 0, 0x1234",
- f"mullw 3, 1, 2"]
+ def tst_mullw(self):
+ lst = ["addi 1, 0, 0x5678",
+ "addi 2, 0, 0x1234",
+ "mullw 3, 1, 2"]
self.run_tst_program(Program(lst), [3])
- def test_mullw(self):
- lst = [f"addi 1, 0, 0x5678",
- "neg 1, 1",
- f"addi 2, 0, 0x1234",
- f"mullw 3, 1, 2"]
+ def test_mullwo_(self):
+ lst = ["addi 1, 0, 0x5678",
+ "neg 1, 1",
+ "addi 2, 0, 0x1234",
+ "neg 2, 2",
+ "mullwo 3, 1, 2"]
self.run_tst_program(Program(lst), [3])
def run_tst_program(self, prog, initial_regs=None, initial_sprs=None,
print("sim pc", hex(sim.pc.CIA.value))
print("sim cr", hex(sim_cr))
print("sim xer", hex(sim_xer))
- self.assertEqual(qcr, sim_cr)
self.assertEqual(qpc, sim_pc)
for reg in regs:
qemu_val = qemu.get_register(reg)
sim_val = sim.gpr(reg).value
self.assertEqual(qemu_val, sim_val,
"expect %x got %x" % (qemu_val, sim_val))
+ self.assertEqual(qcr, sim_cr)
class DecoderTestCase(DecoderBase, GeneralTestCases):