Simplify command multiplexers.

This commit is contained in:
Lukas Steiner
2020-09-25 11:36:22 +02:00
parent 2097351050
commit cb45722399
3 changed files with 19 additions and 27 deletions

View File

@@ -40,31 +40,27 @@ using namespace tlm;
CommandTuple::Type CmdMuxOldest::selectCommand(ReadyCommands &readyCommands)
{
readyCommands.erase(std::remove_if(readyCommands.begin(), readyCommands.end(),
[](CommandTuple::Type element) {
return std::get<CommandTuple::Timestamp>(element) != sc_time_stamp();
}),
readyCommands.end());
auto result = readyCommands.cend();
auto it = readyCommands.cbegin();
uint64_t lastPayloadID = UINT64_MAX;
uint64_t newPayloadID = 0;
if (!readyCommands.empty())
while (it != readyCommands.cend())
{
auto it = readyCommands.begin();
auto result = it;
uint64_t lastPayloadID = DramExtension::getPayloadID(std::get<CommandTuple::Payload>(*it));
it++;
while (it != readyCommands.end())
if (std::get<CommandTuple::Timestamp>(*it) == sc_time_stamp())
{
uint64_t newPayloadID = DramExtension::getPayloadID(std::get<CommandTuple::Payload>(*it));
newPayloadID = DramExtension::getPayloadID(std::get<CommandTuple::Payload>(*it));
if (newPayloadID < lastPayloadID)
{
lastPayloadID = newPayloadID;
result = it;
}
it++;
}
return *result;
it++;
}
if (lastPayloadID != UINT64_MAX)
return *result;
else
return CommandTuple::Type(Command::NOP, nullptr, sc_max_time());
}

View File

@@ -38,18 +38,11 @@
using namespace tlm;
CommandTuple::Type
CmdMuxStrict::selectCommand(ReadyCommands &readyCommands)
CommandTuple::Type CmdMuxStrict::selectCommand(ReadyCommands &readyCommands)
{
readyCommands.erase(std::remove_if(readyCommands.begin(), readyCommands.end(),
[](CommandTuple::Type element) {
return std::get<CommandTuple::Timestamp>(element) != sc_time_stamp();
}),
readyCommands.end());
if (!readyCommands.empty())
for (auto it : readyCommands)
{
for (auto it : readyCommands)
if (std::get<CommandTuple::Timestamp>(it) == sc_time_stamp())
{
if (isCasCommand(std::get<CommandTuple::Command>(it)))
{
@@ -60,7 +53,10 @@ CmdMuxStrict::selectCommand(ReadyCommands &readyCommands)
}
}
}
for (auto it : readyCommands)
}
for (auto it : readyCommands)
{
if (std::get<CommandTuple::Timestamp>(it) == sc_time_stamp())
{
if (isRasCommand(std::get<CommandTuple::Command>(it)))
return it;

View File

@@ -40,7 +40,7 @@ using namespace tlm;
PowerDownManagerStaggered::PowerDownManagerStaggered(Rank rank, CheckerIF *checker)
: rank(rank), checker(checker)
{
setUpDummy(powerDownPayload, UINT64_MAX, rank);
setUpDummy(powerDownPayload, UINT64_MAX - 1, rank);
}
void PowerDownManagerStaggered::triggerEntry()