1
0

apb: inject fuzzy errors

This commit is contained in:
Wesley W. Terpstra 2017-10-30 14:00:53 -07:00
parent 0280a1f218
commit ec70e5fb02
2 changed files with 7 additions and 4 deletions

View File

@ -12,7 +12,9 @@ class APBRAM(
executable: Boolean = true,
beatBytes: Int = 4,
devName: Option[String] = None,
errors: Seq[AddressSet] = Nil)
errors: Seq[AddressSet] = Nil,
fuzzReady: Boolean = false,
fuzzError: Boolean = false)
(implicit p: Parameters) extends DiplomaticSRAM(address, beatBytes, devName)
{
val node = APBSlaveNode(Seq(APBSlavePortParameters(
@ -37,8 +39,8 @@ class APBRAM(
mem.write(paddr, Vec.tabulate(beatBytes) { i => in.pwdata(8*(i+1)-1, 8*i) }, in.pstrb.toBools)
}
in.pready := Bool(true)
in.pslverr := RegNext(!legal)
in.pready := Bool(!fuzzReady) || LFSR16(!in.penable)(0)
in.pslverr := RegEnable(!legal, !in.penable) || (Bool(fuzzError) && LFSR16(Bool(true))(0))
in.prdata := mem.readAndHold(paddr, read).asUInt
}
}

View File

@ -21,7 +21,7 @@ class APBFuzzBridge(aFlow: Boolean, txns: Int)(implicit p: Parameters) extends L
val fuzz = LazyModule(new TLFuzzer(txns))
val model = LazyModule(new TLRAMModel("APBFuzzMaster"))
val xbar = LazyModule(new APBFanout)
val ram = LazyModule(new APBRAM(AddressSet(0x0, 0xff)))
val ram = LazyModule(new APBRAM(AddressSet(0x0, 0xff), fuzzReady = true, fuzzError = true))
val gpio = LazyModule(new RRTest0(0x100))
ram.node := xbar.node
@ -31,6 +31,7 @@ class APBFuzzBridge(aFlow: Boolean, txns: Int)(implicit p: Parameters) extends L
:= TLDelayer(0.2)
:= TLBuffer(BufferParams.flow)
:= TLDelayer(0.2)
:= TLFragmenter(4, 8)
:= model.node
:= fuzz.node)