// See LICENSE.SiFive for license details. package freechips.rocketchip import chisel3.internal.sourceinfo.{SourceInfo, SourceLine, UnlocatableSourceInfo} package object diplomacy { def sourceLine(sourceInfo: SourceInfo, prefix: String = " (", suffix: String = ")") = sourceInfo match { case SourceLine(filename, line, col) => s"$prefix$filename:$line:$col$suffix" case _ => "" } def bitIndexes(x: BigInt, tail: Seq[Int] = Nil): Seq[Int] = { require (x >= 0) if (x == 0) { tail.reverse } else { val lowest = x.lowestSetBit bitIndexes(x.clearBit(lowest), lowest +: tail) } } }