diff options
| author | Adam Izraelevitz | 2017-01-11 11:42:16 -0800 |
|---|---|---|
| committer | GitHub | 2017-01-11 11:42:16 -0800 |
| commit | 514eadb99e6715e161c73f487347872eed004230 (patch) | |
| tree | 0099c332f9a629a0b41eb3680f6c493e18bf57ca /src/test/scala | |
| parent | 8a63d43762afdbdd17c04faf01201181c1eb9a8d (diff) | |
| parent | 06df5adfd78061aa5ae7567882fb8c42d7260a46 (diff) | |
Merge branch 'master' into fixedPointFromBits
Diffstat (limited to 'src/test/scala')
| -rw-r--r-- | src/test/scala/chiselTests/Harness.scala | 5 | ||||
| -rw-r--r-- | src/test/scala/chiselTests/Stop.scala | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/Harness.scala b/src/test/scala/chiselTests/Harness.scala index 83f60391..8a12cd7b 100644 --- a/src/test/scala/chiselTests/Harness.scala +++ b/src/test/scala/chiselTests/Harness.scala @@ -43,6 +43,11 @@ int main(int argc, char **argv, char **env) { delete top; exit(0); } + +void vl_finish(const char* filename, int linenum, const char* hier) { + Verilated::flushCall(); + exit(0); +} """, ".cpp") _ /** Compiles a C++ emulator from Verilog and returns the path to the 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 } + } } |
