1
0

tilelink2 SourceShrinker: a concurrency reducing adapter

This commit is contained in:
Wesley W. Terpstra
2016-11-22 21:20:26 -08:00
parent 0097274ea3
commit c0b27999ea
3 changed files with 80 additions and 1 deletions

View File

@ -13,6 +13,7 @@ package object tilelink2
def OH1ToOH(x: UInt) = (x << 1 | UInt(1)) & ~Cat(UInt(0, width=1), x)
def OH1ToUInt(x: UInt) = OHToUInt(OH1ToOH(x))
def UIntToOH1(x: UInt, width: Int) = ~(SInt(-1, width=width).asUInt << x)(width-1, 0)
def holdUnless[T <: Data](in : T, enable: Bool): T = Mux(!enable, RegEnable(in, enable), in)
def trailingZeros(x: Int) = if (x > 0) Some(log2Ceil(x & -x)) else None
// Fill 1s from low bits to high bits
def leftOR(x: UInt) = {