1
0

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

This commit is contained in:
Wesley W. Terpstra
2016-09-04 21:54:23 -07:00
parent 9f45212c95
commit cf0291061d
3 changed files with 4 additions and 5 deletions

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)
}