#include "htif.h"
-#include "common.h"
#include "sim.h"
#include <unistd.h>
#include <stdexcept>
memcpy(&val, p.get_payload(), sizeof(val));
if (regno == PCR_RESET)
{
- reset = val & 1;
- sim->procs[coreid]->reset(reset);
+ if (reset && !(val & 1))
+ reset = false;
+ sim->procs[coreid]->reset(val & 1);
}
else
{
seqno++;
}
-void htif_isasim_t::stop()
+bool htif_isasim_t::done()
{
- htif_t::stop();
- exit(exit_code());
+ if (reset)
+ return false;
+ for (size_t i = 0; i < sim->num_cores(); i++)
+ if (sim->procs[i]->running())
+ return false;
+ return true;
}
delete procs[i];
delete pmmu;
}
- delete htif;
delete mmu;
munmap(mem, memsz);
}
void sim_t::run(bool debug)
{
- while (1)
+ while (!htif->done())
{
if(!debug)
- step_all(1000, 1000, false);
+ step_all(10000, 1000, false);
else
interactive();
}