Fix RISC-V debug hardware breakpoints
This commit is contained in:
parent
fe68b8494e
commit
5e17ab62d6
|
@ -103,6 +103,11 @@ case class VexRiscvBmbGenerator()(implicit interconnectSmp: BmbInterconnectGener
|
||||||
case _ => config.add(new DebugPlugin(debugClockDomain, hardwareBreakpointCount))
|
case _ => config.add(new DebugPlugin(debugClockDomain, hardwareBreakpointCount))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (e <- config.plugins) e match {
|
||||||
|
case e: CsrPlugin => e.config.debugTriggers = hardwareBreakpointCount
|
||||||
|
case _ =>
|
||||||
|
}
|
||||||
|
|
||||||
val cpu = new VexRiscv(config)
|
val cpu = new VexRiscv(config)
|
||||||
def doExport(value : => Any, postfix : String) = {
|
def doExport(value : => Any, postfix : String) = {
|
||||||
sexport(Handle(value).setCompositeName(VexRiscvBmbGenerator.this, postfix))
|
sexport(Handle(value).setCompositeName(VexRiscvBmbGenerator.this, postfix))
|
||||||
|
|
|
@ -82,7 +82,7 @@ case class CsrPluginConfig(
|
||||||
deterministicInteruptionEntry : Boolean = false, //Only used for simulatation purposes
|
deterministicInteruptionEntry : Boolean = false, //Only used for simulatation purposes
|
||||||
wfiOutput : Boolean = false,
|
wfiOutput : Boolean = false,
|
||||||
withPrivilegedDebug : Boolean = false, //For the official RISC-V debug spec implementation
|
withPrivilegedDebug : Boolean = false, //For the official RISC-V debug spec implementation
|
||||||
debugTriggers : Int = 2
|
var debugTriggers : Int = 2
|
||||||
){
|
){
|
||||||
assert(!ucycleAccess.canWrite)
|
assert(!ucycleAccess.canWrite)
|
||||||
def privilegeGen = userGen || supervisorGen || withPrivilegedDebug
|
def privilegeGen = userGen || supervisorGen || withPrivilegedDebug
|
||||||
|
@ -711,7 +711,7 @@ class CsrPlugin(val config: CsrPluginConfig) extends Plugin[VexRiscv] with Excep
|
||||||
|
|
||||||
// Pipeline execution timeout used to trigger some redo
|
// Pipeline execution timeout used to trigger some redo
|
||||||
val timeout = Timeout(7)
|
val timeout = Timeout(7)
|
||||||
when(pipeline.stages.map(_.arbitration.isValid).orR){
|
when(pipeline.stages.tail.map(_.arbitration.isValid).orR){
|
||||||
timeout.clear()
|
timeout.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,6 +770,7 @@ class CsrPlugin(val config: CsrPluginConfig) extends Plugin[VexRiscv] with Excep
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SINGLE whenIsActive{
|
SINGLE whenIsActive{
|
||||||
|
timeout.clear()
|
||||||
when(trapEvent){
|
when(trapEvent){
|
||||||
doHalt := True
|
doHalt := True
|
||||||
goto(WAIT)
|
goto(WAIT)
|
||||||
|
@ -783,7 +784,6 @@ class CsrPlugin(val config: CsrPluginConfig) extends Plugin[VexRiscv] with Excep
|
||||||
decode.arbitration.haltByOther setWhen(decode.arbitration.isValid)
|
decode.arbitration.haltByOther setWhen(decode.arbitration.isValid)
|
||||||
//re resume the execution in case of timeout (ex cache miss)
|
//re resume the execution in case of timeout (ex cache miss)
|
||||||
when(!doHalt && timeout.state){
|
when(!doHalt && timeout.state){
|
||||||
forceResume := True
|
|
||||||
goto(SINGLE)
|
goto(SINGLE)
|
||||||
} otherwise {
|
} otherwise {
|
||||||
when(stages.last.arbitration.isFiring) {
|
when(stages.last.arbitration.isFiring) {
|
||||||
|
@ -839,7 +839,9 @@ class CsrPlugin(val config: CsrPluginConfig) extends Plugin[VexRiscv] with Excep
|
||||||
when(enabled) {
|
when(enabled) {
|
||||||
decode.arbitration.haltByOther := True
|
decode.arbitration.haltByOther := True
|
||||||
when(timeout.state) {
|
when(timeout.state) {
|
||||||
decode.arbitration.flushIt := True
|
trapEvent := True
|
||||||
|
decode.arbitration.flushNext := True
|
||||||
|
decode.arbitration.removeIt := True
|
||||||
dpc := decode.input(PC)
|
dpc := decode.input(PC)
|
||||||
running := False
|
running := False
|
||||||
dcsr.cause := 2
|
dcsr.cause := 2
|
||||||
|
@ -906,6 +908,8 @@ class CsrPlugin(val config: CsrPluginConfig) extends Plugin[VexRiscv] with Excep
|
||||||
}
|
}
|
||||||
|
|
||||||
r(CSR.TDATA1, 0 -> slots.map(_.tdata1.read).read(tselect.index))
|
r(CSR.TDATA1, 0 -> slots.map(_.tdata1.read).read(tselect.index))
|
||||||
|
|
||||||
|
decodeBreak.enabled clearWhen(!decode.arbitration.isValid)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1616,6 +1620,11 @@ class CsrPlugin(val config: CsrPluginConfig) extends Plugin[VexRiscv] with Excep
|
||||||
illegalAccess clearWhen(!arbitration.isValid || !input(IS_CSR))
|
illegalAccess clearWhen(!arbitration.isValid || !input(IS_CSR))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Component.toplevel.rework{
|
||||||
|
// out(CombInit(debug.running.pull())).setName("debug0")
|
||||||
|
// out(CombInit(pipeline.decode.arbitration.isFiring.pull())).setName("debug1")
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue