From 7cbe399f1f710a7f3291c1a911257c66ec4f4b48 Mon Sep 17 00:00:00 2001 From: Dolu1990 Date: Wed, 20 Mar 2019 23:25:52 +0100 Subject: [PATCH] Fix some supervisor CSR access --- src/main/scala/vexriscv/plugin/CsrPlugin.scala | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/scala/vexriscv/plugin/CsrPlugin.scala b/src/main/scala/vexriscv/plugin/CsrPlugin.scala index ac60675..baa6b75 100644 --- a/src/main/scala/vexriscv/plugin/CsrPlugin.scala +++ b/src/main/scala/vexriscv/plugin/CsrPlugin.scala @@ -525,13 +525,14 @@ class CsrPlugin(config: CsrPluginConfig) extends Plugin[VexRiscv] with Exception } //Supervisor CSR - WRITE_ONLY(CSR.SSTATUS,8 -> sstatus.SPP, 5 -> sstatus.SPIE, 1 -> sstatus.SIE) - for(offset <- List(0, 0x200)) { - READ_ONLY(CSR.SSTATUS + offset,8 -> sstatus.SPP, 5 -> sstatus.SPIE, 1 -> sstatus.SIE) + for(offset <- List(CSR.MSTATUS, CSR.SSTATUS)) READ_WRITE(offset,8 -> sstatus.SPP, 5 -> sstatus.SPIE, 1 -> sstatus.SIE) + for(offset <- List(CSR.MIP, CSR.SIP)) { + READ_ONLY(offset, 9 -> sip.SEIP, 5 -> sip.STIP) + READ_WRITE(offset, 1 -> sip.SSIP) } - READ_ONLY(CSR.SIP, 9 -> sip.SEIP, 5 -> sip.STIP) - READ_WRITE(CSR.SIP, 1 -> sip.SSIP) - READ_WRITE(CSR.SIE, 9 -> sie.SEIE, 5 -> sie.STIE, 1 -> sie.SSIE) + + for(offset <- List(CSR.MIE, CSR.SIE)) READ_WRITE(offset, 9 -> sie.SEIE, 5 -> sie.STIE, 1 -> sie.SSIE) + stvecAccess(CSR.STVEC, 2 -> stvec.base, 0 -> stvec.mode) sepcAccess(CSR.SEPC, sepc)