diff options
author | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-04-23 19:19:29 -0700 |
---|---|---|
committer | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-05-19 19:56:53 -0700 |
commit | 1def3e9a740a609f4363c96c153ab96699a38671 (patch) | |
tree | a816d054464d308a1964bffe1560124ae5a2e240 /riscv/sim.h | |
parent | 877a8069db245018b8c2449cb44e76a48d216c5e (diff) | |
download | spike-1def3e9a740a609f4363c96c153ab96699a38671.zip spike-1def3e9a740a609f4363c96c153ab96699a38671.tar.gz spike-1def3e9a740a609f4363c96c153ab96699a38671.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.h | 14 |
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(); |