Generate instruction decoder dynamically
[riscv-isa-sim.git] / riscv / sim.h
index 2676ba4630fca844992082d18c5bcc5fc9f36f7c..a53f3f0f65102cd7602e4ad7ec54f945b7325314 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <vector>
 #include <string>
+#include <memory>
 #include "processor.h"
 #include "mmu.h"
 
@@ -14,11 +15,14 @@ class htif_isasim_t;
 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);
@@ -31,7 +35,7 @@ public:
   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
@@ -41,6 +45,7 @@ private:
   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();
@@ -50,9 +55,6 @@ private:
   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);
@@ -68,4 +70,6 @@ private:
   friend class htif_isasim_t;
 };
 
+extern volatile bool ctrlc_pressed;
+
 #endif