mirror of
https://github.com/openhwgroup/cve2.git
synced 2025-04-22 04:57:25 -04:00
Feature/privil mode spec update (#96)
* [rtl] Clear mprv on mret to non M-mode This is specification change between the v1.11 and v1.12 privileged architectures. Previously mprv wasn't altered on mret. Now if returning to a privilege level other than M mode mprv must be cleared. * [rtl, dv] Add new CSRs for latest priviledged spec This adds the following CSRs to support the v1.12 priviledged spec. - MSTATUSH - MCONFIGPTR - MENVCFG - MENVCFGH MCONFIGPTR is read only and has its value provided by a ibex_pkg parameter CSR_MCONFIGPTR_VALUE which is set to 0. Implementors can alter this value if needed. All the other CSRs ignore writes and read as 0. --------- Co-authored-by: Greg Chadwick <gac@lowrisc.org>
This commit is contained in:
parent
823f596047
commit
685f1f6ee7
2 changed files with 28 additions and 4 deletions
|
@ -279,6 +279,8 @@ module cve2_cs_registers #(
|
|||
CSR_MIMPID: csr_rdata_int = CSR_MIMPID_VALUE;
|
||||
// mhartid: unique hardware thread id
|
||||
CSR_MHARTID: csr_rdata_int = hart_id_i;
|
||||
// mconfigptr: pointer to configuration data structre
|
||||
CSR_MCONFIGPTR: csr_rdata_int = CSR_MCONFIGPTR_VALUE;
|
||||
|
||||
// mstatus: always M-mode, contains IE bit
|
||||
CSR_MSTATUS: begin
|
||||
|
@ -290,6 +292,13 @@ module cve2_cs_registers #(
|
|||
csr_rdata_int[CSR_MSTATUS_TW_BIT] = mstatus_q.tw;
|
||||
end
|
||||
|
||||
// mstatush: All zeros for Ibex (fixed little endian and all other bits reserved)
|
||||
CSR_MSTATUSH: csr_rdata_int = '0;
|
||||
|
||||
// menvcfg: machine environment configuration, all zeros for Ibex (none of the relevant
|
||||
// features are implemented)
|
||||
CSR_MENVCFG, CSR_MENVCFGH: csr_rdata_int = '0;
|
||||
|
||||
// misa
|
||||
CSR_MISA: csr_rdata_int = MISA_VALUE;
|
||||
|
||||
|
@ -663,6 +672,10 @@ module cve2_cs_registers #(
|
|||
mstatus_en = 1'b1;
|
||||
mstatus_d.mie = mstatus_q.mpie; // re-enable interrupts
|
||||
|
||||
if (mstatus_q.mpp != PRIV_LVL_M) begin
|
||||
mstatus_d.mprv = 1'b0;
|
||||
end
|
||||
|
||||
// SEC_CM: EXCEPTION.CTRL_FLOW.LOCAL_ESC
|
||||
// SEC_CM: EXCEPTION.CTRL_FLOW.GLOBAL_ESC
|
||||
|
||||
|
|
|
@ -364,10 +364,11 @@ package cve2_pkg;
|
|||
// CSRs
|
||||
typedef enum logic[11:0] {
|
||||
// Machine information
|
||||
CSR_MVENDORID = 12'hF11,
|
||||
CSR_MARCHID = 12'hF12,
|
||||
CSR_MIMPID = 12'hF13,
|
||||
CSR_MHARTID = 12'hF14,
|
||||
CSR_MVENDORID = 12'hF11,
|
||||
CSR_MARCHID = 12'hF12,
|
||||
CSR_MIMPID = 12'hF13,
|
||||
CSR_MHARTID = 12'hF14,
|
||||
CSR_MCONFIGPTR = 12'hF15,
|
||||
|
||||
// Machine trap setup
|
||||
CSR_MSTATUS = 12'h300,
|
||||
|
@ -375,6 +376,10 @@ package cve2_pkg;
|
|||
CSR_MIE = 12'h304,
|
||||
CSR_MTVEC = 12'h305,
|
||||
CSR_MCOUNTEREN= 12'h306,
|
||||
CSR_MSTATUSH = 12'h310,
|
||||
|
||||
CSR_MENVCFG = 12'h30A,
|
||||
CSR_MENVCFGH = 12'h31A,
|
||||
|
||||
// Machine trap handling
|
||||
CSR_MSCRATCH = 12'h340,
|
||||
|
@ -565,5 +570,11 @@ package cve2_pkg;
|
|||
// version here using their own unique encoding (e.g. 32 bits of the git hash of the implemented
|
||||
// commit).
|
||||
localparam logic [31:0] CSR_MIMPID_VALUE = 32'b0;
|
||||
|
||||
// Machine Configuration Pointer
|
||||
// 0 indicates the configuration data structure does not eixst. Ibex implementors may wish to
|
||||
// alter this to point to their system specific configuration data structure.
|
||||
localparam logic [31:0] CSR_MCONFIGPTR_VALUE = 32'b0;
|
||||
|
||||
endpackage
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue