aboutsummaryrefslogtreecommitdiff
path: root/riscv/sim.h
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2016-04-24 08:54:19 -0700
committerTim Newsome <tim@sifive.com>2016-05-23 12:12:11 -0700
commitd999dfc0d41a119730ff8944d37dbee88bf99723 (patch)
tree2268c9d7d5f122fb81253d10bd05901eaff0ff62 /riscv/sim.h
parent191671a2015136c429394fd3051e4a9c1ff45352 (diff)
downloadriscv-isa-sim-d999dfc0d41a119730ff8944d37dbee88bf99723.zip
riscv-isa-sim-d999dfc0d41a119730ff8944d37dbee88bf99723.tar.gz
riscv-isa-sim-d999dfc0d41a119730ff8944d37dbee88bf99723.tar.bz2
Add debug_module bus device.
This should replace the ROM hack I implemented earlier, but for now both exist together. Back to the point where gdb connects, core jumps to ROM->RAM->ROM.
Diffstat (limited to 'riscv/sim.h')
-rw-r--r--riscv/sim.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/riscv/sim.h b/riscv/sim.h
index 2e7b214..d3c9a6b 100644
--- a/riscv/sim.h
+++ b/riscv/sim.h
@@ -8,10 +8,11 @@
#include <memory>
#include "processor.h"
#include "devices.h"
-#include "gdbserver.h"
+#include "debug_module.h"
class htif_isasim_t;
class mmu_t;
+class gdbserver_t;
// this class encapsulates the processors and memory in a RISC-V machine.
class sim_t
@@ -46,6 +47,7 @@ private:
std::unique_ptr<rom_device_t> boot_rom;
std::unique_ptr<rtc_t> rtc;
bus_t bus;
+ debug_module_t debug_module;
processor_t* get_core(const std::string& i);
void step(size_t n); // step through simulation
@@ -66,6 +68,9 @@ private:
reg_t mem_to_addr(char* x) { return x - mem + DRAM_BASE; }
bool mmio_load(reg_t addr, size_t len, uint8_t* bytes);
bool mmio_store(reg_t addr, size_t len, const uint8_t* bytes);
+ // Return a pointer to the start of the page that addr falls in, or NULL if
+ // there is no IO device at that address.
+ char* mmio_page(reg_t addr);
void make_config_string();
// presents a prompt for introspection into the simulation
@@ -89,11 +94,6 @@ private:
reg_t get_mem(const std::vector<std::string>& args);
reg_t get_pc(const std::vector<std::string>& args);
- // Return a pointer to Debug RAM in spike address space.
- char *debug_ram() const {
- return mem + memsz - DEBUG_SIZE + DEBUG_RAM_START - DEBUG_START;
- }
-
friend class htif_isasim_t;
friend class processor_t;
friend class mmu_t;