From 38e0829360b167d5f70abb997f8970ca808e01d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20F=2E=20Zulian?= Date: Tue, 2 Feb 2016 17:01:54 -0200 Subject: [PATCH] Invalid commands are ignored. The data structure that stores last commands is initialized with NOPs. So it is possible to get a NOP as return of state.getLastScheduledCommand(bank). --- .../core/scheduling/checker/PowerDownChecker.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/DRAMSys/simulator/src/controller/core/scheduling/checker/PowerDownChecker.cpp b/DRAMSys/simulator/src/controller/core/scheduling/checker/PowerDownChecker.cpp index 5d95cad2..c9a8a988 100644 --- a/DRAMSys/simulator/src/controller/core/scheduling/checker/PowerDownChecker.cpp +++ b/DRAMSys/simulator/src/controller/core/scheduling/checker/PowerDownChecker.cpp @@ -80,14 +80,17 @@ void PowerDownChecker::delayToSatisfyConstraints(ScheduledCommand &command) cons // Get the last scheduled command on this bank ScheduledCommand lastSchedCmdOnBank = state.getLastScheduledCommand(bank); - // Get the start time for the last scheduled command on this bank - sc_time lastSchedCmdOnBankStart = lastSchedCmdOnBank.getStart(); - // Get the last command on this bank itself - Command lastCmdBank = lastSchedCmdOnBank.getCommand(); - timeConstraint = getTimeConstraintToEnterPowerDown(lastCmdBank, pdnCmd); + if (lastSchedCmdOnBank.isValidCommand()) { + // Get the start time for the last scheduled command on this bank + sc_time lastSchedCmdOnBankStart = lastSchedCmdOnBank.getStart(); + // Get the last command on this bank itself + Command lastCmdBank = lastSchedCmdOnBank.getCommand(); - command.establishMinDistanceFromStart(lastSchedCmdOnBankStart, timeConstraint); + timeConstraint = getTimeConstraintToEnterPowerDown(lastCmdBank, pdnCmd); + + command.establishMinDistanceFromStart(lastSchedCmdOnBankStart, timeConstraint); + } } else if (pdnCmd == Command::PDNAX) { // Leaving Active Power Down