diff options
| author | Jack Koenig | 2017-01-10 17:18:09 -0800 |
|---|---|---|
| committer | GitHub | 2017-01-10 17:18:09 -0800 |
| commit | 06df5adfd78061aa5ae7567882fb8c42d7260a46 (patch) | |
| tree | 39b070505c95fd89e7a88eb64009d9b1468ef7a3 /src/test/scala/chiselTests/Stop.scala | |
| parent | 22b9beefd6ddc358f1573a305ed9b498634c6d23 (diff) | |
Make stop() immediately end simulation for Verilator tests (#434)
Diffstat (limited to 'src/test/scala/chiselTests/Stop.scala')
| -rw-r--r-- | src/test/scala/chiselTests/Stop.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/Stop.scala b/src/test/scala/chiselTests/Stop.scala index 4afb077a..1c2d390d 100644 --- a/src/test/scala/chiselTests/Stop.scala +++ b/src/test/scala/chiselTests/Stop.scala @@ -10,8 +10,21 @@ class StopTester() extends BasicTester { stop() } +class StopImmediatelyTester extends BasicTester { + val cycle = Reg(init = 0.asUInt(4.W)) + cycle := cycle + 1.U + when (cycle === 4.U) { + stop() + } + assert(cycle =/= 5.U, "Simulation did not exit upon executing stop()") +} + class StopSpec extends ChiselFlatSpec { "stop()" should "stop and succeed the testbench" in { assertTesterPasses { new StopTester } } + + it should "end the simulation immediately" in { + assertTesterPasses { new StopImmediatelyTester } + } } |
