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

Standard Debug Spec Milestone

Below are milestones planned for Standard Debug specification implementation in Vexriscv:

Debug Transport Module

Phase 1A: JTAG DTM


Spec Feature Coverage Summary

Spec Feature (Chapter)Vexriscv Debug ImplementationImplementation Details
Ch 6: Debug Transport Module (DTM)
JTAG TAP with IDCODE/dtmcs/dmi✅ ImplementedDebugTransportModuleJtag.scala — standard IR codes, dtmcs with version/abits/idle/dmistat, dmi with op/address/data
DMI bus protocol✅ ImplementedDebugInterfaces.scalaDebugBus with DebugCmd/DebugRsp, DebugBusSlaveFactory
DMI busy/error handling✅ Implementeddmihardreset, dmireset, pending/overrun detection
Cross-clock-domain DMI✅ ImplementedccToggle for JTAG↔debug clock domains
JTAG tunnel support✅ ImplementedJtagTunnel.scala — tunneling through outer TAP

Debug Module

Phase 1B: Core DM Registers


Spec Feature (Chapter)Vexriscv Debug ImplementationImplementation Details
Ch 3: Debug Module (DM)
dmcontrol (0x10)✅ Implementeddmactive, ndmreset, haltreq, resumereq, ackhavereset, hartsello/hi. Missing: hasel, setresethaltreq, hartreset, keepalive
dmstatus (0x11)✅ Implementedversion, authenticated=1, all halted/running/unavail/nonexistent/resumeack/havereset flags, impebreak=1
hartinfo (0x12)✅ Implementeddataaddr=0, datasize=0, dataaccess=0, nscratch=0
abstractcs (0x16)✅ Implementeddatacount, progbufsize, busy, cmderr (all 7 error codes)
command (0x17) — Access Register✅ Implementedcmdtype=0 with full FSM: transfer, write, postexec, aarsize validation, GPR+FPU register access
command (0x17) — Access Memory❌ Not implementedReturns NOT_SUPPORTED
command (0x17) — Quick Access❌ Not implementedReturns NOT_SUPPORTED
abstractauto (0x18)✅ Implementedautoexecdata and autoexecProgbuf for burst access
progbuf0-N (0x20+)✅ ImplementedParameterized progbuf memory, multi-word execution with counter, redo support
data0-N (0x04+)✅ ImplementedMemory-backed, hart writes via fromHarts, host reads async
sbcs (0x38) — System Bus Access✅ Implemented (optional)sbversion=1, sbaccess, sbbusyerror, sbbusy, sbreadonaddr, sbautoincrement, sbreadondata, sberror, 32-bit only
sbaddress0 (0x39)✅ ImplementedRead/write with auto-increment
sbdata0 (0x3c)✅ ImplementedRead/write with bus triggers
sbaddress1-3 / sbdata1-3❌ Not implemented32-bit address/data only
sbcs 8/16/64/128-bit access❌ Not implementedOnly sbaccess32 supported
haltsum0 (0x40)✅ ImplementedPer-hart halted bits, up to 32 harts
haltsum1-3❌ Not implementedOnly haltsum0 exists
authdata (0x30)❌ Not implementedAlways authenticated
confstrptr0-3❌ Not implemented
nextdm (0x1d)❌ Not implemented
dmcs2 (0x32)❌ Not implemented
Hart arrays (hawindowsel/hawindow)❌ Not implemented
custom0-15❌ Not implemented
Multi-hart support✅ ImplementedParameterized p.harts, per-hart buses, hartSel selection

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

Triggers

Phase 1D: Trigger Module


Spec Feature (Chapter)Vexriscv Debug ImplementationImplementation Details
Ch 5: Trigger Module (hart-side CSRs)
tselect (0x7A0)✅ ImplementedCsrPlugin.scala (lines 870-875): WARL index, parameterized debugTriggers (default 2)
tinfo (0x7A4)✅ ImplementedCsrPlugin.scala (line 878): reports type 2 (mcontrol) support
tdata1 (0x7A1)⚠️ PartialCsrPlugin.scala (lines 922-942): type=2, dmode, execute, m/s/u, action. Missing: timing, select, sizelo/hi, maskmax, chain, match, load, store, hit
tdata2 (0x7A2)✅ ImplementedCsrPlugin.scala (lines 944-953): 32-bit compare value, PC equality match
tdata3 (0x7A3)❌ Not implemented
tcontrol (0x7A5)❌ Not implementedNo mte/mpte
Trigger type⚠️ mcontrol (type 2) onlyLegacy type 2, not type 6 (mcontrol6). Spec recommends type 6 for new implementations
Match modes⚠️ Equal onlyOnly match=0 (equality). No napot, >=, <, mask modes
Match targets⚠️ Execute address onlyOnly execute bit implemented. No load/store data/address match
Privilege filtering✅ Implementedm, s, u bits with privilegeHit logic (lines 930-934)
dmode security✅ Implementeddmode bit controls debug-only write access (line 925)
action field⚠️ PartialRegister exists but only action=1 (enter debug) used in match logic
Trigger chaining❌ Not implementedNo chain bit
dcsr.cause=2 on trigger✅ ImplementedCsrPlugin.scala (line 892): sets dcsr.cause := 2 on trigger hit
Trigger hit → debug entry✅ ImplementedCsrPlugin.scala (lines 881-897): decodeBreak halts pipeline, enters debug mode
mcontrol6 (type 6)❌ Not implementedOnly legacy type 2 exists
icount (type 3)❌ Not implemented
itrigger/etrigger/tmexttrigger❌ Not implemented
Hardware breakpoints⚠️ Spec-compliant but limitedType 2 mcontrol with execute address match=0 only, privilege filtering, dmode security
mcontext/scontext❌ Not implemented
SoC Integration
DTM→DM→Hart wiring✅ ImplementedDebugModuleFiber.scala — multi-hart binding, clock-domain-safe pipelining
Tilelink SBA bridge✅ ImplementedmakeSysbusTilelink() in DebugModuleFiber