From 07fb5287b8f1ccdaad40fcc0db296c49f84a5208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20F=2E=20Zulian?= Date: Thu, 15 Oct 2015 12:10:01 +0200 Subject: [PATCH] Error model changed to avoid premature end of simulation. Check if the provided temperature and retention time are in a valid range that is covered by the input data stored in the errorMap. In case values are out of range the maximum values provided are used and debug messages are generated to alert the user. --- DRAMSys/simulator/src/error/errormodel.cpp | 86 +++++++++++----------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/DRAMSys/simulator/src/error/errormodel.cpp b/DRAMSys/simulator/src/error/errormodel.cpp index 736d30d6..6500d5ef 100644 --- a/DRAMSys/simulator/src/error/errormodel.cpp +++ b/DRAMSys/simulator/src/error/errormodel.cpp @@ -711,55 +711,55 @@ void errorModel::prepareWeakCells() // Retrieve number of flipping bits which fits best to temperature input and time since last refresh unsigned int errorModel::getNumberOfFlips(double temp, sc_time time) { - // Check if the provided temperature and time are in a valid range that - // is covered by the input data stored in the errorMap: - if(temp > maxTemperature) - { - SC_REPORT_FATAL("errormodel","temperature out of range"); + // Check if the provided temperature and retention time are in a valid + // range that is covered by the input data stored in the errorMap. + // In case values are out of range the maximum values provided are used + // (saturation) and debug messages are generated to alert the user. + if (temp > maxTemperature) { + temp = maxTemperature; + DebugManager::getInstance().printDebugMessage(name, "errormodel, temperature out of range."); } - else if(time > maxTime) - { - SC_REPORT_FATAL("errormodel","time out of range"); + + if (time > maxTime) { + time = maxTime; + DebugManager::getInstance().printDebugMessage(name, "errormodel, time out of range."); } - else + + // Find nearest temperature: + double nearestTemperature = 0; + for( const auto &i : errorMap ) { - // Find nearest temperature: - double nearestTemperature = 0; - for( const auto &i : errorMap ) + if(i.first >= temp) // for worst case reasons we go to the next bin { - if(i.first >= temp) // for worst case reasons we go to the next bin - { - nearestTemperature = i.first; - break; - } + nearestTemperature = i.first; + break; } - - // Find nearest time: - sc_time nearestTime; - for( const auto &i : errorMap[nearestTemperature]) - { - if(i.first >= time) // for worst case reasons we go to the next bin - { - nearestTime = i.first; - break; - } - } - - errors e = errorMap[nearestTemperature][nearestTime]; - - //std::stringstream msg; - //msg << "ACT/REF temp:" << temp - // << " time:" << time - // << " nearestTemp:" << nearestTemperature - // << " nearestTime:" << nearestTime - // << " ind:" << e.independent - // << " dep:" << e.dependent; - - //DebugManager::getInstance().printDebugMessage(name, msg.str()); - - return e.independent + e.dependent; } - return 0; + + // Find nearest time: + sc_time nearestTime; + for( const auto &i : errorMap[nearestTemperature]) + { + if(i.first >= time) // for worst case reasons we go to the next bin + { + nearestTime = i.first; + break; + } + } + + errors e = errorMap[nearestTemperature][nearestTime]; + + //std::stringstream msg; + //msg << "ACT/REF temp:" << temp + // << " time:" << time + // << " nearestTemp:" << nearestTemperature + // << " nearestTime:" << nearestTime + // << " ind:" << e.independent + // << " dep:" << e.dependent; + + //DebugManager::getInstance().printDebugMessage(name, msg.str()); + + return e.independent + e.dependent; } void errorModel::setContext(DecodedAddress addr)