Make MVENDORID/MARCHID/MIMPID configurable

This commit is contained in:
Luke Wren 2021-05-30 18:42:43 +01:00
parent 12205f12c7
commit 565b76672a
2 changed files with 22 additions and 7 deletions

View File

@ -35,6 +35,20 @@ parameter CSR_M_TRAP = 1,
// CSR_COUNTER: Include performance counters and relevant M-mode CSRs // CSR_COUNTER: Include performance counters and relevant M-mode CSRs
parameter CSR_COUNTER = 0, parameter CSR_COUNTER = 0,
// ----------------------------------------------------------------------------
// ID registers
// JEDEC JEP106-compliant vendor ID, can be left at 0 if "not implemented or
// that this is a non-commercial implementation" (RISC-V spec).
// 31:7 is continuation code count, 6:0 is ID. Parity bit is not stored.
parameter MVENDORID_VAL = 32'h0,
// Architecture ID for Hazard3, currently 0 because unregistered. (TODO)
parameter MARCHID_VAL = 32'h0,
// Implementation ID for this specific version of Hazard3. Git hash is perfect.
parameter MIMPID_VAL = 32'h0,
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Performance/size options // Performance/size options

View File

@ -432,18 +432,15 @@ always @ (*) begin
end end
MVENDORID: if (CSR_M_MANDATORY) begin MVENDORID: if (CSR_M_MANDATORY) begin
decode_match = !wen_soon; // MRO decode_match = !wen_soon; // MRO
// I don't have a JEDEC ID. It is legal to tie this to 0 if non-commercial. rdata = MVENDORID_VAL;
rdata = {XLEN{1'b0}};
end end
MARCHID: if (CSR_M_MANDATORY) begin MARCHID: if (CSR_M_MANDATORY) begin
decode_match = !wen_soon; // MRO decode_match = !wen_soon; // MRO
// I don't have a RV foundation ID. It is legal to tie this to 0. rdata = MARCHID_VAL;
rdata = {XLEN{1'b0}};
end end
MIMPID: if (CSR_M_MANDATORY) begin MIMPID: if (CSR_M_MANDATORY) begin
decode_match = !wen_soon; // MRO decode_match = !wen_soon; // MRO
// TODO put git SHA or something here rdata = MIMPID_VAL;
rdata = {XLEN{1'b0}};
end end
MHARTID: if (CSR_M_MANDATORY) begin MHARTID: if (CSR_M_MANDATORY) begin
decode_match = !wen_soon; // MRO decode_match = !wen_soon; // MRO
@ -473,6 +470,10 @@ always @ (*) begin
}; };
end end
// MSTATUSH is not implemented (permitted when all fields would be tied to
// zero -- those fields being MBE and SBE, which are zero because we are
// pure little-endian.)
// MEDELEG, MIDELEG should not exist for M-only implementations. Will raise // MEDELEG, MIDELEG should not exist for M-only implementations. Will raise
// illegal instruction exception if accessed. // illegal instruction exception if accessed.