1
0

Fuzzer: use different LFSR seeds based on simulator seed

This commit is contained in:
Wesley W. Terpstra 2017-03-11 02:53:11 -08:00
parent bb6108abd5
commit d2da33e4b1

View File

@ -34,16 +34,11 @@ class IDMapGenerator(numIds: Int) extends Module {
object LFSR64
{
private var counter = 0
private def next: Int = {
counter += 1
counter
}
def apply(increment: Bool = Bool(true), seed: Int = next): UInt =
def apply(increment: Bool = Bool(true)): UInt =
{
val wide = 64
val lfsr = RegInit(UInt((seed * 0xDEADBEEFCAFEBAB1L) >>> 1, width = wide))
val undef = Reg(UInt(width = wide)) // random value based on simulation seed
val lfsr = RegInit(Mux(undef === UInt(0), UInt(1), undef))
val xor = lfsr(0) ^ lfsr(1) ^ lfsr(3) ^ lfsr(4)
when (increment) { lfsr := Cat(xor, lfsr(wide-1,1)) }
lfsr