1
0

tilelink2 Fuzzer: work around for firrtl/verilator performance issue

Big Vec()s cause very slow compilation.
This commit is contained in:
Wesley W. Terpstra
2016-09-22 11:33:40 -07:00
parent 1e7480b6fc
commit ed038678ef
2 changed files with 16 additions and 11 deletions

View File

@ -10,6 +10,12 @@ package object tilelink2
def OH1ToUInt(x: UInt) = OHToUInt((x << 1 | UInt(1)) ^ x)
def UIntToOH1(x: UInt, width: Int) = ~(SInt(-1, width=width).asUInt << x)(width-1, 0)
def trailingZeros(x: Int) = if (x > 0) Some(log2Ceil(x & -x)) else None
def highOR(x: UInt) = {
val w = x.getWidth
def helper(s: Int, x: UInt): UInt =
if (s >= w) x else helper(s+s, x | x << s)
helper(1, x)
}
def sourceLine(sourceInfo: SourceInfo, prefix: String = " (", suffix: String = ")") = sourceInfo match {
case SourceLine(filename, line, col) => s"$prefix$filename:$line:$col$suffix"