tilelink2: fix a bug in UIntToOH1 triggered if the size was too big

This commit is contained in:
Wesley W. Terpstra committed 2016-09-05 20:58:41 -07:00
1 parent 9f45212c95
commit cf0291061d
3 files changed
+4 -5

No files matched your search

+1 -2
View File
@@ -12,8 +12,7 @@ class TLEdge(
{
def isAligned(address: UInt, lgSize: UInt) =
if (maxLgSize == 0) Bool(true) else {
val ones = UInt((1 << maxLgSize) - 1)
val mask = (ones << lgSize)(maxLgSize*2-1, maxLgSize)
val mask = ~(SInt(-1, width=maxLgSize).asUInt << lgSize)(maxLgSize-1, 0)
(address & mask) === UInt(0)
}