Fix PMPCFG csr read for 32bit configuration (#734)

Fixes #733

Signed-off-by: Moritz Schneider <moritz.schneider@inf.ethz.ch>
This commit is contained in:
Moritz Schneider 2021-10-06 09:30:48 +02:00 committed by GitHub
parent a551e59f47
commit 464f1daf18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -280,8 +280,10 @@ module csr_regfile import ariane_pkg::*; #(
riscv::CSR_DCACHE: csr_rdata = dcache_q;
riscv::CSR_ICACHE: csr_rdata = icache_q;
// PMPs
riscv::CSR_PMPCFG0: csr_rdata = pmpcfg_q[7:0];
riscv::CSR_PMPCFG2: csr_rdata = pmpcfg_q[15:8];
riscv::CSR_PMPCFG0: csr_rdata = pmpcfg_q[riscv::XLEN/8-1:0];
riscv::CSR_PMPCFG1: if (riscv::XLEN == 32) csr_rdata = pmpcfg_q[7:4]; else read_access_exception = 1'b1;
riscv::CSR_PMPCFG2: csr_rdata = pmpcfg_q[8 +: riscv::XLEN/8];
riscv::CSR_PMPCFG3: if (riscv::XLEN == 32) csr_rdata = pmpcfg_q[15:12]; else read_access_exception = 1'b1;
// PMPADDR
// Important: we only support granularity 8 bytes (G=1)
// -> last bit of pmpaddr must be set 0/1 based on the mode: