From 61208e486cd03eea64a28d03fbfc3ce79b8174e5 Mon Sep 17 00:00:00 2001 From: David Harris Date: Sun, 2 Jul 2023 02:00:27 -0700 Subject: [PATCH] Fixed ENVCFG to reply on both MENVCFG and SENVCFG when in user mode --- src/privileged/csr.sv | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/privileged/csr.sv b/src/privileged/csr.sv index 5b2ea802a..c9cc88f3c 100644 --- a/src/privileged/csr.sv +++ b/src/privileged/csr.sv @@ -293,9 +293,18 @@ module csr import cvw::*; #(parameter cvw_t P) ( assign ENVCFG_STCE = MENVCFG_REGW[63]; // supervisor timer counter enable assign ENVCFG_PBMTE = MENVCFG_REGW[62]; // page-based memory types enable assign ENVCFG_CBE = (PrivilegeModeW == P.M_MODE) ? 4'b1111 : - (PrivilegeModeW == P.S_MODE | !P.S_SUPPORTED) ? MENVCFG_REGW[7:4] : SENVCFG_REGW[7:4]; + (PrivilegeModeW == P.S_MODE | !P.S_SUPPORTED) ? MENVCFG_REGW[7:4] : + (MSENVCFG_REGW[7:4] & SENVCFG_REGW[7:4]); + // FIOM presently doesn't do anything because Wally fences don't do anything assign ENVCFG_FIOM = (PrivilegeModeW == P.M_MODE) ? 1'b1 : - (PrivilegeModeW == P.S_MODE | !P.S_SUPPORTED) ? MENVCFG_REGW[0] : SENVCFG_REGW[0]; + (PrivilegeModeW == P.S_MODE | !P.S_SUPPORTED) ? MENVCFG_REGW[0] : + (MENVCFG_REGW[0] & SENVCFG_REGW[0]); + +if (((priv_mode != M) && (menvcfg.CBIE == 00)) || + ((priv_mode == U) && (senvcfg.CBIE == 00))) + { + + } // merge CSR Reads assign CSRReadValM = CSRUReadValM | CSRSReadValM | CSRMReadValM | CSRCReadValM;