Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CSR Register

Phase 1C: Debug CSRs (dcsr, dpc)


Spec Feature (Chapter)Vexriscv Debug ImplementationImplementation Details
Ch 4: Core Debug (hart-side CSRs)
Halt/ResumeDebugHartBus + CsrPluginCsrPlugin.scala (line 702+): running flag, DebugHartBus wiring, halt/resume handshake
Single-step✅ ImplementedCsrPlugin.scala (lines 807-845): dcsr.step with full FSM (IDLE→SINGLE→WAIT), timeout/redo handling
dcsr (0x7B0)✅ ImplementedCsrPlugin.scala (lines 792-851): prv, step, nmip, mprven, cause, stoptime, stopcount, stepie, ebreakm/s/u, xdebugver=4
dpc (0x7B1)✅ ImplementedCsrPlugin.scala (line 791): Reg(UInt(32 bits)), read/write via rw(CSR.DPC, dpc)
dscratch0 (0x7B2)❌ Not implemented
dscratch1 (0x7B3)❌ Not implemented
Debug mode entry✅ ImplementedCsrPlugin.scala (lines 1426-1443): saves PC→dpc, sets dcsr.cause (1=ebreak, 3=haltreq, 4=step), saves privilege→dcsr.prv, enters M-mode
Debug mode exit (resume)✅ ImplementedCsrPlugin.scala (lines 1488-1498): jumps to dpc, restores privilege from dcsr.prv, via DebugHartBus.resume
Halt cause reporting✅ Implementeddcsr.cause: 1 (ebreak), 2 (trigger), 3 (haltreq), 4 (step)
dcsr.ebreakm/s/u✅ ImplementedCsrPlugin.scala (lines 1372-1377): per-privilege ebreak→debug detection
dcsr.stoptime✅ ImplementedCsrPlugin.scala (line 866): stoptime output gated by debugMode
dcsr.stopcount✅ ImplementedCsrPlugin.scala (line 1176): mcycle increment gated by !debugMode || !stopcount
dcsr.stepie✅ ImplementedCsrPlugin.scala (line 1315): interrupts cleared when step && !stepie
Interrupt inhibition in debug✅ ImplementedCsrPlugin.scala (line 721): inhibateInterrupts() when debugMode
CSR access protection (0x7Bx)✅ ImplementedCsrPlugin.scala (line 1718): blocks non-debug access to 0x7B0-0x7BF
DebugHartBus wiring✅ ImplementedCsrPlugin.scala (lines 704-789): instruction injection, data CSR, all hartToDm/dmToHart signals
Reset controldmcontrol.ndmresetio.ndmresetBoth implementations provide ndmreset