From 3c476f4925bd615da127ef1a246d22979258d8d3 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Wed, 5 May 2021 15:43:52 +0200 Subject: [PATCH] Simpler clock sync calculation in arbiter. --- DRAMSys/library/src/simulation/Arbiter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DRAMSys/library/src/simulation/Arbiter.cpp b/DRAMSys/library/src/simulation/Arbiter.cpp index 500f098b..753af435 100644 --- a/DRAMSys/library/src/simulation/Arbiter.cpp +++ b/DRAMSys/library/src/simulation/Arbiter.cpp @@ -126,7 +126,8 @@ void ArbiterReorder::end_of_elaboration() tlm_sync_enum Arbiter::nb_transport_fw(int id, tlm_generic_payload &payload, tlm_phase &phase, sc_time &fwDelay) { - sc_time notDelay = std::ceil((sc_time_stamp() + fwDelay) / tCK) * tCK - sc_time_stamp(); + sc_time clockOffset = (sc_time_stamp() + fwDelay) % tCK; + sc_time notDelay = (clockOffset == SC_ZERO_TIME) ? fwDelay : (fwDelay + tCK - clockOffset); if (phase == BEGIN_REQ) {