diff --git a/Readme.md b/Readme.md index 9bf01d1..00021d0 100644 --- a/Readme.md +++ b/Readme.md @@ -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 | |----------- |---------------| diff --git a/hdl/hazard3_csr.v b/hdl/hazard3_csr.v index 1e61e1a..7ba6abf 100644 --- a/hdl/hazard3_csr.v +++ b/hdl/hazard3_csr.v @@ -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 diff --git a/hdl/hazard3_csr_addr.vh b/hdl/hazard3_csr_addr.vh index 88ce9c9..0023079 100644 --- a/hdl/hazard3_csr_addr.vh +++ b/hdl/hazard3_csr_addr.vh @@ -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