Browse Source

Eliminate infinite loop in debug mode

confprec
Andrew Waterman 13 years ago
parent
commit
9299f2f745
  1. 5
      riscv/htif.cc
  2. 10
      riscv/sim.cc
  3. 1
      riscv/sim.h

5
riscv/htif.cc

@ -106,8 +106,5 @@ bool htif_isasim_t::done()
{
if (reset)
return false;
for (size_t i = 0; i < sim->num_cores(); i++)
if (sim->procs[i]->running())
return false;
return true;
return !sim->running();
}

10
riscv/sim.cc

@ -90,6 +90,8 @@ void sim_t::step(size_t n, bool noisy)
for (size_t i = 0, steps = 0; i < n; i += steps)
{
htif->tick();
if (!running())
break;
steps = std::min(n - i, INTERLEAVE - current_step);
procs[current_proc]->step(steps, noisy);
@ -105,6 +107,14 @@ void sim_t::step(size_t n, bool noisy)
}
}
bool sim_t::running()
{
for (size_t i = 0; i < procs.size(); i++)
if (procs[i]->running())
return true;
return false;
}
void sim_t::stop()
{
procs[0]->tohost = 1;

1
riscv/sim.h

@ -20,6 +20,7 @@ public:
// run the simulation to completion
void run();
bool running();
void stop();
void set_debug(bool value) { debug = value; }

Loading…
Cancel
Save