diff --git a/dram/.settings/language.settings.xml b/dram/.settings/language.settings.xml index 278289a3..127cd8ac 100644 --- a/dram/.settings/language.settings.xml +++ b/dram/.settings/language.settings.xml @@ -4,7 +4,7 @@ - + diff --git a/dram/resources/configs/memconfigs/memconfig.xml b/dram/resources/configs/memconfigs/memconfig.xml index 3ce4d645..0446a0fb 100644 --- a/dram/resources/configs/memconfigs/memconfig.xml +++ b/dram/resources/configs/memconfigs/memconfig.xml @@ -1,7 +1,6 @@ - - + diff --git a/dram/src/core/ControllerCore.cpp b/dram/src/core/ControllerCore.cpp index a186aaef..0a5b2b81 100644 --- a/dram/src/core/ControllerCore.cpp +++ b/dram/src/core/ControllerCore.cpp @@ -35,15 +35,16 @@ ControllerCore::ControllerCore(IWrapperConnector& wrapperConnector, std::mapisInvalidated(payload, time)) return; - if (!powerDownManager->isInSelfRefresh(bank)) + if (config.BankwiseLogic) { - if(config.BankwiseRefresh) + if (!powerDownManager->isInSelfRefresh(bank)) { printDebugMessage("Waking up bank " + to_string(bank.ID()) + " for refresh"); - powerDownManager->wakeUpForRefresh(bank, time);//expects PDNA and PDNP to exit without delay + powerDownManager->wakeUpForRefresh(bank, time); //expects PDNA and PDNP to exit without delay + refreshManager->scheduleRefresh(payload, time); } - else + } + else if (!config.BankwiseLogic) + { + if (!powerDownManager->allBanksInSelfRefresh()) { printDebugMessage("Waking up all banks for refresh"); powerDownManager->wakeUpAllForRefresh(time); + refreshManager->scheduleRefresh(payload, time); } - - refreshManager->scheduleRefresh(payload, time); } } @@ -184,7 +188,6 @@ void ControllerCore::send(const CommandSchedule& schedule, tlm::tlm_generic_payl } } - ICommandChecker& ControllerCore::getCommandChecker(Command command) { return *getElementFromMap(commandChecker, command); diff --git a/dram/src/core/configuration/Configuration.h b/dram/src/core/configuration/Configuration.h index 79e81370..793bd14b 100644 --- a/dram/src/core/configuration/Configuration.h +++ b/dram/src/core/configuration/Configuration.h @@ -37,10 +37,9 @@ struct Configuration TimingConfiguration Timings; //MemConfiguration - bool BankwiseRefresh; - bool BankwisePowerDown; + bool BankwiseLogic; bool OpenPagePolicy; - bool adaptiveOpenPagePolicy; + bool AdaptiveOpenPagePolicy; private: Configuration(); diff --git a/dram/src/core/configuration/MemSpecLoader.cpp b/dram/src/core/configuration/MemSpecLoader.cpp index 92bb217d..91fef841 100644 --- a/dram/src/core/configuration/MemSpecLoader.cpp +++ b/dram/src/core/configuration/MemSpecLoader.cpp @@ -46,10 +46,9 @@ void MemSpecLoader::loadConfig(Configuration& config, XMLElement* memspec) //MemConfiguration XMLElement* configuration = memspec->FirstChildElement("memconfig"); - config.BankwiseRefresh = queryBoolParameter(configuration, "bankwiseRefresh"); - config.BankwisePowerDown = queryBoolParameter(configuration, "bankwisePowerDown"); + config.BankwiseLogic = queryBoolParameter(configuration, "bankwiseLogic"); config.OpenPagePolicy = queryBoolParameter(configuration, "openPagePolicy"); - config.adaptiveOpenPagePolicy = queryBoolParameter(configuration, "adaptiveOpenPagePolicy"); + config.AdaptiveOpenPagePolicy = queryBoolParameter(configuration, "adaptiveOpenPagePolicy"); } void MemSpecLoader::loadDDR4(Configuration& config, XMLElement* memspec) diff --git a/dram/src/core/powerdown/PowerDownManager.cpp b/dram/src/core/powerdown/PowerDownManager.cpp index cad6e705..e772ae48 100644 --- a/dram/src/core/powerdown/PowerDownManager.cpp +++ b/dram/src/core/powerdown/PowerDownManager.cpp @@ -114,6 +114,16 @@ bool PowerDownManager::isInSelfRefresh(Bank bank) return getPowerDownState(bank) == PowerDownState::PDNSelfRefresh; } +bool PowerDownManager::allBanksInSelfRefresh() +{ + for (Bank bank : controller.getBanks()) + { + if(!isInSelfRefresh(bank)) + return false; + } + return true; +} + bool PowerDownManager::isAwakeForRefresh(Bank bank) { return getPowerDownState(bank) == PowerDownState::AwakeForRefresh; diff --git a/dram/src/core/powerdown/PowerDownManager.h b/dram/src/core/powerdown/PowerDownManager.h index 4ae685e0..62b274dc 100644 --- a/dram/src/core/powerdown/PowerDownManager.h +++ b/dram/src/core/powerdown/PowerDownManager.h @@ -37,6 +37,7 @@ public: virtual void wakeUpAllForRefresh(sc_time time); virtual bool isInSelfRefresh(Bank bank); + virtual bool allBanksInSelfRefresh(); virtual bool isInPowerDown(Bank bank); virtual bool isAwake(Bank bank); virtual bool isAwakeForRefresh(Bank bank);