comb += is_cmp.eq(op.insn_type == InternalOp.OP_CMP)
comb += is_cmpeqb.eq(op.insn_type == InternalOp.OP_CMPEQB)
- comb += msb_test.eq(target[-1] ^ is_cmp)
+ with m.If(op.is_32bit):
+ comb += msb_test.eq(target[-1] ^ is_cmp) # 64-bit MSB
+ with m.Else():
+ comb += msb_test.eq(target[31] ^ is_cmp) # 32-bit MSB
comb += is_nzero.eq(target.bool())
comb += is_positive.eq(is_nzero & ~msb_test)
comb += is_negative.eq(is_nzero & msb_test)
initial_regs[5] = 0x6b8aee2ccf7d62e9
self.run_tst_program(Program(lst), initial_regs)
+ def test_6_regression(self):
+ # CR0 not getting set properly for this one
+ lst = ["divw. 3, 1, 2"]
+ initial_regs = [0] * 32
+ initial_regs[1] = 0x61c1cc3b80f2a6af
+ initial_regs[2] = 0x9dc66a7622c32bc0
+ self.run_tst_program(Program(lst), initial_regs)
+
def test_rand_divw(self):
insns = ["divw", "divw.", "divwo", "divwo."]
for i in range(40):