From d2a1be82ef5d68a179cef1972a2f304cee459ce8 Mon Sep 17 00:00:00 2001 From: Davide Schiavone Date: Tue, 26 Sep 2023 18:23:17 +0200 Subject: [PATCH] [rtl] Make PMP CSRs illegal in non PMP configurations (#155) The previous behaviour was also acceptable but this matches spike. Co-authored-by: Greg Chadwick --- rtl/cve2_cs_registers.sv | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rtl/cve2_cs_registers.sv b/rtl/cve2_cs_registers.sv index cfd67f4d09..dfce09858e 100644 --- a/rtl/cve2_cs_registers.sv +++ b/rtl/cve2_cs_registers.sv @@ -468,6 +468,16 @@ module cve2_cs_registers #( illegal_csr = 1'b1; end endcase + + if (!PMPEnable) begin + if (csr_addr inside {CSR_PMPCFG0, CSR_PMPCFG1, CSR_PMPCFG2, CSR_PMPCFG3, + CSR_PMPADDR0, CSR_PMPADDR1, CSR_PMPADDR2, CSR_PMPADDR3, + CSR_PMPADDR4, CSR_PMPADDR5, CSR_PMPADDR6, CSR_PMPADDR7, + CSR_PMPADDR8, CSR_PMPADDR9, CSR_PMPADDR10, CSR_PMPADDR11, + CSR_PMPADDR12, CSR_PMPADDR13, CSR_PMPADDR14, CSR_PMPADDR15}) begin + illegal_csr = 1'b1; + end + end end // write logic