diff options
| author | Schuyler Eldridge | 2019-05-09 20:13:54 -0400 |
|---|---|---|
| committer | GitHub | 2019-05-09 20:13:54 -0400 |
| commit | e02d25c2d9310291a3084821713bd8d9b2325651 (patch) | |
| tree | 82453617fec3957e33724eb3a0fd25dd060d803f /src/test/scala/chiselTests/util/random/LFSRSpec.scala | |
| parent | 6be76f79f873873497e40fa647f9456391b4d59a (diff) | |
| parent | 356d5c99c233540e4d993ccc365a7069d9d2beaa (diff) | |
Merge pull request #1092 from freechipsproject/lfsr-async-reset
LFSR/PRNG Asynchronous Safety, Use Vec[Bool] to store internal state
Diffstat (limited to 'src/test/scala/chiselTests/util/random/LFSRSpec.scala')
| -rw-r--r-- | src/test/scala/chiselTests/util/random/LFSRSpec.scala | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/test/scala/chiselTests/util/random/LFSRSpec.scala b/src/test/scala/chiselTests/util/random/LFSRSpec.scala index 5aedca75..ce0abf69 100644 --- a/src/test/scala/chiselTests/util/random/LFSRSpec.scala +++ b/src/test/scala/chiselTests/util/random/LFSRSpec.scala @@ -12,7 +12,7 @@ import chiselTests.{ChiselFlatSpec, LFSRDistribution, LFSRMaxPeriod} import math.pow class FooLFSR(val reduction: LFSRReduce, seed: Option[BigInt]) extends PRNG(4, seed) with LFSR { - def delta(s: UInt): UInt = s + def delta(s: Seq[Bool]): Seq[Bool] = s } /** This tests that after reset an LFSR is not locked up. This manually sets the seed of the LFSR at run-time to the @@ -30,20 +30,18 @@ class LFSRResetTester(gen: => LFSR, lockUpValue: BigInt) extends BasicTester { val (count, done) = Counter(true.B, 5) - printf("%d: 0b%b\n", count, lfsr.io.out) - lfsr.io.seed.valid := count === 1.U - lfsr.io.seed.bits := lockUpValue.U + lfsr.io.seed.bits := lockUpValue.U(lfsr.width.W).asBools lfsr.io.increment := true.B when (count === 2.U) { - assert(lfsr.io.out === lockUpValue.U, "LFSR is NOT locked up, but should be!") + assert(lfsr.io.out.asUInt === lockUpValue.U, "LFSR is NOT locked up, but should be!") } lfsr.reset := count === 3.U when (count === 4.U) { - assert(lfsr.io.out =/= lockUpValue.U, "LFSR is locked up, but should not be after reset!") + assert(lfsr.io.out.asUInt =/= lockUpValue.U, "LFSR is locked up, but should not be after reset!") } when (done) { |
