[xcc] minor performance tweaks
[riscv-isa-sim.git] / riscv / processor.h
index b72fa27dfc362b6cad008da2d2e954570764c852..8b2d2bcee87d468b9e98bc7c3a4ed68512b25857 100644 (file)
@@ -4,21 +4,19 @@
 #include "decode.h"
 #include <cstring>
 #include "trap.h"
-#include "mmu.h"
 #include "icsim.h"
 
 #define MAX_UTS 2048
 
-#define DISPATCH_TABLE_SIZE 1024
 class processor_t;
+class mmu_t;
 typedef reg_t (*insn_func_t)(processor_t*, insn_t, reg_t);
-
 class sim_t;
 
 class processor_t
 {
 public:
-  processor_t(sim_t* _sim, char* _mem, size_t _memsz);
+  processor_t(sim_t* _sim, mmu_t* _mmu);
   ~processor_t();
   void init(uint32_t _id, icsim_t* defualt_icache, icsim_t* default_dcache);
   void step(size_t n, bool noisy);
@@ -55,7 +53,7 @@ private:
   int xprlen;
 
   // shared memory
-  mmu_t mmu;
+  mmu_t& mmu;
 
   // counters
   reg_t cycle;
@@ -91,14 +89,9 @@ private:
   icsim_t* dtlbsim;
 
   friend class sim_t;
+  friend class mmu_t;
 
-  static insn_func_t dispatch_table[DISPATCH_TABLE_SIZE];
-  reg_t dispatch(insn_t insn, reg_t pc);
-  static void initialize_dispatch_table();
-
-  #define DECLARE_INSN(name, m, o) reg_t insn_func_ ## name (insn_t, reg_t);
-  #include "opcodes.h"
-  #undef DECLARE_INSN
+  #include "dispatch.h"
 };
 
 #endif