From 292e2dbb89057a1eab46fdf74e3c3122b0388261 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 24 Apr 2018 19:03:30 +0200 Subject: [PATCH] Cleanup of SC wrapper --- dbt-core | 2 +- riscv.sc/src/sysc/core_complex.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dbt-core b/dbt-core index d951285..555bff0 160000 --- a/dbt-core +++ b/dbt-core @@ -1 +1 @@ -Subproject commit d9512853b22e869938013c8dc0c6678a92d52c0e +Subproject commit 555bff0a20cfbf775994ed74b188b9af480df883 diff --git a/riscv.sc/src/sysc/core_complex.cpp b/riscv.sc/src/sysc/core_complex.cpp index 44e1b63..5d673b4 100644 --- a/riscv.sc/src/sysc/core_complex.cpp +++ b/riscv.sc/src/sysc/core_complex.cpp @@ -103,7 +103,9 @@ public: base_type::hart_state& get_state() { return this->state; } - void notify_phase(exec_phase) override; + void notify_phase(exec_phase p) override { + if(p == ISTART) owner->sync(this->reg.icount+cycle_offset); + } sync_type needed_sync() const override { return PRE_SYNC; } @@ -131,9 +133,12 @@ public: return owner->write_mem_dbg(addr.val, length, data) ? Ok : Err; else{ auto res = owner->write_mem(addr.val, length, data) ? Ok : Err; - // TODO: this is an ugly hack (clear MTIP on mtimecmp write), needs to be fixed - if(addr.val==0x2004000) - this->csr[arch::mip] &= ~(1ULL<<7); + // clear MTIP on mtimecmp write + if(addr.val==0x2004000){ + reg_t val; + this->read_csr(arch::mip, val); + this->write_csr(arch::mip, val & ~(1ULL<<7)); + } return res; } } @@ -198,11 +203,6 @@ int cmd_sysc(int argc, char* argv[], debugger::out_func of, debugger::data_func } -void core_wrapper::notify_phase(exec_phase p) { - if(p == ISTART) - owner->sync(this->reg.icount+cycle_offset); -} - core_complex::core_complex(sc_core::sc_module_name name) : sc_core::sc_module(name) , NAMED(initiator)