summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <cheapiephp@gmail.com>2026-11-12 17:55:10 -0600
committercheapie <cheapiephp@gmail.com>2026-11-12 17:55:10 -0600
commitd9642b3b31bd15d460a179f620a75f6b1248be81 (patch)
tree33876ddfa89528ed9e0b3357c3bb4e94495d81cd
parent48f1ecd573e839a945c5920a74a7adb0b8577aaf (diff)
downloadrvcontroller-d9642b3b31bd15d460a179f620a75f6b1248be81.tar
rvcontroller-d9642b3b31bd15d460a179f620a75f6b1248be81.tar.gz
rvcontroller-d9642b3b31bd15d460a179f620a75f6b1248be81.tar.bz2
rvcontroller-d9642b3b31bd15d460a179f620a75f6b1248be81.tar.xz
rvcontroller-d9642b3b31bd15d460a179f620a75f6b1248be81.zip
Fix sd instruction with rs2=x0
-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)