diff --git a/riscv/sim.cc b/riscv/sim.cc index 4d61555d..c800e877 100644 --- a/riscv/sim.cc +++ b/riscv/sim.cc @@ -72,7 +72,7 @@ reg_t sim_t::get_scr(int which) } } -void sim_t::run() +int sim_t::run() { while (htif->tick()) { @@ -81,6 +81,7 @@ void sim_t::run() else step(INTERLEAVE); } + return htif->exit_code(); } void sim_t::step(size_t n) diff --git a/riscv/sim.h b/riscv/sim.h index e827087e..34ed6e8a 100644 --- a/riscv/sim.h +++ b/riscv/sim.h @@ -19,7 +19,7 @@ public: ~sim_t(); // run the simulation to completion - void run(); + int run(); bool running(); void stop(); void set_debug(bool value); diff --git a/riscv/spike.cc b/riscv/spike.cc index fb2b7da1..da564b5c 100644 --- a/riscv/spike.cc +++ b/riscv/spike.cc @@ -68,5 +68,5 @@ int main(int argc, char** argv) } s.set_debug(debug); - s.run(); + return s.run(); }