Skip to content

Commit

Permalink
fix #2464: exception is not generated when INHIBIT CSR is accessed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanRochCoulon authored Aug 27, 2024
1 parent 53b51ac commit faf4536
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions core/csr_regfile.sv
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,7 @@ module csr_regfile
riscv::CSR_MHARTID: csr_rdata = hart_id_i;
riscv::CSR_MCONFIGPTR: csr_rdata = '0; // not implemented
riscv::CSR_MCOUNTINHIBIT:
if (CVA6Cfg.PerfCounterEn)
csr_rdata = {{(CVA6Cfg.XLEN - (MHPMCounterNum + 3)) {1'b0}}, mcountinhibit_q};
else read_access_exception = 1'b1;
csr_rdata = {{(CVA6Cfg.XLEN - (MHPMCounterNum + 3)) {1'b0}}, mcountinhibit_q};
// Counters and Timers
riscv::CSR_MCYCLE: csr_rdata = cycle_q[CVA6Cfg.XLEN-1:0];
riscv::CSR_MCYCLEH:
Expand Down Expand Up @@ -1494,7 +1492,7 @@ module csr_regfile
riscv::CSR_MCOUNTINHIBIT:
if (CVA6Cfg.PerfCounterEn)
mcountinhibit_d = {csr_wdata[MHPMCounterNum+2:2], 1'b0, csr_wdata[0]};
else update_access_exception = 1'b1;
else mcountinhibit_d = '0;
// performance counters
riscv::CSR_MCYCLE: cycle_d[CVA6Cfg.XLEN-1:0] = csr_wdata;
riscv::CSR_MCYCLEH:
Expand Down

0 comments on commit faf4536

Please sign in to comment.