Skip to content

Commit

Permalink
Merge pull request #41 from mmxsrup/fix-issue-39
Browse files Browse the repository at this point in the history
Fix the value written to mepc
  • Loading branch information
reo-pon authored Mar 5, 2024
2 parents 3d13af1 + 6770538 commit f580538
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Processor/Src/Privileged/CSR_Unit.sv
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ module CSR_Unit(
CSR_NUM_MCAUSE: csrNext.mcause = wv;
CSR_NUM_MTVEC: csrNext.mtvec = wv;
CSR_NUM_MTVAL: csrNext.mtval = wv;
CSR_NUM_MEPC: csrNext.mepc = wv;
// The low bit of mepc is always zero,
// as described in Chapter 3.1.19 of RISC-V Privileged Architectures.
CSR_NUM_MEPC: csrNext.mepc = {wv[31:1], 1'b0};
CSR_NUM_MSCRATCH: csrNext.mscratch = wv;

CSR_NUM_MCYCLE: csrNext.mcycle = wv;
Expand Down

0 comments on commit f580538

Please sign in to comment.