initial_regs = [0] * 32
initial_regs[1] = 0xc523e996a8ff6215
initial_regs[2] = 0xe1e5b9cc9864c4a8
- self.add_case(Program(lst, bigendian), initial_regs)
+ e = ExpectedState(pc=4)
+ e.intregs[1] = 0xc523e996a8ff6215
+ e.intregs[2] = 0xe1e5b9cc9864c4a8
+ e.intregs[3] = 0xa709a363416426bd
+ # XXX unexpected value, investigating
+ # e.crregs[0] = 0x8
+ e.crregs[0] = 0x0
+ self.add_case(Program(lst, bigendian), initial_regs, expected=e)
lst = [f"add 3, 1, 2"]
initial_regs = [0] * 32
initial_regs[1] = 0x2e08ae202742baf8
e.intregs[3] = 0xb4cceceec64116a2
self.add_case(Program(lst, bigendian), initial_regs, expected=e)
- def case_rand(self):
+ def cse_rand(self):
insns = ["add", "add.", "subf"]
for i in range(40):
choice = random.choice(insns)
initial_regs[2] = random.randint(0, (1 << 64)-1)
self.add_case(Program(lst, bigendian), initial_regs)
- def case_addme_ca_0(self):
+ def cse_addme_ca_0(self):
insns = ["addme", "addme.", "addmeo", "addmeo."]
for choice in insns:
lst = [f"{choice} 6, 16"]
self.add_case(Program(lst, bigendian),
initial_regs, initial_sprs)
- def case_addme_ca_1(self):
+ def cse_addme_ca_1(self):
insns = ["addme", "addme.", "addmeo", "addmeo."]
for choice in insns:
lst = [f"{choice} 6, 16"]
self.add_case(Program(lst, bigendian),
initial_regs, initial_sprs)
- def case_addme_ca_so_3(self):
+ def cse_addme_ca_so_3(self):
"""bug where SO does not get passed through to CR0
"""
lst = ["addme. 6, 16"]
self.add_case(Program(lst, bigendian),
initial_regs, initial_sprs)
- def case_addze(self):
+ def cse_addze(self):
insns = ["addze", "addze.", "addzeo", "addzeo."]
for choice in insns:
lst = [f"{choice} 6, 16"]
else:
self.add_case(Program(lst, bigendian), initial_regs)
- def case_addis_nonzero_r0_regression(self):
+ def cse_addis_nonzero_r0_regression(self):
lst = [f"addis 3, 0, 1"]
print(lst)
initial_regs = [0] * 32
e.intregs[3] = 0x10000
self.add_case(Program(lst, bigendian), initial_regs, expected=e)
- def case_addis_nonzero_r0(self):
+ def cse_addis_nonzero_r0(self):
for i in range(10):
imm = random.randint(-(1 << 15), (1 << 15)-1)
lst = [f"addis 3, 0, {imm}"]
initial_regs[0] = random.randint(0, (1 << 64)-1)
self.add_case(Program(lst, bigendian), initial_regs)
- def case_rand_imm(self):
+ def cse_rand_imm(self):
insns = ["addi", "addis", "subfic"]
for i in range(10):
choice = random.choice(insns)
initial_regs[1] = random.randint(0, (1 << 64)-1)
self.add_case(Program(lst, bigendian), initial_regs)
- def case_0_adde(self):
+ def cse_0_adde(self):
lst = ["adde. 5, 6, 7"]
for i in range(10):
initial_regs = [0] * 32
self.add_case(Program(lst, bigendian),
initial_regs, initial_sprs)
- def case_cmp(self):
+ def cse_cmp(self):
lst = ["subf. 1, 6, 7",
"cmp cr2, 1, 6, 7"]
initial_regs = [0] * 32
initial_regs[7] = 0x05
self.add_case(Program(lst, bigendian), initial_regs, {})
- def case_cmp2(self):
+ def cse_cmp2(self):
lst = ["cmp cr2, 0, 2, 3"]
initial_regs = [0] * 32
initial_regs[2] = 0xffffffffaaaaaaaa
initial_regs[5] = 0xffffffffaaaaaaaa
self.add_case(Program(lst, bigendian), initial_regs, {})
- def case_cmp3(self):
+ def cse_cmp3(self):
lst = ["cmp cr2, 1, 2, 3"]
initial_regs = [0] * 32
initial_regs[2] = 0xffffffffaaaaaaaa
initial_regs[5] = 0xffffffffaaaaaaaa
self.add_case(Program(lst, bigendian), initial_regs, {})
- def case_cmpl_microwatt_0(self):
+ def cse_cmpl_microwatt_0(self):
"""microwatt 1.bin:
115b8: 40 50 d1 7c .long 0x7cd15040 # cmpl 6, 0, 17, 10
register_file.vhdl: Reading GPR 11 000000000001C026
initial_sprs = {'XER': XER},
initial_cr = CR)
- def case_cmpl_microwatt_0_disasm(self):
+ def cse_cmpl_microwatt_0_disasm(self):
"""microwatt 1.bin: disassembled version
115b8: 40 50 d1 7c .long 0x7cd15040 # cmpl 6, 0, 17, 10
register_file.vhdl: Reading GPR 11 000000000001C026
initial_sprs = {'XER': XER},
initial_cr = CR)
- def case_cmplw_microwatt_1(self):
+ def cse_cmplw_microwatt_1(self):
"""microwatt 1.bin:
10d94: 40 20 96 7c cmplw cr1,r22,r4
gpr: 00000000ffff6dc1 <- r4
initial_sprs = {'XER': XER},
initial_cr = CR)
- def case_cmpli_microwatt(self):
+ def cse_cmpli_microwatt(self):
"""microwatt 1.bin: cmpli
123ac: 9c 79 8d 2a cmpli cr5,0,r13,31132
gpr: 00000000301fc7a7 <- r13
initial_sprs = {'XER': XER},
initial_cr = CR)
- def case_extsb(self):
+ def cse_extsb(self):
insns = ["extsb", "extsh", "extsw"]
for i in range(10):
choice = random.choice(insns)
initial_regs[1] = random.randint(0, (1 << 64)-1)
self.add_case(Program(lst, bigendian), initial_regs)
- def case_cmpeqb(self):
+ def cse_cmpeqb(self):
lst = ["cmpeqb cr1, 1, 2"]
for i in range(20):
initial_regs = [0] * 32