From a82bc6b35c2890b91ff01cf7eec63d03c9e78ed6 Mon Sep 17 00:00:00 2001 From: Moritz Schneider Date: Tue, 27 Aug 2024 11:15:32 +0200 Subject: [PATCH] Fix pmpaddr read logic considering G=2 fixes #2465 --- core/csr_regfile.sv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/csr_regfile.sv b/core/csr_regfile.sv index 8d36d3f9cb..0c996e2da3 100644 --- a/core/csr_regfile.sv +++ b/core/csr_regfile.sv @@ -854,8 +854,8 @@ module csr_regfile // -> last bit of pmpaddr must be set 0/1 based on the mode: // NA4, NAPOT: 1 // TOR, OFF: 0 - if (pmpcfg_q[index].addr_mode[1] == 1'b1 || pmpcfg_q[index].addr_mode == 'h0) - csr_rdata = pmpaddr_q[index][CVA6Cfg.PLEN-3:0]; + if (pmpcfg_q[index].addr_mode[1] == 1'b1) + csr_rdata = {pmpaddr_q[index][CVA6Cfg.PLEN-3:1], 1'b1}; else csr_rdata = {pmpaddr_q[index][CVA6Cfg.PLEN-3:1], 1'b0}; end default: read_access_exception = 1'b1;