From 8f511aeaf38bc17d01c003ab10c61efbdaeddf66 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Tue, 9 Mar 2021 00:02:24 -0800 Subject: [PATCH] Add fragment to configure PMPs Surprisingly there is no existing fragment to do this defined in rocketchip. Add our own here. --- .../chipyard/src/main/scala/ConfigFragments.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/generators/chipyard/src/main/scala/ConfigFragments.scala b/generators/chipyard/src/main/scala/ConfigFragments.scala index 7ab26f15a1..cc245bafb6 100644 --- a/generators/chipyard/src/main/scala/ConfigFragments.scala +++ b/generators/chipyard/src/main/scala/ConfigFragments.scala @@ -151,6 +151,16 @@ class WithNPerfCounters(n: Int = 29) extends Config((site, here, up) => { } }) +class WithNPMPs(n: Int = 8) extends Config((site, here, up) => { + case TilesLocated(InSubsystem) => up(TilesLocated(InSubsystem), site) map { + case tp: RocketTileAttachParams => tp.copy(tileParams = tp.tileParams.copy( + core = tp.tileParams.core.copy(nPMPs = n))) + case tp: BoomTileAttachParams => tp.copy(tileParams = tp.tileParams.copy( + core = tp.tileParams.core.copy(nPMPs = n))) + case other => other + } +}) + class WithRocketICacheScratchpad extends Config((site, here, up) => { case RocketTilesKey => up(RocketTilesKey, site) map { r => r.copy(icache = r.icache.map(_.copy(itimAddr = Some(0x300000 + r.hartId * 0x10000))))