diff options
Diffstat (limited to 'rvcontroller.lua')
| -rw-r--r-- | rvcontroller.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/rvcontroller.lua b/rvcontroller.lua index 57f458c..18fa788 100644 --- a/rvcontroller.lua +++ b/rvcontroller.lua @@ -653,8 +653,8 @@ local operations = { if rd == 0 or rd == 31 then return end if imm >= 2^11 then imm = imm - 2^12 end local address = getreg(rs1)+imm - setreg(rd,readram(address,4)) - setreg(rd+1,readram(address+4,4)) + setreg(rd,readram(address+(mem.bigendian and 4 or 0),4)) + setreg(rd+1,readram(address+(mem.bigendian and 0 or 4),4)) end, lhu = function(rd,rs1,imm) if imm >= 2^11 then imm = imm - 2^12 end @@ -682,8 +682,8 @@ local operations = { if rs2 == 31 then return end if imm >= 2^11 then imm = imm - 2^12 end local address = getreg(rs1)+imm - writeram(address,getreg(rs2),4) - writeram(address+4,getreg(rs2+1),4) + writeram(address+(mem.bigendian and 4 or 0),getreg(rs2),4) + writeram(address+(mem.bigendian and 0 or 4),getreg(rs2+1),4) end, ecall = function() local func = getreg(17) |
