Open xiaoweish opened 3 days ago
Good catch !
Here is my proposed fix:
https://github.com/openhwgroup/cva6/blob/master/core/csr_regfile.sv#L827
// --------------------
// Counters
// --------------------
cycle_d = cycle_q;
instret_d = instret_q;
- if (!debug_mode_q) begin
+ if ( !(debug_mode_q==1'b1 && dcsr_d.stopcount==1'b1) ) begin
// increase instruction retired counter
for (int i = 0; i < CVA6Cfg.NrCommitPorts; i++) begin
if (commit_ack_i[i] && !ex_i.valid && (!CVA6Cfg.PerfCounterEn || (CVA6Cfg.PerfCounterEn && !mcountinhibit_q[2])))
instret++;
end
instret_d = instret;
// increment the cycle count
if (!CVA6Cfg.PerfCounterEn || (CVA6Cfg.PerfCounterEn && !mcountinhibit_q[0]))
cycle_d = cycle_q + 1'b1;
else cycle_d = cycle_q;
end
Hello @xiaoweish It is difficult to me saying whether the modification is right. What could be great is to add a debug job to the CI to monitor the regression of debug mode. Do you think this would be possible ?
Hi @JeanRochCoulon , Yes, it would be beneficial to incorporate the debug job into CI once debug_test is implemented.
This issue was indeed discovered during the debug_test
. Once PR https://github.com/openhwgroup/cva6/pull/2293 is approved, I'll proceed with additional PR(s) for this task.
Let's do as you said :-) The PR will be reviewed begin of next week
Is there an existing CVA6 bug for this?
Bug Description
When
debug_req_i
is asserted and DUT enters into debug mode,minstret
andmcycle
do not increment in debug mode (whiledcsr.stopcount==0
), as below figure shows,riscv-debug-spec says,
also, here
So, we can see that current cva6 behavior:
minstret
andmcycle
stopped is conflict with itsdcsr.stopcount==0
setting.