Hi,
I would like to understand how the physical memory protection is implemented on Boom.
I compiled SmallBoomV3 and SmallBoomV4 with the default setup and then tried to access PMP CSRs to change the configuration. According to RISC-V manual (Volumne II Privileged Architecture Version 20240411), (i) Implementations may implement zero, 16, or 64 PMP entries, and (ii) RV64 processors have eight even-numbered CSRs (pmpcfg0, ..., pmpcfg14). Then, I wrote a test to access eight CSRs. However, I can only access part of them (pmpcfg0,13,14). I run the same test on Spike, which works as stated in the manual (pmpcfg0,2) if only 16 entries are implemented.
I also checked the parameters.scala of v3 and v4. The nPMPs is set up by 8.
I have attached the source code, which is compiled in baremetal mode. Please let me know if I made any mistakes.
Thank you very much!
Chen
Commit version: Chipyard 1.13.0
Output from BoomV3:
Initial PMP Configurations:
pmpcfg0: 0x03000301
pmpcfg1: 0x00000000
pmpcfg2: 0x00000000
pmpcfg3: 0x00000000
pmpcfg4: 0x00000000
pmpcfg5: 0x00000000
pmpcfg6: 0x00000000
pmpcfg7: 0x00000000
pmpcfg8: 0x00000000
pmpcfg9: 0x00000000
pmpcfg10: 0x80003390
pmpcfg11: 0x00000000
pmpcfg12: 0x80002668
pmpcfg13: 0x00000000
pmpcfg14: 0x00000000
pmpcfg15: 0x00000000
Updated PMP Configurations:
Updated pmpcfg0: 0x0000000f
Updated pmpcfg1: 0x00000000
Updated pmpcfg2: 0x00000000
Updated pmpcfg3: 0x00000000
Updated pmpcfg4: 0x00000000
Updated pmpcfg5: 0x00000000
Updated pmpcfg6: 0x00000000
Updated pmpcfg7: 0x00000000
Updated pmpcfg8: 0x00000000
Updated pmpcfg9: 0x00000000
Updated pmpcfg10: 0x80003390
Updated pmpcfg11: 0x00000000
Updated pmpcfg12: 0x80002bd0
Updated pmpcfg13: 0x0000000f
Updated pmpcfg14: 0x0000000f
Updated pmpcfg15: 0x00000000
Output from Spike:
Initial PMP Configurations:
pmpcfg0: 0x0000001f
pmpcfg1: 0x00000000
pmpcfg2: 0x00000000
pmpcfg3: 0x00000000
pmpcfg4: 0x00000000
pmpcfg5: 0x00000000
pmpcfg6: 0x00000000
pmpcfg7: 0x00000000
pmpcfg8: 0x00000000
pmpcfg9: 0x00000000
pmpcfg10: 0x00000000
pmpcfg11: 0x00000000
pmpcfg12: 0x80002668
pmpcfg13: 0x00000000
pmpcfg14: 0x00000000
pmpcfg15: 0x00000000
Updated PMP Configurations:
Updated pmpcfg0: 0x0000000f
Updated pmpcfg1: 0x00000000
Updated pmpcfg2: 0x0000000f
Updated pmpcfg3: 0x00000000
Updated pmpcfg4: 0x00000000
Updated pmpcfg5: 0x00000000
Updated pmpcfg6: 0x00000000
Updated pmpcfg7: 0x00000000
Updated pmpcfg8: 0x00000000
Updated pmpcfg9: 0x00000000
Updated pmpcfg10: 0x00000000
Updated pmpcfg11: 0x00000000
Updated pmpcfg12: 0x80002b94
Updated pmpcfg13: 0x00000000
Updated pmpcfg14: 0x00000000
Updated pmpcfg15: 0x00000000