diff --git a/src/main/scala/vexriscv/plugin/CsrPlugin.scala b/src/main/scala/vexriscv/plugin/CsrPlugin.scala index b6e7787..7116e76 100644 --- a/src/main/scala/vexriscv/plugin/CsrPlugin.scala +++ b/src/main/scala/vexriscv/plugin/CsrPlugin.scala @@ -767,6 +767,9 @@ class CsrPlugin(config: CsrPluginConfig) extends Plugin[VexRiscv] with Exception } when(hadException || interruptJump){ + //Avoid having the fetch confused by the incomming privilege switch + fetcher.haltIt() + jumpInterface.valid := True jumpInterface.payload := (if(!xtvecModeGen) xtvec.base @@ "00" else (xtvec.mode === 0 || hadException) ? (xtvec.base @@ "00") | ((xtvec.base + trapCause) @@ "00") ) beforeLastStage.arbitration.flushAll := True @@ -800,11 +803,6 @@ class CsrPlugin(config: CsrPluginConfig) extends Plugin[VexRiscv] with Exception } } - //Avoid having the fetch confused by the incomming privilege switch - when(hadException){ - fetcher.haltIt() - } - lastStage plug new Area{ import lastStage._