Skip to content
Rivoryxa Technologies

Showing a RISC-V core ran before halting for debug at reset

A closed bug report on a RISC-V core: a debug request at reset let the core start running before it halted. We reproduced it and verified the maintainers' fix.

Open source RISC-V core, bug report 410Outcome: Bug reproduced, fix verified

1The issue

When a debugger asks a core to halt from the moment reset ends, the core should stop before it runs any code. Issue 410 reported that the core's controller could not go straight from its reset debug state to the halted state. Instead it passed through a boot step and started running first. The maintainers later changed the controller so it checks the debug request during reset, and the issue was closed.

The points on the issue

Before the fix: debug request held from resetThe core runs at cycle 4 and only halts at cycle 7.
After the fix: the same requestThe core halts at cycle 5 with no instruction retired. Proven for all time.
Running after a debug returnStill allowed, as it should be. An early, stricter version of our check wrongly banned it.
The maintainers' fix, read after our proofsIt removes the boot step and checks the debug request in reset, the step our trace shows missing.

2What we did

  1. 1Wrote a rule for the debug state machine: with a debug request held from reset, the core must halt before it runs. It may run only after a debug return.
  2. 2Ran the rule on the design from January 2022, before the fix. Formal checking, which tries every input sequence, found a 4 cycle trace where the core runs before it halts.
  3. 3Ran the same rule on the current design. It is proven for all time, and also passes a bounded check to 25 cycles.
  4. 4Only after proving, read the maintainers' fix and compared it with the trace.

3Result

The bug is reproduced on the old design and absent from the current one. The trace shows exactly the step the maintainers' fix adds.

The fix is verified against the checks in the report only, not the wider test suite, and only for the configuration the report names.

Have a bug like this one?

Describe the problem in a few lines. An engineer replies, and we agree the scope together.

Discuss a verification problem