-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug halt causes illegal instructions #14
Comments
An update - we seem to get around the problem by reading the value of Is this a bug somewhere, or is it always required to read/write |
We also noticed that the problem isn't just limited to the debug unit - whilst executing some programs that stall the pipeline with a load, the contents of the prefetch fifo become corrupted. It turns out that we observe these issues only when Is it possible that there's an issue with Or maybe there's something else that needs to be done that we're not doing when using the |
Hello, thanks for reporting it! I will try to replicate it, can you tell us more details to replicate such pipeline issue? Maybe some waveforms or the piece of code with relative stalls would be also helpful for us. Thanks a lot, |
I've just tried changing |
* Restored correct syntax * Automatic PR dev->master (#766) * Correcting RFVI trace * Some clarifications about immediate in scalar replication on SIMD instructions. Signed-off-by: Pascal Gouedo <[email protected]> * Headers alignement. Signed-off-by: Pascal Gouedo <[email protected]> * Changed uvm_error in uvm_info in old tracer to avoid errors and header alignement. Signed-off-by: Pascal Gouedo <[email protected]> * Moved typedef definitions in rvfi_pkg and header alignement. Signed-off-by: Pascal Gouedo <[email protected]> * launched verible Signed-off-by: Pascal Gouedo <[email protected]> * Update documentation of instruction extensions for CV32E40P version 2. (#760) * Restored correct syntax * Update documentation of instruction extensions for CV32E40P version 2. These changes particularly relate to how tool chain support is invoked using -march. We take the opportunity to remove caveats about ISA extensions not supported in the tool chain, since all are now supported in both GCC and Clang/LLVM. * docs/source/instruction_set_extensions.rst: Add -march tool chain invocations for each ISA extension and remove all caveats about compiler support. Signed-off-by: Jeremy Bennett <[email protected]> --------- Signed-off-by: Jeremy Bennett <[email protected]> Co-authored-by: Davide Schiavone <[email protected]> Co-authored-by: pascalgouedo <[email protected]> --------- Signed-off-by: Pascal Gouedo <[email protected]> Signed-off-by: Jeremy Bennett <[email protected]> Co-authored-by: Yoann Pruvost <[email protected]> Co-authored-by: pascalgouedo <[email protected]> Co-authored-by: Jeremy Bennett <[email protected]> Co-authored-by: Davide Schiavone <[email protected]> * new block diagram (#14) --------- Signed-off-by: Pascal Gouedo <[email protected]> Signed-off-by: Jeremy Bennett <[email protected]> Co-authored-by: pascalgouedo <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Yoann Pruvost <[email protected]> Co-authored-by: Jeremy Bennett <[email protected]>
Summary
We are working on a verilator model of RI5CY and are attempting to understand how to use the debug unit. Normal execution seems to work correctly as far as we can observe. Whenever we attempt to halt the processor by writing
DBG_CTRL_HALT
toDBG_CTRL
, an illegal instruction exception seems to be generated.Details
Our test bench does the following (the test bench file is at https://github.com/embecosm/ri5cy/blob/debug_halt/verilator-model/testbench.cpp), which is inspired by looking at
tb.svh
andspi_debug_test.svh
in the PULPino repository:irq_i
,debug_req_i
,fetch_enable_i
andrstn_i
to 0.rstn_i
to 1 andfetch_enable_i
to 1.DBG_CTRL = DBG_CTRL | DBG_CTRL_HALT
DBG_IE = 0xF
DBG_CTRL
until we observe thatDBG_CTRL_HALT
is set.DBG_CTRL = DBG_CTRL_HALT | DBG_CTRL_SSTE
.At this point we think we should be ready to single-step. For each single step, we:
DBG_HIT
(I didn't see this in the test bench, but it's what the debug_bridge GDB server appeared to do for single steps).DBG_CTRL = DBG_CTRL_SSTE
.The first one or two single steps seem to work OK (depending on how many cycles we run for and how much we try and interact with the debug unit) but it seems that after about 8 cycles, an illegal instruction exception occurs.
Observations
A colleague of mine has suggested that it looks like something goes awry in the prefetch fifo - when executing normally, core/if_stage/prefetch_32/prefetch/fifo valid_Q[0] is never set, so we bypass the input of the fifo to the output without ever caching it in the fifo itself. In the debug case the core halts and the fifo fills up. The fifo then wipes one of the entries to 0, later it passes that to the decoder and it gives the undefined exception.
Reproducing
If it is helpful to try to reproduce the issue, then this can be done by:
verilator-model
subdirectory, runmake
. Note that this requires the latest version of verilator installed (3.906), and for pkg-config to be able to find verilator../testbench
.The output that it produces is reproduced here:
The output is produced by the
stepSingle
function - we read the registers each time we try to single step, to try and get some visibility into what is happening.Questions
Looking at past issues it seems that other people are successfully making use of the debug unit, so I guess there might be something wrong with what we'e doing or how we're setting things up.
Any assistance is greatly appreciated - many thanks in advance!
The text was updated successfully, but these errors were encountered: