case 1: // xd <- acc (the only real work is the return statement below)
break;
case 2: // acc[rs2] <- Mem[xs1]
- acc[insn.rs2] = p->get_mmu()->load_uint64(xs1);
+ acc[insn.rs2] = p->get_mmu()->load_uint64(xs1)
+#ifdef NOT_SPIKE_SIMPLEV
+ .get_data()
+#endif
+;
break;
case 3: // acc[rs2] <- accX + xs1
acc[insn.rs2] += xs1;
reg_t address = ((uint64_t) sbaddress[1] << 32) | sbaddress[0];
try {
if (sbcs.sbaccess == 0 && max_bus_master_bits >= 8) {
- sbdata[0] = sim->debug_mmu->load_uint8(address);
+ sbdata[0] = sim->debug_mmu->load_uint8(address)
+#ifdef NOTYET_SPIKE_SIMPLEV
+ .get_data()
+#endif
+;
} else if (sbcs.sbaccess == 1 && max_bus_master_bits >= 16) {
- sbdata[0] = sim->debug_mmu->load_uint16(address);
+ sbdata[0] = sim->debug_mmu->load_uint16(address)
+#ifdef NOTYET_SPIKE_SIMPLEV
+ .get_data()
+#endif
+;
} else if (sbcs.sbaccess == 2 && max_bus_master_bits >= 32) {
- sbdata[0] = sim->debug_mmu->load_uint32(address);
+ sbdata[0] = sim->debug_mmu->load_uint32(address)
+#ifdef NOTYET_SPIKE_SIMPLEV
+ .get_data()
+#endif
+;
} else if (sbcs.sbaccess == 3 && max_bus_master_bits >= 64) {
- uint64_t value = sim->debug_mmu->load_uint64(address);
+ uint64_t value = sim->debug_mmu->load_uint64(address)
+#ifdef NOTYET_SPIKE_SIMPLEV
+ .get_data()
+#endif
+;
sbdata[0] = value;
sbdata[1] = value >> 32;
} else {
while (n > 0) {
size_t instret = 0;
reg_t pc = state.pc;
+#ifdef SPIKE_SIMPLEV
+ sv_mmu_t* _mmu = mmu;
+#else
mmu_t* _mmu = mmu;
+#endif
#define advance_pc() \
if (unlikely(invalid_pc(pc))) { \
#include "decode.h"
#include "disasm.h"
#include "sim.h"
+#ifdef SPIKE_SIMPLEV
+#include "sv_mmu.h"
+#else
#include "mmu.h"
+#endif
#include <sys/mman.h>
#include <termios.h>
#include <map>
throw trap_interactive();
std::string addr_str = args[0];
+#ifdef SPIKE_SIMPLEV
+ sv_mmu_t* mmu = debug_mmu;
+#else
mmu_t* mmu = debug_mmu;
+#endif
if(args.size() == 2)
{
processor_t *p = get_core(args[0]);
switch(addr % 8)
{
case 0:
- val = mmu->load_uint64(addr);
+ val = mmu->load_uint64(addr)
+#ifdef NOTYET_SPIKE_SIMPLEV
+ .get_data()
+#endif
+ ;
break;
case 4:
- val = mmu->load_uint32(addr);
+ val = mmu->load_uint32(addr)
+#ifdef NOTYET_SPIKE_SIMPLEV
+ .get_data()
+#endif
+ ;
break;
case 2:
case 6:
- val = mmu->load_uint16(addr);
+ val = mmu->load_uint16(addr)
+#ifdef NOTYET_SPIKE_SIMPLEV
+ .get_data()
+#endif
+ ;
break;
default:
- val = mmu->load_uint8(addr);
+ val = mmu->load_uint8(addr)
+#ifdef NOTYET_SPIKE_SIMPLEV
+ .get_data()
+#endif
+ ;
break;
}
return val;
reg_t addr = strtol(args[0].c_str(),NULL,16);
char ch;
+#ifdef NOTYET_SPIKE_SIMPLEV
+ while((ch = debug_mmu->load_uint8(addr++).get_data()))
+ putchar(ch);
+#else
while((ch = debug_mmu->load_uint8(addr++)))
putchar(ch);
+#endif
putchar('\n');
}
}
}
+#ifdef SPIKE_SIMPLEV
+#include "sv_mmu.h"
+#endif
+
#endif
parse_isa_string(isa);
register_base_instructions();
+#ifdef SPIKE_SIMPLEV
+ mmu = new sv_mmu_t(sim, this);
+#else
mmu = new mmu_t(sim, this);
+#endif
disassembler = new disassembler_t(max_xlen);
if (ext)
class processor_t;
class mmu_t;
+class sv_mmu_t;
typedef reg_t (*insn_func_t)(processor_t*, insn_t, reg_t);
class simif_t;
class trap_t;
void step(size_t n); // run for n cycles
void set_csr(int which, reg_t val);
reg_t get_csr(int which);
+#ifdef SPIKE_SIMPLEV
+ sv_mmu_t* get_mmu() { return mmu; }
+#else
mmu_t* get_mmu() { return mmu; }
+#endif
state_t* get_state() { return &state; }
unsigned get_xlen() { return xlen; }
unsigned get_max_xlen() { return max_xlen; }
private:
simif_t* sim;
+#ifdef SPIKE_SIMPLEV
+ sv_mmu_t* mmu;
+#else
mmu_t* mmu; // main memory is always accessed via the mmu
+#endif
extension_t* ext;
disassembler_t* disassembler;
state_t state;
void enter_debug_mode(uint8_t cause);
+#ifdef SPIKE_SIMPLEV
+ friend class sv_mmu_t;
+#endif
friend class mmu_t;
friend class clint_t;
friend class extension_t;
debug_module.add_device(&bus);
+#ifdef SPIKE_SIMPLEV
+ debug_mmu = new sv_mmu_t(this, NULL);
+#else
debug_mmu = new mmu_t(this, NULL);
+#endif
if (hartids.size() == 0) {
for (size_t i = 0; i < procs.size(); i++) {
#include <string>
#include <memory>
+#ifdef SPIKE_SIMPLEV
+class sv_mmu_t;
+#else
class mmu_t;
+#endif
class remote_bitbang_t;
// this class encapsulates the processors and memory in a RISC-V machine.
private:
std::vector<std::pair<reg_t, mem_t*>> mems;
+#ifdef SPIKE_SIMPLEV
+ sv_mmu_t* debug_mmu;
+#else
mmu_t* debug_mmu; // debug port into main memory
+#endif
std::vector<processor_t*> procs;
reg_t start_pc;
std::string dts;