# then check sign-extend
with m.If(oper_r.sign_extend):
- comb += ldd_o.eq(exts(revnorev, 32, 64)) # sign-extend
+ # okok really should "if data_len == 4" and so on here
+ with m.If(oper_r.data_len == 2):
+ comb += ldd_o.eq(exts(revnorev, 16, 64)) # sign-extend hword
+ with m.Else():
+ comb += ldd_o.eq(exts(revnorev, 32, 64)) # sign-extend dword
with m.Else():
comb += ldd_o.eq(revnorev)
self.add_case(Program(lst, bigendian), initial_regs,
initial_mem=initial_mem)
+ def case_10_load_algebraic_1(self):
+ lst = ["lhax 3, 4, 2"]
+ initial_regs = [0] * 32
+ initial_regs[1] = 0x5678
+ initial_regs[2] = 0x001c
+ initial_regs[4] = 0x0008
+ initial_mem = {0x0000: (0x5432123412345678, 8),
+ 0x0008: (0xabcdef0187654321, 8),
+ 0x0020: (0x0000f00f0000ffff, 8),
+ }
+ self.add_case(Program(lst, bigendian), initial_regs,
+ initial_mem=initial_mem)
+
+ def case_10_load_algebraic_2(self):
+ lst = ["lhax 3, 4, 2"]
+ initial_regs = [0] * 32
+ initial_regs[1] = 0x5678
+ initial_regs[2] = 0x001c
+ initial_regs[4] = 0x0008
+ initial_mem = {0x0000: (0x5432123412345678, 8),
+ 0x0008: (0xabcdef0187654321, 8),
+ 0x0020: (0x0000700f0000ffff, 8),
+ }
+ self.add_case(Program(lst, bigendian), initial_regs,
+ initial_mem=initial_mem)
+