#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);
int xprlen;
// shared memory
- mmu_t mmu;
+ mmu_t& mmu;
// counters
reg_t cycle;
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