diff --git a/DRAMSys/library/src/controller/core/configuration/Configuration.cpp b/DRAMSys/library/src/controller/core/configuration/Configuration.cpp index 72811ff4..7e7000b6 100644 --- a/DRAMSys/library/src/controller/core/configuration/Configuration.cpp +++ b/DRAMSys/library/src/controller/core/configuration/Configuration.cpp @@ -332,7 +332,7 @@ std::string Configuration::getPathToResources() { return pathToResources; } - +// TODO: Never used void Configuration::setParameters(std::map parameterMap) { diff --git a/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.cpp b/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.cpp index f0aeaf8b..8a08be11 100644 --- a/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.cpp +++ b/DRAMSys/library/src/controller/core/configuration/ConfigurationLoader.cpp @@ -235,6 +235,7 @@ void ConfigurationLoader::loadDDR3(Configuration &config, XMLElement *xmlSpec) memSpec->tFAW_ORGR = parameterExists(timings, "FAW_ORGR") ? clk * queryUIntParameter(timings, "FAW_ORGR") : memSpec->tFAW; memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); + std::cout << "RefMode: " << Configuration::getInstance().getRefMode() << std::endl; memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); memSpec->tRP = clk * queryUIntParameter(timings, "RP"); memSpec->tRP_ORGR = parameterExists(timings, "RP_ORGR") ? @@ -261,11 +262,10 @@ void ConfigurationLoader::loadDDR3(Configuration &config, XMLElement *xmlSpec) memSpec->tRFC_old = clk * queryUIntParameter(timings, "RFC"); memSpec->tREFI_old = clk * queryUIntParameter(timings, "REFI"); - memSpec->refreshTimings.clear(); - for (unsigned int i = 0; i < memSpec->NumberOfBanks; ++i) { + memSpec->refreshTimings.clear(); + for (unsigned int i = 0; i < memSpec->NumberOfBanks; ++i) memSpec->refreshTimings[Bank(i)] = RefreshTiming(memSpec->tRFC_old, - memSpec->tREFI_old); - } + memSpec->tREFI_old); // Currents and Volatages: TODO Check if this is correct. XMLElement *powers = xmlSpec->FirstChildElement("mempowerspec"); @@ -309,7 +309,13 @@ void ConfigurationLoader::loadDDR4(Configuration &config, XMLElement *xmlSpec) memSpec->tFAW_ORGR = parameterExists(timings, "FAW_ORGR") ? clk * queryUIntParameter(timings, "FAW_ORGR") : memSpec->tFAW; memSpec->tREFI = clk * queryUIntParameter(timings, "REFI"); - memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); + unsigned refMode = Configuration::getInstance().getRefMode(); + if (refMode == 1) + memSpec->tRFC = clk * queryUIntParameter(timings, "RFC"); + else if (refMode == 2) + memSpec->tRFC = clk * queryUIntParameter(timings, "RFC2"); + else // if (refMode == 4) + memSpec->tRFC = clk * queryUIntParameter(timings, "RFC4"); memSpec->tRP = clk * queryUIntParameter(timings, "RP"); memSpec->tRP_ORGR = parameterExists(timings, "RP_ORGR") ? clk * queryUIntParameter(timings, "RP_ORGR") : memSpec->tRP; @@ -324,9 +330,6 @@ void ConfigurationLoader::loadDDR4(Configuration &config, XMLElement *xmlSpec) memSpec->tXPDLL = clk * queryUIntParameter(timings, "XPDLL"); memSpec->tXSDLL = clk * queryUIntParameter(timings, "XSDLL"); - memSpec->tRFC2 = clk * queryUIntParameter(timings, "RFC2"); - memSpec->tRFC4 = clk * queryUIntParameter(timings, "RFC4"); - // TODO: old timings, will me removed memSpec->tRP_old = clk * queryUIntParameter(timings, "RP"); @@ -339,16 +342,19 @@ void ConfigurationLoader::loadDDR4(Configuration &config, XMLElement *xmlSpec) memSpec->tWTR_L_old = clk * queryUIntParameter(timings, "WTR_L"); memSpec->tXPDLL_old = clk * queryUIntParameter(timings, "XPDLL"); memSpec->tXSDLL_old = clk * queryUIntParameter(timings, "XSDLL"); - memSpec->tRFC_old = clk * queryUIntParameter(timings, "RFC"); + unsigned refMode_old = Configuration::getInstance().getRefMode(); + if (refMode_old == 1) + memSpec->tRFC_old = clk * queryUIntParameter(timings, "RFC"); + else if (refMode_old == 2) + memSpec->tRFC_old = clk * queryUIntParameter(timings, "RFC2"); + else // if (refMode_old == 4) + memSpec->tRFC_old = clk * queryUIntParameter(timings, "RFC4"); memSpec->tREFI_old = clk * queryUIntParameter(timings, "REFI"); memSpec->refreshTimings.clear(); - for (unsigned int i = 0; i < memSpec->NumberOfBanks; ++i) { + for (unsigned int i = 0; i < memSpec->NumberOfBanks; ++i) memSpec->refreshTimings[Bank(i)] = RefreshTiming(memSpec->tRFC_old, - memSpec->tRFC2, - memSpec->tRFC4, - memSpec->tREFI_old); - } + memSpec->tREFI_old); // Currents and Volatages: XMLElement *powers = xmlSpec->FirstChildElement("mempowerspec"); @@ -422,11 +428,10 @@ void ConfigurationLoader::loadLPDDR4(Configuration &config, XMLElement *xmlSpec) memSpec->tREFI_old = clk * queryUIntParameter(timings, "REFIAB"); memSpec->tRP_old = clk * queryUIntParameter(timings, "RPPB"); - memSpec->refreshTimings.clear(); - for (unsigned int i = 0; i < memSpec->NumberOfBanks; ++i) { + memSpec->refreshTimings.clear(); + for (unsigned int i = 0; i < memSpec->NumberOfBanks; ++i) memSpec->refreshTimings[Bank(i)] = RefreshTiming(memSpec->tRFC_old, - memSpec->tREFI_old); - } + memSpec->tREFI_old); // Currents and Volatages: XMLElement *powers = xmlSpec->FirstChildElement("mempowerspec"); @@ -493,11 +498,10 @@ void ConfigurationLoader::loadWideIO(Configuration &config, XMLElement *memspec) memSpec->tRFC_old = clk * queryUIntParameter(timings, "RFC"); memSpec->tREFI_old = clk * queryUIntParameter(timings, "REFI"); - memSpec->refreshTimings.clear(); - for (unsigned int i = 0; i < memSpec->NumberOfBanks; ++i) { + memSpec->refreshTimings.clear(); + for (unsigned int i = 0; i < memSpec->NumberOfBanks; ++i) memSpec->refreshTimings[Bank(i)] = RefreshTiming(memSpec->tRFC_old, - memSpec->tREFI_old); - } + memSpec->tREFI_old); // Currents and Volatages: XMLElement *powers = memspec->FirstChildElement("mempowerspec"); diff --git a/DRAMSys/library/src/controller/core/configuration/MemSpec.cpp b/DRAMSys/library/src/controller/core/configuration/MemSpec.cpp index faaa8449..d130f28f 100644 --- a/DRAMSys/library/src/controller/core/configuration/MemSpec.cpp +++ b/DRAMSys/library/src/controller/core/configuration/MemSpec.cpp @@ -96,10 +96,8 @@ sc_time MemSpec::getExecutionTime(Command command, tlm::tlm_generic_payload &pay else if (command == Command::PrechargeAll) return tRP_old; else if (command == Command::AutoRefresh) - { return getElementFromMap(refreshTimings, - DramExtension::getExtension(payload).getBank()).tRFC; - } + DramExtension::getExtension(payload).getBank()).tRFC; else if (command == Command::PDNAX || command == Command::PDNPX || command == Command::SREFX) return clk; else @@ -132,15 +130,8 @@ sc_time MemSpecDDR4::getExecutionTime(Command command, tlm::tlm_generic_payload return tRP_old; else if (command == Command::AutoRefresh) { - if (Configuration::getInstance().getRefMode() == 4) - return getElementFromMap(refreshTimings, - DramExtension::getExtension(payload).getBank()).tRFC4; - else if (Configuration::getInstance().getRefMode() == 2) - return getElementFromMap(refreshTimings, - DramExtension::getExtension(payload).getBank()).tRFC2; - else - return getElementFromMap(refreshTimings, - DramExtension::getExtension(payload).getBank()).tRFC; + return getElementFromMap(refreshTimings, + DramExtension::getExtension(payload).getBank()).tRFC; } else if (command == Command::PDNAX || command == Command::PDNPX || command == Command::SREFX) return clk; diff --git a/DRAMSys/library/src/controller/core/configuration/MemSpec.h b/DRAMSys/library/src/controller/core/configuration/MemSpec.h index 7a3ad2ca..7f5adacd 100644 --- a/DRAMSys/library/src/controller/core/configuration/MemSpec.h +++ b/DRAMSys/library/src/controller/core/configuration/MemSpec.h @@ -46,13 +46,9 @@ struct RefreshTiming { RefreshTiming() {} - RefreshTiming(sc_time tRFC, sc_time tREFI) : tRFC(tRFC), tRFC2(SC_ZERO_TIME), - tRFC4(SC_ZERO_TIME), tREFI(tREFI) {} - RefreshTiming(sc_time tRFC, sc_time tRFC2, sc_time tRFC4, - sc_time tREFI) : tRFC(tRFC), tRFC2(tRFC2), tRFC4(tRFC4), tREFI(tREFI) {} + RefreshTiming(sc_time tRFC, sc_time tREFI) : tRFC(tRFC), tREFI(tREFI) {} + sc_time tRFC; - sc_time tRFC2; - sc_time tRFC4; sc_time tREFI; }; @@ -110,9 +106,6 @@ struct MemSpec sc_time tNAW_old; // n activate window, TAW (two bank) in WideIO, FAW (four bank) else sc_time tRP_old; // precharge-time (pre -> act same bank) sc_time tRFC_old; // min ref->act delay 1X mode - // TODO: used in DDR4 and LPDDR4, remove in DramDDR3 and DramWideIO or everywhere - sc_time tRFC2; // min ref->act delay 2X mode - sc_time tRFC4; // min ref->act delay 4X mode sc_time tREFI_old; // auto refresh must be issued at an average periodic interval tREFI sc_time tCCD_S_old; // max(bl, tCCD) is relevant for rd->rd sc_time tCCD_L_old; diff --git a/DRAMSys/library/src/controller/core/refresh/RefreshManager.cpp b/DRAMSys/library/src/controller/core/refresh/RefreshManager.cpp index 719a19d6..0a309fce 100644 --- a/DRAMSys/library/src/controller/core/refresh/RefreshManager.cpp +++ b/DRAMSys/library/src/controller/core/refresh/RefreshManager.cpp @@ -50,7 +50,7 @@ RefreshManager::RefreshManager(sc_module_name, { auto m = controllerCore.config.getRefMode(); tREFIx = timing.tREFI / m; - tRFCx = m == 4 ? timing.tRFC4 : m == 2 ? timing.tRFC2 : timing.tRFC; + tRFCx = timing.tRFC; postponeEnabled = controllerCore.config.ControllerCoreRefEnablePostpone; pullInEnabled = controllerCore.config.ControllerCoreRefEnablePullIn; maxpostpone = controllerCore.config.ControllerCoreRefMaxPostponed * m; diff --git a/DRAMSys/library/src/controller/core/refresh/RefreshManagerBankwise.cpp b/DRAMSys/library/src/controller/core/refresh/RefreshManagerBankwise.cpp index d060ec7d..8c2b907d 100644 --- a/DRAMSys/library/src/controller/core/refresh/RefreshManagerBankwise.cpp +++ b/DRAMSys/library/src/controller/core/refresh/RefreshManagerBankwise.cpp @@ -48,7 +48,7 @@ RefreshManagerBankwise::RefreshManagerBankwise(sc_module_name, { auto m = controllerCore.config.getRefMode(); tREFIx = timing.tREFI / m; - tRFCx = m == 4 ? timing.tRFC4 : m == 2 ? timing.tRFC2 : timing.tRFC; + tRFCx = timing.tRFC; postponeEnabled = controllerCore.config.ControllerCoreRefEnablePostpone; pullInEnabled = controllerCore.config.ControllerCoreRefEnablePullIn; maxpostpone = controllerCore.config.ControllerCoreRefMaxPostponed * m; diff --git a/DRAMSys/library/src/controller/core/scheduling/checker/ActBChecker.cpp b/DRAMSys/library/src/controller/core/scheduling/checker/ActBChecker.cpp index bb75b65f..d16b788d 100644 --- a/DRAMSys/library/src/controller/core/scheduling/checker/ActBChecker.cpp +++ b/DRAMSys/library/src/controller/core/scheduling/checker/ActBChecker.cpp @@ -62,13 +62,7 @@ void ActBChecker::delayToSatisfyConstraints(ScheduledCommand &cmd) const config.memSpec->tWL + config.memSpec->getWriteAccessTime() + config.memSpec->tWR + config.memSpec->tRP_old); } else if (lcb.getCommand() == Command::AutoRefresh) { - auto m = Configuration::getInstance().getRefMode(); - if (m == 4) - cmd.establishMinDistanceFromStart(lcb.getStart(), config.memSpec->tRFC4); - else if (m == 2) - cmd.establishMinDistanceFromStart(lcb.getStart(), config.memSpec->tRFC2); - else - cmd.establishMinDistanceFromStart(lcb.getStart(), config.memSpec->tRFC_old); + cmd.establishMinDistanceFromStart(lcb.getStart(), config.memSpec->tRFC_old); } else if (lcb.getCommand() == Command::PDNPX || lcb.getCommand() == Command::PDNAX) { cmd.establishMinDistanceFromStart(lcb.getStart(), config.memSpec->tXP); diff --git a/DRAMSys/library/src/controller/core/scheduling/checker/ActivateChecker.cpp b/DRAMSys/library/src/controller/core/scheduling/checker/ActivateChecker.cpp index 491241db..576cc276 100644 --- a/DRAMSys/library/src/controller/core/scheduling/checker/ActivateChecker.cpp +++ b/DRAMSys/library/src/controller/core/scheduling/checker/ActivateChecker.cpp @@ -65,16 +65,8 @@ void ActivateChecker::delayToSatisfyConstraints(ScheduledCommand &command) const config.memSpec->tWL + config.memSpec->getWriteAccessTime() + config.memSpec->tWR + config.memSpec->tRP_old); } else if (lastCommandOnBank.getCommand() == Command::AutoRefresh) { - auto m = Configuration::getInstance().getRefMode(); - if (m == 4) - command.establishMinDistanceFromStart(lastCommandOnBank.getStart(), - config.memSpec->tRFC4); - else if (m == 2) - command.establishMinDistanceFromStart(lastCommandOnBank.getStart(), - config.memSpec->tRFC2); - else - command.establishMinDistanceFromStart(lastCommandOnBank.getStart(), - config.memSpec->tRFC_old); + command.establishMinDistanceFromStart(lastCommandOnBank.getStart(), + config.memSpec->tRFC_old); } else if (lastCommandOnBank.getCommand() == Command::PDNPX || lastCommandOnBank.getCommand() == Command::PDNAX) { command.establishMinDistanceFromStart(lastCommandOnBank.getStart(), diff --git a/DRAMSys/library/src/controller/core/scheduling/checker/PowerDownChecker.cpp b/DRAMSys/library/src/controller/core/scheduling/checker/PowerDownChecker.cpp index 4867a332..fd0b2ef5 100644 --- a/DRAMSys/library/src/controller/core/scheduling/checker/PowerDownChecker.cpp +++ b/DRAMSys/library/src/controller/core/scheduling/checker/PowerDownChecker.cpp @@ -54,13 +54,7 @@ sc_time PowerDownChecker::getTimeConstraintToEnterPowerDown(Command lastCmd, constraint = config.memSpec->tWL + config.memSpec->getWriteAccessTime() + config.memSpec->tWR + config.memSpec->clk; } else if (lastCmd == Command::AutoRefresh) { - auto m = Configuration::getInstance().getRefMode(); - if (m == 4) - constraint = config.memSpec->tRFC4; - else if (m == 2) - constraint = config.memSpec->tRFC2; - else - constraint = config.memSpec->tRFC_old; + constraint = config.memSpec->tRFC_old; } else if (lastCmd == Command::PDNPX || lastCmd == Command::PDNAX) { constraint = config.memSpec->tXP; } else if (lastCmd == Command::SREFX) { diff --git a/DRAMSys/library/src/controller/core/scheduling/checker/PrechargeAllChecker.cpp b/DRAMSys/library/src/controller/core/scheduling/checker/PrechargeAllChecker.cpp index 95a33009..5c302ef9 100644 --- a/DRAMSys/library/src/controller/core/scheduling/checker/PrechargeAllChecker.cpp +++ b/DRAMSys/library/src/controller/core/scheduling/checker/PrechargeAllChecker.cpp @@ -70,16 +70,8 @@ const config.memSpec->tWL + config.memSpec->getWriteAccessTime() + config.memSpec->tWR + config.memSpec->tRP_old); } else if (lastCommand.getCommand() == Command::AutoRefresh) { - auto m = Configuration::getInstance().getRefMode(); - if (m == 4) - command.establishMinDistanceFromStart(lastCommand.getStart(), - config.memSpec->tRFC4); - else if (m == 2) - command.establishMinDistanceFromStart(lastCommand.getStart(), - config.memSpec->tRFC2); - else - command.establishMinDistanceFromStart(lastCommand.getStart(), - config.memSpec->tRFC_old); + command.establishMinDistanceFromStart(lastCommand.getStart(), + config.memSpec->tRFC_old); } else if (lastCommand.getCommand() == Command::PDNAX || lastCommand.getCommand() == Command::PDNPX) { command.establishMinDistanceFromStart(lastCommand.getStart(), diff --git a/DRAMSys/library/src/simulation/DRAMSys.cpp b/DRAMSys/library/src/simulation/DRAMSys.cpp index 5f1f1fa4..a472c40f 100644 --- a/DRAMSys/library/src/simulation/DRAMSys.cpp +++ b/DRAMSys/library/src/simulation/DRAMSys.cpp @@ -108,11 +108,6 @@ DRAMSys::DRAMSys(sc_module_name __attribute__((unused)) name, AddressDecoder::getInstance().print(); - ConfigurationLoader::loadMemSpec(Configuration::getInstance(), - pathToResources - + "configs/memspecs/" - + memspec); - // Setup the memory controller with the propriate xml file ConfigurationLoader::loadMCConfig(Configuration::getInstance(), pathToResources @@ -129,6 +124,11 @@ DRAMSys::DRAMSys(sc_module_name __attribute__((unused)) name, + "configs/thermalsim/" + thermalconfig); + ConfigurationLoader::loadMemSpec(Configuration::getInstance(), + pathToResources + + "configs/memspecs/" + + memspec); + // If a simulation file is passed as argument to DRAMSys the simulation ID // is prepended to the simulation name if found. std::string simName; diff --git a/DRAMSys/library/src/simulation/Dram.cpp b/DRAMSys/library/src/simulation/Dram.cpp index 88383062..7228216e 100644 --- a/DRAMSys/library/src/simulation/Dram.cpp +++ b/DRAMSys/library/src/simulation/Dram.cpp @@ -108,13 +108,7 @@ Dram::Dram(sc_module_name) : tSocket("socket") memTimingSpec.RC = memSpec->tRC / clk; memTimingSpec.RCD = memSpec->tRCD / clk; memTimingSpec.REFI = memSpec->tREFI_old / clk; - unsigned m = Configuration::getInstance().getRefMode(); - if (m == 4) - memTimingSpec.RFC = memSpec->tRFC4 / clk; - else if (m == 2) - memTimingSpec.RFC = memSpec->tRFC2 / clk; - else - memTimingSpec.RFC = memSpec->tRFC_old / clk; + memTimingSpec.RFC = memSpec->tRFC_old / clk; memTimingSpec.RL = memSpec->tRL / clk; memTimingSpec.RP = memSpec->tRP_old / clk; memTimingSpec.RRD = memSpec->tRRD_S_old / clk;