aboutsummaryrefslogtreecommitdiff
path: root/riscv/sim.h
diff options
context:
space:
mode:
authorChih-Min Chao <chihmin.chao@sifive.com>2020-04-23 19:19:29 -0700
committerChih-Min Chao <chihmin.chao@sifive.com>2020-04-27 21:16:43 -0700
commit3b26740205c401498fe77c2c9a16c8907a139cd8 (patch)
tree609d267768097a6b46c533ab4f5b5e01fac932c0 /riscv/sim.h
parent65f42ac88a871a5464a63a83cec6987f17aa599e (diff)
downloadspike-3b26740205c401498fe77c2c9a16c8907a139cd8.zip
spike-3b26740205c401498fe77c2c9a16c8907a139cd8.tar.gz
spike-3b26740205c401498fe77c2c9a16c8907a139cd8.tar.bz2
fdt: restructure dtb create and config flow
1. pass dtb option from constructor 2. separate dtb generation from rom initialization 3. setup clint base from dtb Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'riscv/sim.h')
-rw-r--r--riscv/sim.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/riscv/sim.h b/riscv/sim.h
index 0cf518d..eee24e5 100644
--- a/riscv/sim.h
+++ b/riscv/sim.h
@@ -29,7 +29,8 @@ public:
reg_t start_pc, std::vector<std::pair<reg_t, mem_t*>> mems,
std::vector<std::pair<reg_t, abstract_device_t*>> plugin_devices,
const std::vector<std::string>& args, const std::vector<int> hartids,
- const debug_module_config_t &dm_config, const char *log_path);
+ const debug_module_config_t &dm_config, const char *log_path,
+ bool dtb_enabled, const char *dtb_file);
~sim_t();
// run the simulation to completion
@@ -46,13 +47,6 @@ public:
void configure_log(bool enable_log, bool enable_commitlog);
void set_procs_debug(bool value);
- void set_dtb_enabled(bool value) {
- this->dtb_enabled = value;
- }
- void set_dtb_file(const char* value) {
- if (value)
- this->dtb_file = value;
- }
void set_remote_bitbang(remote_bitbang_t* remote_bitbang) {
this->remote_bitbang = remote_bitbang;
}
@@ -72,7 +66,9 @@ private:
reg_t initrd_end;
reg_t start_pc;
std::string dts;
+ std::string dtb;
std::string dtb_file;
+ bool dtb_enabled;
std::unique_ptr<rom_device_t> boot_rom;
std::unique_ptr<clint_t> clint;
bus_t bus;
@@ -88,7 +84,6 @@ private:
bool debug;
bool histogram_enabled; // provide a histogram of PCs
bool log;
- bool dtb_enabled;
remote_bitbang_t* remote_bitbang;
// memory-mapped I/O routines
@@ -96,6 +91,7 @@ private:
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);
void make_dtb();
+ void set_rom();
// presents a prompt for introspection into the simulation
void interactive();