-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3568 from chipsalliance/pmas
Modularize PMA-checking functionality
- Loading branch information
Showing
2 changed files
with
61 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// See LICENSE.SiFive for license details. | ||
// See LICENSE.Berkeley for license details. | ||
|
||
package freechips.rocketchip.rocket | ||
|
||
import chisel3._ | ||
import chisel3.util._ | ||
|
||
import org.chipsalliance.cde.config.{Field, Parameters} | ||
import freechips.rocketchip.subsystem.CacheBlockBytes | ||
import freechips.rocketchip.diplomacy.RegionType | ||
import freechips.rocketchip.tile.{CoreModule, CoreBundle} | ||
import freechips.rocketchip.tilelink._ | ||
import freechips.rocketchip.util._ | ||
import freechips.rocketchip.util.property | ||
import freechips.rocketchip.devices.debug.DebugModuleKey | ||
import chisel3.experimental.SourceInfo | ||
|
||
class PMAChecker(manager: TLSlavePortParameters)(implicit p: Parameters) extends CoreModule()(p) { | ||
val io = IO(new Bundle { | ||
val paddr = Input(UInt()) | ||
|
||
val resp = Output(new Bundle { | ||
val cacheable = Bool() | ||
val r = Bool() | ||
val w = Bool() | ||
val pp = Bool() | ||
val al = Bool() | ||
val aa = Bool() | ||
val x = Bool() | ||
val eff = Bool() | ||
}) | ||
}) | ||
|
||
// PMA | ||
// check exist a slave can consume this address. | ||
val legal_address = manager.findSafe(io.paddr).reduce(_||_) | ||
// check utility to help check SoC property. | ||
def fastCheck(member: TLManagerParameters => Boolean) = | ||
legal_address && manager.fastProperty(io.paddr, member, (b:Boolean) => b.B) | ||
|
||
io.resp.cacheable := fastCheck(_.supportsAcquireB) | ||
io.resp.r := fastCheck(_.supportsGet) | ||
io.resp.w := fastCheck(_.supportsPutFull) | ||
io.resp.pp := fastCheck(_.supportsPutPartial) | ||
io.resp.al := fastCheck(_.supportsLogical) | ||
io.resp.aa := fastCheck(_.supportsArithmetic) | ||
io.resp.x := fastCheck(_.executable) | ||
io.resp.eff := fastCheck(Seq(RegionType.PUT_EFFECTS, RegionType.GET_EFFECTS) contains _.regionType) | ||
} |
This file contains 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