From 40d34d204a5fd1356e1f84e2c791e3a4b29d0112 Mon Sep 17 00:00:00 2001 From: Olof Kindgren Date: Thu, 22 Aug 2024 22:14:04 +0200 Subject: [PATCH] Avoid matching misa CSR as mstatus Reads from the (unimplemented) misa register matched mstatus which in turn caused garbage data to be written to other CSRs. Make the matching mask slightly stricter to avoid this particular issue. --- rtl/serv_decode.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtl/serv_decode.v b/rtl/serv_decode.v index 3719819..54ed74b 100644 --- a/rtl/serv_decode.v +++ b/rtl/serv_decode.v @@ -188,7 +188,7 @@ module serv_decode wire co_rd_csr_en = csr_op; wire co_csr_en = csr_op & csr_valid; - wire co_csr_mstatus_en = csr_op & !op26 & !op22; + wire co_csr_mstatus_en = csr_op & !op26 & !op22 & !op20; wire co_csr_mie_en = csr_op & !op26 & op22 & !op20; wire co_csr_mcause_en = csr_op & op21 & !op20;