Add menvcfg CSR, and comment explaining why we don't have mseccfg CSR

This commit is contained in:
Luke Wren 2022-06-26 01:25:08 +01:00
parent ad8f883406
commit 5455349961
3 changed files with 26 additions and 3 deletions

View File

@ -29,7 +29,7 @@ Hazard3 is still under development.
# Links to Specifications
These are links to the ratified versions of the extensions. In general, later drafts or releases of these specifications describing the _same extension versions_ may be used for reference, and often have minor improvements to wording.
These are links to the ratified versions of the extensions.
| Extension | Specification |
|----------- |---------------|

View File

@ -555,8 +555,17 @@ always @ (*) begin
decode_match = match_mrw;
end
// MEDELEG, MIDELEG should not exist for M-only implementations. Will raise
// illegal instruction exception if accessed.
// MEDELEG, MIDELEG should not exist for no-S-mode implementations. Will
// raise illegal instruction exception if accessed.
// MENVCFG is seemingly mandatory as of M-mode v1.12, if U-mode is
// implemented. All of its fields are tied to 0 in our implementation.
MENVCFGH: if (U_MODE) begin
decode_match = match_mrw;
end
MENVCFG: if (U_MODE) begin
decode_match = match_mrw;
end
// ------------------------------------------------------------------------
// Trap-handling CSRs
@ -845,6 +854,9 @@ always @ (*) begin
rdata = pmp_cfg_rdata;
end
// MSECCFG is strictly optional, and we don't implement any of its
// features (ePMP etc) so we don't decode it.
// ------------------------------------------------------------------------
// U-mode CSRs
@ -1272,3 +1284,7 @@ end
`endif
endmodule
`ifndef YOSYS
`default_nettype wire
`endif

View File

@ -54,6 +54,9 @@ localparam PMPADDR13 = 12'h3bd;
localparam PMPADDR14 = 12'h3be;
localparam PMPADDR15 = 12'h3bf;
localparam MSECCFG = 12'h747;
localparam MSECCFGH = 12'h757;
// Performance counters (RW)
localparam MCYCLE = 12'hb00; // Raw cycles since start of day
localparam MINSTRET = 12'hb02; // Instruction retire count since start of day
@ -150,6 +153,10 @@ localparam MHPMEVENT29 = 12'h33d; // WARL (we tie to 0)
localparam MHPMEVENT30 = 12'h33e; // WARL (we tie to 0)
localparam MHPMEVENT31 = 12'h33f; // WARL (we tie to 0)
// Other standard M-mode CSRs:
localparam MENVCFG = 12'h30a;
localparam MENVCFGH = 12'h31a;
// Custom M-mode CSRs:
localparam MEIE0 = 12'hbe0; // External interrupt enable register 0
localparam MEIE1 = 12'hbe1; // External interrupt enable register 1