print("mem @ 0x{:x}: 0x{:x}".format(addr, self.mem[addr]))
def __call__(self, addr, sz):
- val = self.ld(addr.value, sz)
+ val = self.ld(addr.value, sz, swap=False)
print("memread", addr, sz, val)
return SelectableInt(val, sz*8)
def memassign(self, addr, sz, val):
print("memassign", addr, sz, val)
- self.st(addr.value, val.value, sz)
+ self.st(addr.value, val.value, sz, swap=False)
class GPR(dict):
comb += addr_ok.eq(self.pi.addr_ok_o) # no exc, address fine
# byte-reverse on LD - yes this is inverted
- with m.If(self.oper_i.byte_reverse):
+ with m.If(~self.oper_i.byte_reverse):
comb += ldd_o.eq(pi.ld.data) # put data out, straight (as BE)
with m.Else():
# byte-reverse the data based on ld/st width (turn it to LE)
comb += ld_ok.eq(pi.ld.ok) # ld.ok *closes* (freezes) ld data
# yes this also looks odd (inverted)
- with m.If(self.oper_i.byte_reverse):
+ with m.If(~self.oper_i.byte_reverse):
comb += pi.st.data.eq(srl[2]) # 3rd operand latch
with m.Else():
# byte-reverse the data based on width
with Program(lst, bigendian) as program:
self.run_tst_program(program, [1, 2, 3, 4])
- @unittest.skip("disable")
+ #@unittest.skip("disable")
def test_ldst(self):
lst = ["addi 1, 0, 0x5678",
"addi 2, 0, 0x1234",
[1, 2, 3],
initial_mem)
+ #@unittest.skip("disable")
+ def test_ldst_update(self):
+ lst = ["addi 1, 0, 0x5678",
+ "addi 2, 0, 0x1234",
+ "stwu 1, 0(2)",
+ "lwz 3, 0(2)"
+ ]
+ initial_mem = {0x1230: (0x5432123412345678, 8),
+ 0x1238: (0xabcdef0187654321, 8),
+ }
+ with Program(lst, bigendian) as program:
+ self.run_tst_program(program,
+ [1, 2, 3],
+ initial_mem)
+
@unittest.skip("disable")
def test_ld_rev_ext(self):
lst = ["addi 1, 0, 0x5678",
with Program(lst, bigendian) as program:
self.run_tst_program(program, [1, 2, 3])
- @unittest.skip("disable")
+ #@unittest.skip("disable")
def test_ldst_extended(self):
lst = ["addi 1, 0, 0x5678",
"addi 2, 0, 0x1234",
program.assembly = '\n'.join(disassembly) + '\n' # XXX HACK!
self.run_tst_program(program, [1, 3])
+ @unittest.skip("disable")
def test_loop(self):
"""in godbolt.org:
register unsigned long i asm ("r12");
with Program(lst, bigendian) as program:
self.run_tst_program(program, [9], initial_mem={})
+ @unittest.skip("disable")
def test_30_addis(self):
lst = [ # "addi 0, 0, 5",
"addis 12, 0, 0",