summaryrefslogtreecommitdiff
path: root/rvcontroller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'rvcontroller.lua')
-rw-r--r--rvcontroller.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/rvcontroller.lua b/rvcontroller.lua
index aad6e99..942504c 100644
--- a/rvcontroller.lua
+++ b/rvcontroller.lua
@@ -1274,7 +1274,7 @@ local operations = {
if imm >= 2^11 then imm = imm - 2^12 end
local address = getreg(rs1)+imm
writeram(address+(mem.mbe and 4 or 0),getreg(rs2),4)
- writeram(address+(mem.mbe and 0 or 4),getreg(rs2+1),4)
+ writeram(address+(mem.mbe and 0 or 4),getreg((rs2 == 0) and rs2 or rs2+1),4)
end,
ecall = function()
local func = mem.isa.i and getreg(17) or getreg(15)