From 0c47ea1a34499577ac3819e4aeaa45ad976f56b1 Mon Sep 17 00:00:00 2001 From: Derek Christ Date: Mon, 28 Feb 2022 11:43:34 +0100 Subject: [PATCH] Fix a bug when the first state is an idle state. --- DRAMSys/simulator/TrafficGenerator.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/DRAMSys/simulator/TrafficGenerator.cpp b/DRAMSys/simulator/TrafficGenerator.cpp index 7706840c..33e90032 100644 --- a/DRAMSys/simulator/TrafficGenerator.cpp +++ b/DRAMSys/simulator/TrafficGenerator.cpp @@ -295,6 +295,15 @@ void TrafficGenerator::prepareNextPayload() if (transactionsSentInCurrentState >= trafficState->numRequests) transitionToNextState(); } + + // In case we are in an idle state right at the beginning of the simulation, + // set the clksToIdle and transition to the next state. + if (auto idleState = + std::get_if(&conf.states.at(currentState))) + { + currentClksToIdle = idleState->idleClks; + transitionToNextState(); + } } void TrafficGenerator::payloadSent()