aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJim Lawson2017-01-29 14:05:13 -0800
committerJack Koenig2017-01-29 14:05:13 -0800
commitbb389aa69f0b6a99c3daecbf02e4df1e303ec636 (patch)
tree8140e82d465dbb20c278f043e594a75bcd5ee5e6 /src/test
parent7240b4f6590413d4c4fd4e0324bbd440ae783388 (diff)
Keep firrtl's simulation environment in sync with chisel's. (#425)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/resources/top.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/resources/top.cpp b/src/test/resources/top.cpp
index 08ad42fa..ba27c917 100644
--- a/src/test/resources/top.cpp
+++ b/src/test/resources/top.cpp
@@ -7,6 +7,13 @@
# include <verilated_vcd_c.h> // Trace file format header
#endif
+// Override Verilator definition so first $finish ends simulation
+// Note: VL_USER_FINISH needs to be defined when compiling Verilator code
+void vl_finish(const char* filename, int linenum, const char* hier) {
+ Verilated::flushCall();
+ exit(0);
+}
+
using namespace std;
//VGCDTester *top;
@@ -61,6 +68,7 @@ int main(int argc, char** argv) {
if (main_time >= timeout) {
cout << "Assertion failed! Simulation terminated by timeout at time " << main_time <<
" (cycle " << main_time / 10 << ")"<< endl;
+ return -1;
} else {
cout << "Simulation completed at time " << main_time <<
" (cycle " << main_time / 10 << ")"<< endl;