From cfa7b7236397dc84062dc108aadf4bb9c2a02e2b Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 6 May 2023 19:57:29 +0200 Subject: [PATCH] changes time handling at sockets --- contrib/tgc_import_tb.tcl | 6 +++--- src/sysc/core_complex.cpp | 15 ++++++++++----- src/sysc/core_complex.h | 10 +++++++--- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/contrib/tgc_import_tb.tcl b/contrib/tgc_import_tb.tcl index fb44353..3150eb8 100644 --- a/contrib/tgc_import_tb.tcl +++ b/contrib/tgc_import_tb.tcl @@ -5,9 +5,9 @@ set FW_name ${scriptDir}/hello.elf puts "instantiate testbench elements" ::paultra::add_hw_instance GenericIPlib:Memory_Generic -inst_name i_Memory_Generic ::pct::set_param_value i_Memory_Generic/MEM:protocol {Protocol Common Parameters} address_width 30 -#::pct::set_param_value i_Memory_Generic {Scml Properties} /timing/LT/clock_period_in_ns 1 -#::pct::set_param_value i_Memory_Generic {Scml Properties} /timing/read/cmd_accept_cycles 1 -#::pct::set_param_value i_Memory_Generic {Scml Properties} /timing/write/cmd_accept_cycles 1 +::pct::set_param_value i_Memory_Generic {Scml Properties} /timing/LT/clock_period_in_ns 1 +::pct::set_param_value i_Memory_Generic {Scml Properties} /timing/read/cmd_accept_cycles 1 +::pct::set_param_value i_Memory_Generic {Scml Properties} /timing/write/cmd_accept_cycles 1 ::pct::set_bounds i_Memory_Generic 1000 300 100 100 ::paultra::add_hw_instance Bus:Bus -inst_name i_Bus diff --git a/src/sysc/core_complex.cpp b/src/sysc/core_complex.cpp index 9bb81cf..8b8d75c 100644 --- a/src/sysc/core_complex.cpp +++ b/src/sysc/core_complex.cpp @@ -107,7 +107,8 @@ public: heart_state_t &get_state() { return this->state; } void notify_phase(iss::arch_if::exec_phase p) override { - if (p == iss::arch_if::ISTART) owner->sync(this->icount); + if (p == iss::arch_if::ISTART) + owner->sync(this->instr_if.get_total_cycles()); } sync_type needed_sync() const override { return PRE_SYNC; } @@ -547,8 +548,12 @@ bool core_complex::read_mem(uint64_t addr, unsigned length, uint8_t *const data, gp.set_extension(preExt); } sckt->b_transport(gp, delay); - quantum_keeper.set(delay); - SCCTRACE(this->name()) << "read_mem(0x" << std::hex << addr << ") : 0x" << (length==4?*(uint32_t*)data:length==2?*(uint16_t*)data:(unsigned)*data); + auto incr = delay-quantum_keeper.get_local_time(); + if(is_fetch) + ibus_inc+=incr; + else + dbus_inc+=incr; + SCCTRACE(this->name()) << "[local time: "<b_transport(gp, delay); - quantum_keeper.set(delay); - SCCTRACE() << "write_mem(0x" << std::hex << addr << ") : 0x" << (length==4?*(uint32_t*)data:length==2?*(uint16_t*)data:(unsigned)*data); + dbus_inc+=delay-quantum_keeper.get_local_time(); + SCCTRACE() << "[local time: "< write_buf; core_wrapper* cpu{nullptr}; sc_core::sc_signal curr_clk; + sc_core::sc_time ibus_inc, dbus_inc; core_trace* trc{nullptr}; std::unique_ptr t2t; private: @@ -202,7 +206,7 @@ private: std::vector plugin_list; }; -} /* namespace SiFive */ +} /* namespace tgfs */ } /* namespace sysc */ #endif /* _SYSC_CORE_COMPLEX_H_ */