pmp0cfg = if ((CSR[pmpcfg0].pmp0cfg & 0x80) == 0) {
# entry is not locked
if (!(((csr_value.pmp0cfg & 0x1) == 0) && ((csr_value.pmp0cfg & 0x2) == 0x2))) {
# not R = 0, W =1, which is reserved
if ((PMP_GRANULARITY < 2) ||
((csr_value.pmp0cfg & 0x18) != 0x10)) {
# NA4 is not allowed when PMP granularity is larger than 4 bytes
return csr_value.pmp0cfg;
}
}
}
# fall through: keep old value
return CSR[pmpcfg0].pmp0cfg;
pmp1cfg = if ((CSR[pmpcfg0].pmp1cfg & 0x80) == 0) {
# entry is not locked
if (!(((csr_value.pmp1cfg & 0x1) == 0) && ((csr_value.pmp1cfg & 0x2) == 0x2))) {
# not R = 0, W =1, which is reserved
if ((PMP_GRANULARITY < 2) ||
((csr_value.pmp1cfg & 0x18) != 0x10)) {
# NA4 is not allowed when PMP granularity is larger than 4 bytes
return csr_value.pmp1cfg;
}
}
}
# fall through: keep old value
return CSR[pmpcfg0].pmp1cfg;
pmp2cfg = if ((CSR[pmpcfg0].pmp2cfg & 0x80) == 0) {
# entry is not locked
if (!(((csr_value.pmp2cfg & 0x1) == 0) && ((csr_value.pmp2cfg & 0x2) == 0x2))) {
# not R = 0, W =1, which is reserved
if ((PMP_GRANULARITY < 2) ||
((csr_value.pmp2cfg & 0x18) != 0x10)) {
# NA4 is not allowed when PMP granularity is larger than 4 bytes
return csr_value.pmp2cfg;
}
}
}
# fall through: keep old value
return CSR[pmpcfg0].pmp2cfg;
pmp3cfg = if ((CSR[pmpcfg0].pmp3cfg & 0x80) == 0) {
# entry is not locked
if (!(((csr_value.pmp3cfg & 0x1) == 0) && ((csr_value.pmp3cfg & 0x2) == 0x2))) {
# not R = 0, W =1, which is reserved
if ((PMP_GRANULARITY < 2) ||
((csr_value.pmp3cfg & 0x18) != 0x10)) {
# NA4 is not allowed when PMP granularity is larger than 4 bytes
return csr_value.pmp3cfg;
}
}
}
# fall through: keep old value
return CSR[pmpcfg0].pmp3cfg;
pmp4cfg = if ((CSR[pmpcfg0].pmp4cfg & 0x80) == 0) {
# entry is not locked
if (!(((csr_value.pmp4cfg & 0x1) == 0) && ((csr_value.pmp4cfg & 0x2) == 0x2))) {
# not R = 0, W =1, which is reserved
if ((PMP_GRANULARITY < 2) ||
((csr_value.pmp4cfg & 0x18) != 0x10)) {
# NA4 is not allowed when PMP granularity is larger than 4 bytes
return csr_value.pmp4cfg;
}
}
}
# fall through: keep old value
return CSR[pmpcfg0].pmp4cfg;
pmp5cfg = if ((CSR[pmpcfg0].pmp5cfg & 0x80) == 0) {
# entry is not locked
if (!(((csr_value.pmp5cfg & 0x1) == 0) && ((csr_value.pmp5cfg & 0x2) == 0x2))) {
# not R = 0, W =1, which is reserved
if ((PMP_GRANULARITY < 2) ||
((csr_value.pmp5cfg & 0x18) != 0x10)) {
# NA4 is not allowed when PMP granularity is larger than 4 bytes
return csr_value.pmp5cfg;
}
}
}
# fall through: keep old value
return CSR[pmpcfg0].pmp5cfg;
pmp6cfg = if ((CSR[pmpcfg0].pmp6cfg & 0x80) == 0) {
# entry is not locked
if (!(((csr_value.pmp6cfg & 0x1) == 0) && ((csr_value.pmp6cfg & 0x2) == 0x2))) {
# not R = 0, W =1, which is reserved
if ((PMP_GRANULARITY < 2) ||
((csr_value.pmp6cfg & 0x18) != 0x10)) {
# NA4 is not allowed when PMP granularity is larger than 4 bytes
return csr_value.pmp6cfg;
}
}
}
# fall through: keep old value
return CSR[pmpcfg0].pmp6cfg;
pmp7cfg = if ((CSR[pmpcfg0].pmp7cfg & 0x80) == 0) {
# entry is not locked
if (!(((csr_value.pmp7cfg & 0x1) == 0) && ((csr_value.pmp7cfg & 0x2) == 0x2))) {
# not R = 0, W =1, which is reserved
if ((PMP_GRANULARITY < 2) ||
((csr_value.pmp7cfg & 0x18) != 0x10)) {
# NA4 is not allowed when PMP granularity is larger than 4 bytes
return csr_value.pmp7cfg;
}
}
}
# fall through: keep old value
return CSR[pmpcfg0].pmp7cfg;