Fix index calculation for locked PMP csr logic (#1335)

Fixes #1332
Superseeds #1334

Signed-off-by: Moritz Schneider <moritz.schneider@inf.ethz.ch>
Co-authored-by: Ömer Güzel <omer.guzel@agu.edu.tr>
This commit is contained in:
Moritz Schneider 2023-08-15 11:29:31 +02:00 committed by GitHub
parent 49d1262512
commit 306973a386
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -872,7 +872,7 @@ module csr_regfile import ariane_pkg::*; #(
// index is specified by the last byte in the address
automatic int index = csr_addr.csr_decode.address[3:0];
// check if the entry or the entry above is locked
if (!pmpcfg_q[index].locked && !(pmpcfg_q[index].locked && pmpcfg_q[index].addr_mode == riscv::TOR)) begin
if (!pmpcfg_q[index].locked && !(pmpcfg_q[index+1].locked && pmpcfg_q[index].addr_mode == riscv::TOR)) begin
pmpaddr_d[index] = csr_wdata[riscv::PLEN-3:0];
end
end