Skip to content

Commit

Permalink
Fix mstatus.mpp in relation to the possible legal values (#2285)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanRochCoulon authored Jun 21, 2024
1 parent ee0847e commit 21383ce
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/csr_regfile.sv
Original file line number Diff line number Diff line change
Expand Up @@ -1283,11 +1283,10 @@ module csr_regfile
mstatus_d.tw = riscv::Off;
mstatus_d.mprv = riscv::Off;
end
// If h-extension is not enabled, priv level HS is reserved
if (!CVA6Cfg.RVH) begin
if (mstatus_d.mpp == riscv::PRIV_LVL_HS) begin
mstatus_d.mpp = riscv::PRIV_LVL_U;
end
if ((!CVA6Cfg.RVH & mstatus_d.mpp == riscv::PRIV_LVL_HS) |
(!CVA6Cfg.RVS & mstatus_d.mpp == riscv::PRIV_LVL_S) |
(!CVA6Cfg.RVU & mstatus_d.mpp == riscv::PRIV_LVL_U)) begin
mstatus_d.mpp = mstatus_q.mpp;
end
mstatus_d.wpri3 = 9'b0;
mstatus_d.wpri1 = 1'b0;
Expand Down

0 comments on commit 21383ce

Please sign in to comment.