summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/LFSR16.scala
diff options
context:
space:
mode:
authorSchuyler Eldridge2019-05-09 20:13:54 -0400
committerGitHub2019-05-09 20:13:54 -0400
commite02d25c2d9310291a3084821713bd8d9b2325651 (patch)
tree82453617fec3957e33724eb3a0fd25dd060d803f /src/test/scala/chiselTests/LFSR16.scala
parent6be76f79f873873497e40fa647f9456391b4d59a (diff)
parent356d5c99c233540e4d993ccc365a7069d9d2beaa (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/LFSR16.scala')
-rw-r--r--src/test/scala/chiselTests/LFSR16.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/LFSR16.scala b/src/test/scala/chiselTests/LFSR16.scala
index 992bb4bf..d0f06865 100644
--- a/src/test/scala/chiselTests/LFSR16.scala
+++ b/src/test/scala/chiselTests/LFSR16.scala
@@ -51,10 +51,15 @@ class LFSRMaxPeriod(gen: => UInt) extends BasicTester {
val seed = withReset(!started) { RegInit(rv) }
val (_, wrap) = Counter(started, math.pow(2.0, rv.getWidth).toInt - 1)
+
when (rv === seed && started) {
chisel3.assert(wrap)
stop()
}
+
+ val last = RegNext(rv)
+ chisel3.assert(rv =/= last, "LFSR last value (0b%b) was equal to current value (0b%b)", rv, last)
+
}
/** Check that the output of the new LFSR is the same asthe old LFSR */