X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=riscv%2Fsim.h;h=97e9edecb8dc08d758a4c4c46bace1127dd670c6;hb=d6fcfdebf6a893bf37670fd67203d18653df4a0e;hp=ce5fe1972d60843e7bbb76c55b6bf773c9706fee;hpb=46a67860915391458d7cc8cb93248059df20b8f2;p=riscv-isa-sim.git diff --git a/riscv/sim.h b/riscv/sim.h index ce5fe19..97e9ede 100644 --- a/riscv/sim.h +++ b/riscv/sim.h @@ -6,6 +6,7 @@ #include "processor.h" #include "devices.h" #include "debug_module.h" +#include "simif.h" #include #include #include @@ -16,13 +17,13 @@ class mmu_t; class remote_bitbang_t; // this class encapsulates the processors and memory in a RISC-V machine. -class sim_t : public htif_t +class sim_t : public htif_t, public simif_t { public: sim_t(const char* isa, size_t _nprocs, bool halted, reg_t start_pc, std::vector> mems, const std::vector& args, const std::vector hartids, - unsigned progsize); + unsigned progsize, unsigned max_bus_master_bits, bool require_authentication); ~sim_t(); // run the simulation to completion @@ -38,7 +39,8 @@ public: processor_t* get_core(size_t i) { return procs.at(i); } unsigned nprocs() const { return procs.size(); } - debug_module_t debug_module; + // Callback for processors to let the simulation know they were reset. + void proc_reset(unsigned id); private: std::vector> mems; @@ -92,6 +94,7 @@ private: friend class processor_t; friend class mmu_t; + friend class debug_module_t; // htif friend void sim_thread_main(void*); @@ -105,6 +108,12 @@ private: void write_chunk(addr_t taddr, size_t len, const void* src); size_t chunk_align() { return 8; } size_t chunk_max_size() { return 8; } + +public: + // Initialize this after procs, because in debug_module_t::reset() we + // enumerate processors, which segfaults if procs hasn't been initialized + // yet. + debug_module_t debug_module; }; extern volatile bool ctrlc_pressed;