[rtl] Add MCOUNTEREN CSR

This commit adds the MCOUNTEREN CSR as required by the RISC-V spec.
The register is defined as WARL. At the moment, Ibex doesn't enable U-mode
access to the performance montiors. Consequently, writes to the register are
ignored and it reads as zero which is okay according to the spec.

This resolves lowRISC/Ibex#1278 .
This commit is contained in:
Vladimir Rozic 2021-03-03 14:10:39 +00:00 committed by Vladimir Rozic
parent 5ef18f0b78
commit 5363499190
2 changed files with 7 additions and 0 deletions

View file

@ -319,6 +319,12 @@ module ibex_cs_registers #(
csr_rdata_int[CSR_MFIX_BIT_HIGH:CSR_MFIX_BIT_LOW] = mie_q.irq_fast;
end
// mcounteren: machine counter enable
CSR_MCOUNTEREN: begin
csr_rdata_int = '0;
illegal_csr = ~DbgTriggerEn;
end
CSR_MSCRATCH: csr_rdata_int = mscratch_q;
// mtvec: trap-vector base address

View file

@ -358,6 +358,7 @@ typedef enum logic[11:0] {
CSR_MISA = 12'h301,
CSR_MIE = 12'h304,
CSR_MTVEC = 12'h305,
CSR_MCOUNTEREN= 12'h306,
// Machine trap handling
CSR_MSCRATCH = 12'h340,