Skip to content

Debug spec v1.0 implementation#1590

Open
JacobPease wants to merge 191 commits intoopenhwgroup:debugfrom
JacobPease:debug
Open

Debug spec v1.0 implementation#1590
JacobPease wants to merge 191 commits intoopenhwgroup:debugfrom
JacobPease:debug

Conversation

@JacobPease
Copy link
Copy Markdown
Contributor

@JacobPease JacobPease commented Dec 16, 2025

This pull request contains an early stage implementation of the Debug Specification. It has the basic features of halting, resuming, resetting, halting on reset, and reading GPRs, CSRs, and FPRs. In it's current state it provides a framework with which we can implement more complicated features, like stepping and going into debug mode on ebreaks in various privilege modes. Inside docs/debug/wallydebug.md is a list of features already implemented and features that are going to be implemented.

This PR also contains a new method of Verification for the Debug module. Since the Debug module is driven by commands sent over a JTAG interface, separate testvectors must drive the JTAG pins while Wally executes instructions. To accomplish this, a test building framework was developed taking advantage of the features of Spike and the RISC-V variant of OpenOCD which can be found at this repo: riscv-openocd

First we write assembly tests for Spike and we write Tcl scripts to drive OpenOCD. We then run these two programs together as separate processes and connect OpenOCD to Spike's remote bitbang interface. The Tcl commands drive the JTAG pins and allows the RISC-V code, which has certain stopping points in it, to finish executing, ending the test. OpenOCD is configured to output a log of all Debug Module Interface commands it writes over the JTAG interface. This log is scraped for testvectors and saved to a file.

When we run wsim with a configuration with DEBUG_SUPPORTED set high, the testbenches Debugger module is driven with the testvectors generated using OpenOCD and Spike. Several features have been verified using this method.

To build and run the debug tests, run the following commands starting in the cvw root directory:

source ./setup.sh
cd sim; make deriv
cd ../tests/debug
make
wsim debug64 wally64debug

In addition to remaining features to be added, there's room for other improvements and discussion on how to optimally modify the current setup. There are currently only tests written for the rv64gc configuration with Debug supported. Additionally, implementing Imperas support requires that wsim and the testbench be expanded to take two testvector references when doing single tests on a single elf file and a Debugger testvector file, though the rvvi interface to the DMI is simple and easy to add to the testbench. This rvvi DMI interface is serial interface agnostic and only requires that we connect the DMI signals.

JacobPease and others added 30 commits July 30, 2025 15:57
…mentation. These implementations will look less like how the JTAG spec mandates it and more like what the Debug spec says it should be.
update debug header for tap_controller.sv + some comments
…to reset the op when receiving an acknowledgement as to not trigger another transaction.
stineje and others added 30 commits March 4, 2026 09:12
…of the ebreak when an ebreak enables DebugMode.
…atch due to Spike and Wally having different reset vectors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants