From 06df5adfd78061aa5ae7567882fb8c42d7260a46 Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Tue, 10 Jan 2017 17:18:09 -0800 Subject: Make stop() immediately end simulation for Verilator tests (#434) --- src/test/scala/chiselTests/Stop.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/test/scala/chiselTests/Stop.scala') 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 } + } } -- cgit v1.2.3