diff options
| author | Andrew Waterman | 2019-05-10 01:36:41 -0700 |
|---|---|---|
| committer | edwardcwang | 2019-05-10 07:07:35 -0700 |
| commit | 9af531c3e46e3ce39b543b73f62b7deae6bdd9c7 (patch) | |
| tree | 67f1752190b5c4ff39895bffb215e981e4154766 /src/test | |
| parent | af90047db4f5507c5faf4b1e205c4eb8e5975646 (diff) | |
Augment LFSR16 test to test the enable as well
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/chiselTests/LFSR16.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/test/scala/chiselTests/LFSR16.scala b/src/test/scala/chiselTests/LFSR16.scala index d0f06865..a49d9722 100644 --- a/src/test/scala/chiselTests/LFSR16.scala +++ b/src/test/scala/chiselTests/LFSR16.scala @@ -62,19 +62,22 @@ class LFSRMaxPeriod(gen: => UInt) extends BasicTester { } -/** Check that the output of the new LFSR is the same asthe old LFSR */ +/** Check that the output of the new LFSR is the same as the old LFSR */ class MeetTheNewLFSR16SameAsTheOldLFSR16 extends BasicTester { + val en = Counter(2).value.asBool /** This is the exact implementation of the old LFSR16 algorithm */ val oldLfsr = { val width = 16 val lfsr = RegInit(1.U(width.W)) - lfsr := Cat(lfsr(0)^lfsr(2)^lfsr(3)^lfsr(5), lfsr(width-1,1)) + when (en) { + lfsr := Cat(lfsr(0)^lfsr(2)^lfsr(3)^lfsr(5), lfsr(width-1,1)) + } lfsr } /** The new LFSR16 uses equivalent taps and a reverse so that it can use LFSR(16) under the hood. */ - val newLfsr = LFSR16() + val newLfsr = LFSR16(en) val (_, done) = Counter(true.B, 16) |
