1
0

tilelink2: Add support for different noise generator in fuzzer (#386)

This commit is contained in:
Jacob Chang 2016-10-06 13:20:13 -07:00 committed by Wesley W. Terpstra
parent 5980dc160f
commit fe641c14a1

View File

@ -80,7 +80,11 @@ object LFSRNoiseMaker {
class TLFuzzer( class TLFuzzer(
nOperations: Int, nOperations: Int,
inFlight: Int = 32, inFlight: Int = 32,
noiseMaker: (Int, Bool) => UInt = LFSRNoiseMaker.apply _) extends LazyModule noiseMaker: (Int, Bool, Int) => UInt = {
(wide: Int, increment: Bool, abs_values: Int) =>
LFSRNoiseMaker(wide=wide, increment=increment)
}
) extends LazyModule
{ {
val node = TLClientNode(TLClientParameters(sourceId = IdRange(0,inFlight))) val node = TLClientNode(TLClientParameters(sourceId = IdRange(0,inFlight)))
@ -135,14 +139,14 @@ class TLFuzzer(
// Increment random number generation for the following subfields // Increment random number generation for the following subfields
val inc = Wire(Bool()) val inc = Wire(Bool())
val inc_beat = Wire(Bool()) val inc_beat = Wire(Bool())
val arth_op_3 = noiseMaker(3, inc) val arth_op_3 = noiseMaker(3, inc, 0)
val arth_op = Mux(arth_op_3 > UInt(4), UInt(4), arth_op_3) val arth_op = Mux(arth_op_3 > UInt(4), UInt(4), arth_op_3)
val log_op = noiseMaker(2, inc) val log_op = noiseMaker(2, inc, 0)
val amo_size = UInt(2) + noiseMaker(1, inc) // word or dword val amo_size = UInt(2) + noiseMaker(1, inc, 0) // word or dword
val size = noiseMaker(sizeBits, inc) val size = noiseMaker(sizeBits, inc, 0)
val addr = noiseMaker(addressBits, inc) & ~UIntToOH1(size, addressBits) val addr = noiseMaker(addressBits, inc, 2) & ~UIntToOH1(size, addressBits)
val mask = noiseMaker(beatBytes, inc_beat) & edge.mask(addr, size) val mask = noiseMaker(beatBytes, inc_beat, 2) & edge.mask(addr, size)
val data = noiseMaker(dataBits, inc_beat) val data = noiseMaker(dataBits, inc_beat, 2)
// Actually generate specific TL messages when it is legal to do so // Actually generate specific TL messages when it is legal to do so
val (glegal, gbits) = edge.Get(src, addr, size) val (glegal, gbits) = edge.Get(src, addr, size)
@ -165,7 +169,7 @@ class TLFuzzer(
val legal_dest = edge.manager.containsSafe(addr) val legal_dest = edge.manager.containsSafe(addr)
// Pick a specific message to try to send // Pick a specific message to try to send
val a_type_sel = noiseMaker(3, inc) val a_type_sel = noiseMaker(3, inc, 0)
val legal = legal_dest && MuxLookup(a_type_sel, glegal, Seq( val legal = legal_dest && MuxLookup(a_type_sel, glegal, Seq(
UInt("b000") -> glegal, UInt("b000") -> glegal,