diff --git a/src/main/scala/vexriscv/plugin/BranchPlugin.scala b/src/main/scala/vexriscv/plugin/BranchPlugin.scala index eb4c8d0..24d42fa 100644 --- a/src/main/scala/vexriscv/plugin/BranchPlugin.scala +++ b/src/main/scala/vexriscv/plugin/BranchPlugin.scala @@ -46,6 +46,7 @@ case class FetchPredictionBus(stage : Stage) extends Bundle { trait PredictionInterface{ def askFetchPrediction() : FetchPredictionBus def askDecodePrediction() : DecodePredictionBus + def inDebugNoFetch() : Unit } @@ -68,6 +69,7 @@ class BranchPlugin(earlyBranch : Boolean, var jumpInterface : Flow[UInt] = null var predictionExceptionPort : Flow[ExceptionCause] = null var branchExceptionPort : Flow[ExceptionCause] = null + var inDebugNoFetchFlag : Bool = null var decodePrediction : DecodePredictionBus = null @@ -84,6 +86,9 @@ class BranchPlugin(earlyBranch : Boolean, decodePrediction } + + override def inDebugNoFetch(): Unit = inDebugNoFetchFlag := True + def hasHazardOnBranch = if(earlyBranch) pipeline.service(classOf[HazardService]).hazardOnExecuteRS else False override def setup(pipeline: VexRiscv): Unit = { @@ -147,6 +152,7 @@ class BranchPlugin(earlyBranch : Boolean, val exceptionService = pipeline.service(classOf[ExceptionService]) branchExceptionPort = exceptionService.newExceptionPort(branchStage) } + inDebugNoFetchFlag = False.setCompositeName(this, "inDebugNoFetchFlag") } override def build(pipeline: VexRiscv): Unit = { @@ -353,6 +359,7 @@ class BranchPlugin(earlyBranch : Boolean, import branchStage._ val predictionMissmatch = fetchPrediction.cmd.hadBranch =/= input(BRANCH_DO) || (input(BRANCH_DO) && input(TARGET_MISSMATCH)) + when(inDebugNoFetchFlag) { predictionMissmatch := input(BRANCH_DO)} fetchPrediction.rsp.wasRight := ! predictionMissmatch fetchPrediction.rsp.finalPc := input(BRANCH_CALC) fetchPrediction.rsp.sourceLastWord := { diff --git a/src/main/scala/vexriscv/plugin/DebugPlugin.scala b/src/main/scala/vexriscv/plugin/DebugPlugin.scala index a0b4619..01c2acd 100644 --- a/src/main/scala/vexriscv/plugin/DebugPlugin.scala +++ b/src/main/scala/vexriscv/plugin/DebugPlugin.scala @@ -342,6 +342,10 @@ class DebugPlugin(var debugClockDomain : ClockDomain, hardwareBreakpointCount : case p : PrivilegeService => p.forceMachine() case _ => } + pipeline.plugins.foreach{ + case p : PredictionInterface => p.inDebugNoFetch() + case _ => + } if(pipeline.things.contains(DEBUG_BYPASS_CACHE)) pipeline(DEBUG_BYPASS_CACHE) := True } when(allowEBreak) {