diff --git a/DRAMSys/simulator/src/error/errormodel.cpp b/DRAMSys/simulator/src/error/errormodel.cpp index 6500d5ef..0d1a42b4 100644 --- a/DRAMSys/simulator/src/error/errormodel.cpp +++ b/DRAMSys/simulator/src/error/errormodel.cpp @@ -717,12 +717,12 @@ unsigned int errorModel::getNumberOfFlips(double temp, sc_time time) // (saturation) and debug messages are generated to alert the user. if (temp > maxTemperature) { temp = maxTemperature; - DebugManager::getInstance().printDebugMessage(name, "errormodel, temperature out of range."); + //DebugManager::getInstance().printDebugMessage(name, "errormodel, temperature out of range."); } if (time > maxTime) { time = maxTime; - DebugManager::getInstance().printDebugMessage(name, "errormodel, time out of range."); + //DebugManager::getInstance().printDebugMessage(name, "errormodel, time out of range."); } // Find nearest temperature: diff --git a/DRAMSys/simulator/src/simulation/TemperatureController.cpp b/DRAMSys/simulator/src/simulation/TemperatureController.cpp index e30fc3f5..91cfb40c 100644 --- a/DRAMSys/simulator/src/simulation/TemperatureController.cpp +++ b/DRAMSys/simulator/src/simulation/TemperatureController.cpp @@ -56,6 +56,7 @@ double TemperatureController::getTemperature(int deviceId, float currentPower) if (dynamicTempSimEnabled == true) { currentPowerValues.at(deviceId) = currentPower; + checkPowerThreshold(deviceId); // FIXME using the static temperature value until the vector of // temperatures is filled @@ -82,6 +83,14 @@ void TemperatureController::updateTemperatures() temperaturesBuffer.clear(); } +void TemperatureController::checkPowerThreshold(int deviceId) +{ + if (std::abs(lastPowerValues.at(deviceId) - currentPowerValues.at(deviceId)) > powerThresholds.at(deviceId)) { + decreaseSimPeriod = true; + } + lastPowerValues.at(deviceId) = currentPowerValues.at(deviceId); +} + double TemperatureController::adjustThermalSimPeriod() { // Temperature Simulation Period Dynamic Adjustment @@ -110,19 +119,10 @@ double TemperatureController::adjustThermalSimPeriod() // again in steps of 'n/2' until it achieves the desired value given by // configuration or the described in 1.1 occurs. - bool decreaseSimPeriod = false; - - for (unsigned i = 0; i < currentPowerValues.size(); i++) { - if (std::abs(lastPowerValues.at(i) - currentPowerValues.at(i)) > powerThresholds.at(i)) { - cyclesSinceLastPeriodAdjust = 0; - decreaseSimPeriod = true; - } - } - - lastPowerValues = currentPowerValues; - if (decreaseSimPeriod == true) { period = period / periodAdjustFactor; + cyclesSinceLastPeriodAdjust = 0; + decreaseSimPeriod = false; printDebugMessage("Thermal Simulation period reduced to " + std::to_string(period) + ". Target is " + std::to_string(targetPeriod)); } else { if (period != targetPeriod) { diff --git a/DRAMSys/simulator/src/simulation/TemperatureController.h b/DRAMSys/simulator/src/simulation/TemperatureController.h index fe9b5335..f6e98387 100644 --- a/DRAMSys/simulator/src/simulation/TemperatureController.h +++ b/DRAMSys/simulator/src/simulation/TemperatureController.h @@ -79,6 +79,7 @@ public: // Substantial changes in power will trigger adjustments in the simulaiton period. Get the thresholds from config. powerThresholds = Configuration::getInstance().temperatureSim.powerThresholds; + decreaseSimPeriod = false; periodAdjustFactor = Configuration::getInstance().temperatureSim.SimPeriodAdjustFactor; nPowStableCyclesToIncreasePeriod = Configuration::getInstance().temperatureSim.NPowStableCyclesToIncreasePeriod; cyclesSinceLastPeriodAdjust = 0; @@ -120,6 +121,8 @@ private: void temperatureThread(); void updateTemperatures(); double adjustThermalSimPeriod(); + void checkPowerThreshold(int deviceId); + bool decreaseSimPeriod; unsigned int periodAdjustFactor; unsigned int cyclesSinceLastPeriodAdjust; unsigned int nPowStableCyclesToIncreasePeriod;