From cabb915003e68d3db8dc058460d1936fac432956 Mon Sep 17 00:00:00 2001 From: Stephen Twigg Date: Tue, 15 Oct 2013 00:30:46 -0700 Subject: [PATCH] Propogate the reset call to the extensions as well. Add reset function to extensions (demonstration in dummy acc) --- riscv/dummy-rocc.h | 5 +++++ riscv/extension.h | 1 + riscv/processor.cc | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) 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) -- 2.30.2