#include <vector>
#include <string>
+#include <memory>
#include "processor.h"
#include "mmu.h"
class sim_t
{
public:
- sim_t(int _nprocs, int mem_mb, const std::vector<std::string>& htif_args);
+ sim_t(size_t _nprocs, size_t mem_mb, const std::vector<std::string>& htif_args);
~sim_t();
// run the simulation to completion
- void run(bool debug);
+ void run();
+ bool running();
+ void stop();
+ void set_debug(bool value) { debug = value; }
// deliver an IPI to a specific processor
void send_ipi(reg_t who);
reg_t get_scr(int which);
private:
- htif_isasim_t* htif;
+ std::auto_ptr<htif_isasim_t> htif;
char* mem; // main memory
size_t memsz; // memory size in bytes
mmu_t* mmu; // debug port into main memory
static const size_t INTERLEAVE = 5000;
size_t current_step;
size_t current_proc;
+ bool debug;
// presents a prompt for introspection into the simulation
void interactive();
void interactive_run(const std::string& cmd, const std::vector<std::string>& args, bool noisy);
void interactive_run_noisy(const std::string& cmd, const std::vector<std::string>& args);
void interactive_run_silent(const std::string& cmd, const std::vector<std::string>& args);
- void interactive_run_proc(const std::string& cmd, const std::vector<std::string>& args, bool noisy);
- void interactive_run_proc_noisy(const std::string& cmd, const std::vector<std::string>& args);
- void interactive_run_proc_silent(const std::string& cmd, const std::vector<std::string>& args);
void interactive_reg(const std::string& cmd, const std::vector<std::string>& args);
void interactive_fregs(const std::string& cmd, const std::vector<std::string>& args);
void interactive_fregd(const std::string& cmd, const std::vector<std::string>& args);
friend class htif_isasim_t;
};
+extern volatile bool ctrlc_pressed;
+
#endif