Add dump device to Spike

This commit is contained in:
Florian Zaruba 2018-11-07 17:01:29 +01:00
parent f5c6b43705
commit f9e8e3e3e6
No known key found for this signature in database
GPG key ID: E742FFE8EC38A792
5 changed files with 18 additions and 0 deletions

View file

@ -6,6 +6,7 @@
#include <string>
#include <map>
#include <vector>
#include <fstream>
class processor_t;
@ -94,4 +95,13 @@ class uart_t : public abstract_device_t {
bool fifo_enabled;
};
class dump_t : public abstract_device_t {
public:
dump_t();
bool load(reg_t addr, size_t len, uint8_t* bytes);
bool store(reg_t addr, size_t len, const uint8_t* bytes);
private:
std::ofstream ofs;
};
#endif

View file

@ -157,6 +157,8 @@
#define UART_SIZE 0x00010000
#define EXT_IO_BASE 0x40000000
#define DRAM_BASE 0x80000000
#define DUMP_BASE 0x82000000
#define DUMP_SIZE 0x20000000
// page table entry (PTE) fields
#define PTE_V 0x001 // Valid

View file

@ -51,6 +51,7 @@ riscv_srcs = \
rom.cc \
clint.cc \
uart.cc \
dump.cc \
debug_module.cc \
remote_bitbang.cc \
jtag_dtm.cc \

View file

@ -60,8 +60,12 @@ sim_t::sim_t(const char* isa, size_t nprocs, bool halted, reg_t start_pc,
clint.reset(new clint_t(procs));
bus.add_device(CLINT_BASE, clint.get());
uart.reset(new uart_t());
bus.add_device(UART_BASE, uart.get());
dump.reset(new dump_t());
bus.add_device(DUMP_BASE, dump.get());
}
sim_t::~sim_t()

View file

@ -53,6 +53,7 @@ private:
std::string dts;
std::unique_ptr<rom_device_t> boot_rom;
std::unique_ptr<clint_t> clint;
std::unique_ptr<dump_t> dump;
std::unique_ptr<uart_t> uart;
bus_t bus;