Staggered power-down with all-bank refresh is working.
This commit is contained in:
@@ -151,7 +151,8 @@ SOURCES += \
|
||||
src/simulation/dram/DramGDDR5.cpp \
|
||||
src/simulation/dram/DramGDDR5X.cpp \
|
||||
src/simulation/dram/DramGDDR6.cpp \
|
||||
src/controller/powerdown/PowerDownManager.cpp
|
||||
src/controller/powerdown/PowerDownManager.cpp \
|
||||
src/controller/powerdown/PowerDownManagerDummy.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/common/third_party/tinyxml2/tinyxml2.h \
|
||||
@@ -235,7 +236,9 @@ HEADERS += \
|
||||
src/simulation/dram/DramGDDR5.h \
|
||||
src/simulation/dram/DramGDDR5X.h \
|
||||
src/simulation/dram/DramGDDR6.h \
|
||||
src/controller/powerdown/PowerDownManager.h
|
||||
src/controller/powerdown/PowerDownManager.h \
|
||||
src/controller/powerdown/PowerDownManagerIF.h \
|
||||
src/controller/powerdown/PowerDownManagerDummy.h
|
||||
#src/common/third_party/json/include/nlohmann/json.hpp \
|
||||
|
||||
thermalsim = $$(THERMALSIM)
|
||||
|
||||
@@ -153,7 +153,7 @@ Controller::Controller(sc_module_name name) :
|
||||
{
|
||||
PowerDownManagerIF *manager = new PowerDownManager(Rank(rankID), checker);
|
||||
powerDownManagers.push_back(manager);
|
||||
manager->triggerEntry(TriggerSource::Constructor);
|
||||
manager->triggerEntry(TriggerSource::Controller);
|
||||
controllerEvent.notify(manager->start());
|
||||
}
|
||||
}
|
||||
@@ -239,6 +239,7 @@ void Controller::controllerMethod()
|
||||
}
|
||||
|
||||
// (4) Start refresh and power-down managers to issue requests for the current time
|
||||
// TODO: check if the order of start() matters
|
||||
for (auto it : refreshManagers)
|
||||
it->start();
|
||||
for (auto it : powerDownManagers)
|
||||
@@ -246,31 +247,36 @@ void Controller::controllerMethod()
|
||||
|
||||
// (5) Choose one request and send it to DRAM
|
||||
std::pair<Command, tlm_generic_payload *> commandPair;
|
||||
std::vector<std::pair<Command, tlm_generic_payload *>> readyCommands;
|
||||
bool readyCmdBlocked = false;
|
||||
// TODO: check if all parts have to be called
|
||||
// (5.1) Check for bank commands (PRE, ACT, RD/RDA or WR/WRA)
|
||||
for (auto it : bankMachines)
|
||||
{
|
||||
commandPair = it->getNextCommand();
|
||||
if (commandPair.second != nullptr)
|
||||
readyCommands.push_back(commandPair);
|
||||
}
|
||||
// (5.2) Check for refresh commands (PREA/PRE or REFA/REFB)
|
||||
for (auto it : refreshManagers)
|
||||
{
|
||||
commandPair = it->getNextCommand();
|
||||
if (commandPair.second != nullptr)
|
||||
readyCommands.push_back(commandPair);
|
||||
}
|
||||
// (5.3) Check for power-down commands (...TODO)
|
||||
std::vector<std::pair<Command, tlm_generic_payload *>> readyCommands;
|
||||
// (5.1) Check for power-down commands (PDEA/PDEP/SREFEN or PDXA/PDXP/SREFEX)
|
||||
for (auto it : powerDownManagers)
|
||||
{
|
||||
commandPair = it->getNextCommand();
|
||||
if (commandPair.second != nullptr)
|
||||
readyCommands.push_back(commandPair);
|
||||
}
|
||||
if (readyCommands.empty())
|
||||
{
|
||||
// (5.2) Check for refresh commands (PREA/PRE or REFA/REFB)
|
||||
for (auto it : refreshManagers)
|
||||
{
|
||||
commandPair = it->getNextCommand();
|
||||
if (commandPair.second != nullptr)
|
||||
readyCommands.push_back(commandPair);
|
||||
}
|
||||
if (readyCommands.empty())
|
||||
{
|
||||
// (5.3) Check for bank commands (PRE, ACT, RD/RDA or WR/WRA)
|
||||
for (auto it : bankMachines)
|
||||
{
|
||||
commandPair = it->getNextCommand();
|
||||
if (commandPair.second != nullptr)
|
||||
readyCommands.push_back(commandPair);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool readyCmdBlocked = false;
|
||||
if (!readyCommands.empty())
|
||||
{
|
||||
commandPair = commandMux->selectCommand(readyCommands);
|
||||
|
||||
@@ -54,19 +54,26 @@ void PowerDownManager::triggerEntry(TriggerSource source)
|
||||
void PowerDownManager::triggerExit(TriggerSource source)
|
||||
{
|
||||
if (source == TriggerSource::Controller)
|
||||
controllerIdle = false;
|
||||
|
||||
if (state == PdmState::Idle) // Controller triggered entry, refresh triggers exit
|
||||
triggered = false;
|
||||
else if (state == PdmState::PrechargePd && source == TriggerSource::RefreshManager && !triggered)
|
||||
{ // last !triggered has to be checked that normal trigger is not overwritten
|
||||
triggered = true;
|
||||
enterSelfRefresh = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
triggered = true;
|
||||
controllerIdle = false;
|
||||
enterSelfRefresh = false;
|
||||
|
||||
if (state == PdmState::Idle)
|
||||
triggered = false;
|
||||
else
|
||||
triggered = true;
|
||||
}
|
||||
else // if (source == TriggerSource::RefreshManager)
|
||||
{
|
||||
if (state == PdmState::Idle && !enterSelfRefresh)
|
||||
triggered = false;
|
||||
else if (state == PdmState::PrechargePd && !triggered)
|
||||
{
|
||||
triggered = true;
|
||||
enterSelfRefresh = true;
|
||||
}
|
||||
else if (state == PdmState::ActivePd) // TODO: check if normal else is also ok here
|
||||
triggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +94,9 @@ sc_time PowerDownManager::start()
|
||||
{
|
||||
if (state == PdmState::Idle)
|
||||
{
|
||||
if (activatedBanks == 0)
|
||||
if (enterSelfRefresh)
|
||||
nextCommand = Command::SREFEN;
|
||||
else if (activatedBanks == 0)
|
||||
nextCommand = Command::PDEP;
|
||||
else
|
||||
nextCommand = Command::PDEA;
|
||||
@@ -95,12 +104,7 @@ sc_time PowerDownManager::start()
|
||||
else if (state == PdmState::ActivePd)
|
||||
nextCommand = Command::PDXA;
|
||||
else if (state == PdmState::PrechargePd)
|
||||
{
|
||||
if (enterSelfRefresh)
|
||||
nextCommand = Command::SREFEN;
|
||||
else
|
||||
nextCommand = Command::PDXP;
|
||||
}
|
||||
nextCommand = Command::PDXP;
|
||||
else if (state == PdmState::SelfRefresh)
|
||||
nextCommand = Command::SREFEX;
|
||||
else // if (state == PdmState::Refresh)
|
||||
@@ -137,15 +141,19 @@ void PowerDownManager::updateState(Command command)
|
||||
triggered = false;
|
||||
enterSelfRefresh = false;
|
||||
}
|
||||
else if (command == Command::PDXA || command == Command::PDXP)
|
||||
else if (command == Command::PDXA)
|
||||
{
|
||||
state = PdmState::Idle;
|
||||
triggered = false;
|
||||
}
|
||||
else if (command == Command::SREFEX)
|
||||
else if (command == Command::PDXP)
|
||||
{
|
||||
state = PdmState::Refresh;
|
||||
state = PdmState::Idle;
|
||||
if (!enterSelfRefresh)
|
||||
triggered = false;
|
||||
}
|
||||
else if (command == Command::SREFEX)
|
||||
state = PdmState::Refresh;
|
||||
else if (command == Command::REFA && state == PdmState::Refresh)
|
||||
{
|
||||
state = PdmState::Idle;
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
using namespace tlm;
|
||||
|
||||
enum class TriggerSource {Constructor, Controller, RefreshManager};
|
||||
enum class TriggerSource {Controller, RefreshManager};
|
||||
|
||||
class PowerDownManagerIF
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user