Reduced complexity of pmpadrdec

This commit is contained in:
David Harris 2021-06-23 03:03:52 -04:00
parent 4189b2d4a7
commit 718630c378
3 changed files with 16 additions and 12 deletions

View File

@ -65,17 +65,17 @@ add wave -hex /testbench/dut/hart/priv/csr/genblk1/csrm/MEPC_REGW
add wave -divider
# peripherals
add wave -hex /testbench/dut/uncore/plic/*
add wave -hex /testbench/dut/uncore/plic/intPriority
add wave -hex /testbench/dut/uncore/plic/pendingArray
add wave -divider
add wave -hex /testbench/dut/uncore/uart/u/*
add wave -divider
add wave -hex /testbench/dut/uncore/gpio/*
add wave -divider
add wave -hex /testbench/dut/hart/ebu/*
add wave -divider
add wave -divider
#add wave -hex /testbench/dut/uncore/plic/*
#add wave -hex /testbench/dut/uncore/plic/intPriority
#add wave -hex /testbench/dut/uncore/plic/pendingArray
#add wave -divider
#add wave -hex /testbench/dut/uncore/uart/u/*
#add wave -divider
#add wave -hex /testbench/dut/uncore/gpio/*
#add wave -divider
#add wave -hex /testbench/dut/hart/ebu/*
#add wave -divider
#add wave -divider
# everything else
add wave -hex -r /testbench/*

View File

@ -67,7 +67,7 @@ module pmpadrdec (
// create a mask of which bits to ignore
generate
assign Mask[1:0] = 2'b11;
assign Mask[2] = ~CurrentPMPAdr[0] & (AdrMode == NAPOT); // mask has 0s in upper bis for NA4 region
assign Mask[2] = (AdrMode == NAPOT); // mask has 0s in upper bis for NA4 region
for (i=3; i < `PA_BITS; i=i+1)
assign Mask[i] = Mask[i-1] & CurrentPMPAdr[i-3]; // NAPOT mask: 1's indicate bits to ignore
endgenerate

View File

@ -76,6 +76,8 @@ module pmpchecker (
logic L_Bit, X_Bit, W_Bit, R_Bit;
logic InvalidExecute, InvalidWrite, InvalidRead;
// *** extend to optionally 64 configurations
assign {PMPCFG[15], PMPCFG[14], PMPCFG[13], PMPCFG[12],
PMPCFG[11], PMPCFG[10], PMPCFG[9], PMPCFG[8]} = PMPCFG23_REGW;
@ -107,6 +109,7 @@ module pmpchecker (
// Only enforce PMP checking for S and U modes when at least one PMP is active
assign EnforcePMP = |ActiveRegion;
// *** extend to up to 64, fold bit extraction to avoid need for binary encoding of region
always_comb
casez (Regions)
16'b???????????????1: MatchedRegion = 0;
@ -137,6 +140,7 @@ module pmpchecker (
assign InvalidWrite = WriteAccessM && ~W_Bit;
assign InvalidRead = ReadAccessM && ~R_Bit;
// *** don't cause faults when there are no PMPs
assign PMPInstrAccessFaultF = (PrivilegeModeW == `M_MODE) ?
Match && L_Bit && InvalidExecute :
EnforcePMP && InvalidExecute;