From: Stephen Twigg Date: Tue, 15 Oct 2013 07:30:46 +0000 (-0700) Subject: Propogate the reset call to the extensions as well. Add reset function to extensions... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cabb915003e68d3db8dc058460d1936fac432956;p=riscv-isa-sim.git Propogate the reset call to the extensions as well. Add reset function to extensions (demonstration in dummy acc) --- diff --git a/riscv/dummy-rocc.h b/riscv/dummy-rocc.h index 55cd48f..c74286e 100644 --- a/riscv/dummy-rocc.h +++ b/riscv/dummy-rocc.h @@ -35,6 +35,11 @@ class dummy_rocc_t : public rocc_t return prev_acc; // in all cases, xd <- previous value of acc[rs2] } + + void reset() + { + for(int i = 0; i < num_acc; i++) acc[i] = 0; + } private: static const int num_acc = 4; diff --git a/riscv/extension.h b/riscv/extension.h index 218deb4..7e9bfe5 100644 --- a/riscv/extension.h +++ b/riscv/extension.h @@ -15,6 +15,7 @@ class extension_t virtual ~extension_t(); void set_processor(processor_t* _p) { p = _p; } + virtual void reset() {}; protected: processor_t* p; diff --git a/riscv/processor.cc b/riscv/processor.cc index 5c0d784..652a170 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -65,7 +65,8 @@ void processor_t::reset(bool value) return; run = !value; - state.reset(); + state.reset(); // reset the core + ext->reset(); // reset the extension } uint32_t processor_t::set_fsr(uint32_t val)