Incorrect pmp NA4/NAPOT address matching
#875 seems to have introduced an issue with NA4/NAPOT address matching modes - the scenario is as follows.
In my test, csr_pmp_addr[3] is 0x8000_3f54 with its corresponding configuration bits csr_pmp_cfg[3] set to {0, PMP_MODE_NA4, 0, 1, 1}, and the core requests an instruction fetch from pmp_req_addr_i[0] = 0x8000_3f54. Note that since we are using NA4 mode, region_start_addr[3] = 0x8000_3f54 and region_addr_mask[3] = 0xffff_ffff. We are also using a granularity of 0.
With this setup, we should expect that the requested instruction fetch should match pmpaddr3 but then then fail due to a fetch error since the corresponding access bit is disabled.
However, region_match_low[0][3] goes high as expected since
pmp_req_addr_i[0][33:2] >= region_start_addr[3][33:2],
but region_match_high[0][3] stays low since the check
pmp_req_addr_i[0][33:2] < csr_pmp_addr[3][33:2] will fail due to lack of equality checking - this causes an altogether mismatch with this PMP region.
I think we still need to include equality checking to cover NA4 and NAPOT matching (as the error I describe above can also easily occur in NAPOT mode with any granularity), but these equality checks should only be enabled when we are in one of those two modes.
Thanks @udinator - I was trying to be (too) clever and avoid the extra equality matching by using address masking. I think this still works for NA4 if the mask is set up correctly. I'll push a proposed fix as a PR and hopefully you can run some testing on it to confirm.