From 41a6282fb32a3a7dbeca64191ddd804585bca5f4 Mon Sep 17 00:00:00 2001 From: cheapie Date: Mon, 22 Jun 2026 17:23:11 -0500 Subject: Make custom extensions mutable --- rvcontroller.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'rvcontroller.lua') diff --git a/rvcontroller.lua b/rvcontroller.lua index 6130659..56b800b 100644 --- a/rvcontroller.lua +++ b/rvcontroller.lua @@ -655,7 +655,8 @@ local function writecsr(address,data) mem.isa.c = bits[2] mem.isa.i = bits[8] mem.isa.m = bits[12] - local newbits = {[0] = mem.isa.a,mem.isa.b,mem.isa.c,[4] = not mem.isa.i,[8] = mem.isa.i,[12] = mem.isa.m,[30] = true} + mem.isa.x = bits[23] + local newbits = {[0] = mem.isa.a,mem.isa.b,mem.isa.c,[4] = not mem.isa.i,[8] = mem.isa.i,[12] = mem.isa.m,[23] = mem.isa.x,[30] = true} mem.csr[0x301] = implodebits(newbits,32) return elseif address == 0x801 then @@ -2418,7 +2419,7 @@ local function runinst(instruction) --pause return false,true end - elseif opcode == 0x0b then + elseif opcode == 0x0b and mem.isa.x then --Custom0 instruction (currently all R-type) local f3 = implodebits({[0] = bits[12],bits[13],bits[14]},3) local xh3bextmsize = implodebits({[0] = bits[26],bits[27],bits[28]},3)+1 @@ -2893,7 +2894,7 @@ if event.type == "program" or event.iid == "reset" then [0xf13] = 0x6f435652, --mimpid ("RVCo") [0xf14] = 0, --mhartid [0x300] = 0, --mstatus - [0x301] = 0x40001107, --misa (RV32IMACB) + [0x301] = 0x40801107, --misa (RV32IMACBX) [0x304] = 0, --mie [0x305] = 0, --mtvec [0x340] = 0, --mscratch @@ -2927,6 +2928,7 @@ if event.type == "program" or event.iid == "reset" then c = true, i = true, m = true, + x = true, } mem.meseconsdir = {} mem.meseconsdata = {} -- cgit v1.2.3