From 29e67279ba9980743e7c3ced5b83cba915d44a38 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Mon, 20 Mar 2017 15:05:15 -0700 Subject: [PATCH] add comments --- src/main/scala/rocket/PMP.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/scala/rocket/PMP.scala b/src/main/scala/rocket/PMP.scala index e0a90873..484b3fd2 100644 --- a/src/main/scala/rocket/PMP.scala +++ b/src/main/scala/rocket/PMP.scala @@ -94,9 +94,11 @@ class PMP(implicit p: Parameters) extends PMPReg { endsBeforeLower || beginsAfterUpper || (beginsAfterLower && endsBeforeUpper) } + // returns whether this PMP completely contains, or contains none of, a page def homogeneous(x: UInt, pgLevel: UInt, lgMaxSize: Int, prev: PMP): Bool = !cfg.p(0) || Mux(cfg.a(1), rangeHomogeneous(x, pgLevel, lgMaxSize, prev), pow2Homogeneous(x, pgLevel)) + // returns whether this matching PMP fully contains the access def aligned(x: UInt, lgSize: UInt, lgMaxSize: Int, prev: PMP): Bool = { val alignMask = ~(((BigInt(1) << lgMaxSize) - 1).U << lgSize)(lgMaxSize-1, 0) val rangeAligned = (prev.comparand(lgMaxSize-1, 0) & alignMask) === 0 && (comparand(lgMaxSize-1, 0) & alignMask) === 0 @@ -104,6 +106,7 @@ class PMP(implicit p: Parameters) extends PMPReg { Mux(cfg.a(1), rangeAligned, pow2Aligned) } + // returns whether this PMP matches at least one byte of the access def hit(x: UInt, lgSize: UInt, lgMaxSize: Int, prev: PMP): Bool = cfg.p(0) && Mux(cfg.a(1), rangeMatch(x, lgSize, lgMaxSize, prev), pow2Match(x, lgSize, lgMaxSize)) }