diff options
author | Jerry Zhao <jerryz123@berkeley.edu> | 2023-06-01 19:35:55 -0700 |
---|---|---|
committer | Jerry Zhao <jerryz123@berkeley.edu> | 2023-06-20 12:23:47 -0700 |
commit | 20793b36b79db337187964da3df397c1da576c23 (patch) | |
tree | 1fa2b23bd3a0b13a4ac520911d9a82a908d4695f /riscv | |
parent | 803d85bac7b1dc5e491b735080cbcd7af7eac03e (diff) | |
download | spike-20793b36b79db337187964da3df397c1da576c23.zip spike-20793b36b79db337187964da3df397c1da576c23.tar.gz spike-20793b36b79db337187964da3df397c1da576c23.tar.bz2 |
sim_t: Add list of ptrs to devices to sim_t
Diffstat (limited to 'riscv')
-rw-r--r-- | riscv/sim.cc | 4 | ||||
-rw-r--r-- | riscv/sim.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/riscv/sim.cc b/riscv/sim.cc index dcbd469..82619e7 100644 --- a/riscv/sim.cc +++ b/riscv/sim.cc @@ -123,6 +123,7 @@ sim_t::sim_t(const cfg_t *cfg, bool halted, if (fdt_parse_clint(fdt, &clint_base, "riscv,clint0") == 0) { clint.reset(new clint_t(this, CPU_HZ / INSNS_PER_RTC_TICK, cfg->real_time_clint())); bus.add_device(clint_base, clint.get()); + devices.push_back(clint); } // pointer to wired interrupt controller @@ -134,6 +135,7 @@ sim_t::sim_t(const cfg_t *cfg, bool halted, if (fdt_parse_plic(fdt, &plic_base, &plic_ndev, "riscv,plic0") == 0) { plic.reset(new plic_t(this, plic_ndev)); bus.add_device(plic_base, plic.get()); + devices.push_back(plic); intctrl = plic.get(); } @@ -146,6 +148,7 @@ sim_t::sim_t(const cfg_t *cfg, bool halted, ns16550.reset(new ns16550_t(&bus, intctrl, NS16550_INTERRUPT_ID, ns16550_shift, ns16550_io_width)); bus.add_device(ns16550_base, ns16550.get()); + devices.push_back(ns16550); } //per core attribute @@ -376,6 +379,7 @@ void sim_t::set_rom() boot_rom.reset(new rom_device_t(rom)); bus.add_device(DEFAULT_RSTVEC, boot_rom.get()); + devices.push_back(boot_rom); } char* sim_t::addr_to_mem(reg_t paddr) { diff --git a/riscv/sim.h b/riscv/sim.h index e5a7303..3afeedd 100644 --- a/riscv/sim.h +++ b/riscv/sim.h @@ -70,6 +70,7 @@ private: std::string dts; std::string dtb; bool dtb_enabled; + std::vector<std::shared_ptr<abstract_device_t>> devices; std::shared_ptr<rom_device_t> boot_rom; std::shared_ptr<clint_t> clint; std::shared_ptr<plic_t> plic; |