feat(pmp): extend to 64 entries with configurable NUM_ENTRIES#51
Merged
Conversation
Add a `size_t NUM_ENTRIES = 64` non-type template parameter to `pmp<PLAT>` so the number of PMP entries is set at instantiation time with no runtime overhead. The default of 64 matches the RISC-V Privileged Architecture Spec v20260120. Passing a smaller value (e.g. 8) models a core that implements fewer hardware PMP entries. New rv64gc_mp_8 ISA variant (8 entries): - vm_rv64gc_mp.cpp: add rv64gc_mp_8_hart struct and register "rv64gc_mp_8:interp" with core_factory (standalone riscv-sim) - register_cores.cpp: register "rv64gc_mp_8:interp" with iss_factory (SystemC VP / core_complex) Firmware tests (contrib/fw/): - pmp-64entry-addr-test: write/read pmpaddr32 (CSR 0x3D0); confirms entries 16-63 are accessible - pmp-64entry-cfg-test: write/read/clear pmpcfg4 (CSR 0x3A4, entries 32-39 on RV64); confirms persistence - pmp-8entry-guard-test: configure entry 0 deny region and expect load-access fault using rv64gc_mp_8; confirms enforcement still works with the 8-entry window
eyck
approved these changes
May 15, 2026
Contributor
eyck
left a comment
There was a problem hiding this comment.
LGTM
I'm not a fan of the hard-coded parameters. But as long as we do not have a generic mechanism to pass parameters, it is the only way to do it.
Contributor
|
@cphurley82 Many THX |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a
size_t NUM_ENTRIES = 64non-type template parameter topmp<PLAT>so the number of PMP entries is set at instantiation time with no runtime overhead. The default of 64 matches the RISC-V Privileged Architecture Spec v20260120. Passing a smaller value (e.g. 8) models a core that implements fewer hardware PMP entries.New rv64gc_mp_8 ISA variant (8 entries):
Firmware tests (contrib/fw/):