Only use powers of two masks, for now
This commit is contained in:
@@ -178,6 +178,9 @@ class MacroCompilerPass(mems: Option[Seq[Macro]],
|
|||||||
} else {
|
} else {
|
||||||
require(libPort.src.effectiveMaskGran == 1, "only single-bit mask supported for now")
|
require(libPort.src.effectiveMaskGran == 1, "only single-bit mask supported for now")
|
||||||
|
|
||||||
|
require(isPowerOfTwo(memPort.src.effectiveMaskGran), "only powers of two masks supported for now")
|
||||||
|
require(isPowerOfTwo(libPort.src.effectiveMaskGran), "only powers of two masks supported for now")
|
||||||
|
|
||||||
cat(((low to high) map (i => bits(WRef(mem), i / memPort.src.effectiveMaskGran))).reverse)
|
cat(((low to high) map (i => bits(WRef(mem), i / memPort.src.effectiveMaskGran))).reverse)
|
||||||
}
|
}
|
||||||
case None =>
|
case None =>
|
||||||
|
|||||||
@@ -93,4 +93,7 @@ object Utils {
|
|||||||
case Some(ActiveLow) | Some(NegativeEdge) => not(exp)
|
case Some(ActiveLow) | Some(NegativeEdge) => not(exp)
|
||||||
case _ => exp
|
case _ => exp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if a number is a power of two
|
||||||
|
def isPowerOfTwo(x: Int): Boolean = (x & (x - 1)) == 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user