From e8ed450f13ac3e9f5141a7e33bf2d1740f180e98 Mon Sep 17 00:00:00 2001 From: "Wesley W. Terpstra" Date: Mon, 30 Oct 2017 15:01:17 -0700 Subject: [PATCH] unit tests: do not use LFSR16 which has a common seed! We want each LFSR to generate independent noise. --- src/main/scala/amba/ahb/SRAM.scala | 3 ++- src/main/scala/amba/apb/SRAM.scala | 5 +++-- src/main/scala/tilelink/Delayer.scala | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/scala/amba/ahb/SRAM.scala b/src/main/scala/amba/ahb/SRAM.scala index 8c9fbab7..3a553766 100644 --- a/src/main/scala/amba/ahb/SRAM.scala +++ b/src/main/scala/amba/ahb/SRAM.scala @@ -6,6 +6,7 @@ import Chisel._ import freechips.rocketchip.config.Parameters import freechips.rocketchip.diplomacy._ import freechips.rocketchip.util._ +import freechips.rocketchip.tilelink.LFSRNoiseMaker class AHBRAM( address: AddressSet, @@ -92,7 +93,7 @@ class AHBRAM( when (a_request) { d_request := Bool(true) } // Finally, the outputs - in.hreadyout := (if(fuzzHreadyout) { !d_request || LFSR16(Bool(true))(0) } else { Bool(true) }) + in.hreadyout := (if(fuzzHreadyout) { !d_request || LFSRNoiseMaker(1)(0) } else { Bool(true) }) in.hresp := Mux(d_legal || !in.hreadyout, AHBParameters.RESP_OKAY, AHBParameters.RESP_ERROR) in.hrdata := Mux(in.hreadyout, muxdata.asUInt, UInt(0)) } diff --git a/src/main/scala/amba/apb/SRAM.scala b/src/main/scala/amba/apb/SRAM.scala index b9063195..4ac832c3 100644 --- a/src/main/scala/amba/apb/SRAM.scala +++ b/src/main/scala/amba/apb/SRAM.scala @@ -6,6 +6,7 @@ import Chisel._ import freechips.rocketchip.config.Parameters import freechips.rocketchip.diplomacy._ import freechips.rocketchip.util._ +import freechips.rocketchip.tilelink.LFSRNoiseMaker class APBRAM( address: AddressSet, @@ -39,8 +40,8 @@ class APBRAM( mem.write(paddr, Vec.tabulate(beatBytes) { i => in.pwdata(8*(i+1)-1, 8*i) }, in.pstrb.toBools) } - in.pready := Bool(!fuzzReady) || LFSR16(!in.penable)(0) - in.pslverr := RegEnable(!legal, !in.penable) || (Bool(fuzzError) && LFSR16(Bool(true))(0)) + in.pready := Bool(!fuzzReady) || LFSRNoiseMaker(1)(0) + in.pslverr := RegEnable(!legal, !in.penable) || (Bool(fuzzError) && LFSRNoiseMaker(1)(0)) in.prdata := mem.readAndHold(paddr, read).asUInt } } diff --git a/src/main/scala/tilelink/Delayer.scala b/src/main/scala/tilelink/Delayer.scala index 1f2d256c..11f75c05 100644 --- a/src/main/scala/tilelink/Delayer.scala +++ b/src/main/scala/tilelink/Delayer.scala @@ -14,7 +14,7 @@ class TLDelayer(q: Double)(implicit p: Parameters) extends LazyModule lazy val module = new LazyModuleImp(this) { def feed[T <: Data](sink: DecoupledIO[T], source: DecoupledIO[T], noise: T) { - val allow = UInt((q * 65535.0).toInt) <= LFSR16(source.valid) + val allow = UInt((q * 65535.0).toInt) <= LFSRNoiseMaker(16, source.valid) sink.valid := source.valid && allow source.ready := sink.ready && allow sink.bits := source.bits