1
0

Support corner cases in TLBPermissions

Don't crap out if the yes-set or no-set is empty.
This commit is contained in:
Andrew Waterman 2017-03-11 19:29:25 -08:00
parent 90b5cc96cb
commit 2d267b4940

View File

@ -70,9 +70,9 @@ object TLBPageLookup
def simplify(x: Seq[AddressSet]) = AddressSet.unify(x.map(_.widen(~decisionMask)).distinct) def simplify(x: Seq[AddressSet]) = AddressSet.unify(x.map(_.widen(~decisionMask)).distinct)
val (yesf, nof) = (simplify(yes), simplify(no)) val (yesf, nof) = (simplify(yes), simplify(no))
if (yesf.size < no.size) { if (yesf.size < no.size) {
(x: UInt) => yesf.map(_.contains(x)).reduce(_ || _) (x: UInt) => yesf.map(_.contains(x)).foldLeft(false.B)(_ || _)
} else { } else {
(x: UInt) => !nof.map(_.contains(x)).reduce(_ || _) (x: UInt) => !nof.map(_.contains(x)).foldLeft(false.B)(_ || _)
} }
} }
@ -86,7 +86,7 @@ object TLBPageLookup
val homo = AddressSet.unify(grouped.values.flatten.toList) val homo = AddressSet.unify(grouped.values.flatten.toList)
(x: UInt) => TLBPermissions( (x: UInt) => TLBPermissions(
homogeneous = homo.map(_.contains(x)).reduce(_ || _), homogeneous = homo.map(_.contains(x)).foldLeft(false.B)(_ || _),
r = rfn(x), r = rfn(x),
w = wfn(x), w = wfn(x),
x = xfn(x), x = xfn(x),