New oldest cmd mux working.
This commit is contained in:
@@ -45,7 +45,7 @@ class CmdMuxIF
|
||||
{
|
||||
public:
|
||||
virtual ~CmdMuxIF() {}
|
||||
virtual CommandTuple::Type selectCommand(ReadyCommands &) = 0;
|
||||
virtual CommandTuple::Type selectCommand(const ReadyCommands &) = 0;
|
||||
};
|
||||
|
||||
#endif // CMDMUXIF_H
|
||||
|
||||
@@ -40,7 +40,7 @@ using namespace tlm;
|
||||
|
||||
CmdMuxOldest::CmdMuxOldest() : memSpec(Configuration::getInstance().memSpec) {}
|
||||
|
||||
CommandTuple::Type CmdMuxOldest::selectCommand(ReadyCommands &readyCommands)
|
||||
CommandTuple::Type CmdMuxOldest::selectCommand(const ReadyCommands &readyCommands)
|
||||
{
|
||||
auto result = readyCommands.cend();
|
||||
uint64_t lastPayloadID = UINT64_MAX;
|
||||
@@ -51,7 +51,7 @@ CommandTuple::Type CmdMuxOldest::selectCommand(ReadyCommands &readyCommands)
|
||||
for (auto it = readyCommands.cbegin(); it != readyCommands.cend(); it++)
|
||||
{
|
||||
newTimestamp = std::get<CommandTuple::Timestamp>(*it) +
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it)) - memSpec->tCK;
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it));
|
||||
newPayloadID = DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*it));
|
||||
|
||||
if (newTimestamp < lastTimestamp)
|
||||
@@ -84,7 +84,7 @@ CmdMuxOldestRasCas::CmdMuxOldestRasCas() : memSpec(Configuration::getInstance().
|
||||
readyCasCommands.reserve(memSpec->numberOfBanks);
|
||||
}
|
||||
|
||||
CommandTuple::Type CmdMuxOldestRasCas::selectCommand(ReadyCommands &readyCommands)
|
||||
CommandTuple::Type CmdMuxOldestRasCas::selectCommand(const ReadyCommands &readyCommands)
|
||||
{
|
||||
readyRasCommands.clear();
|
||||
readyCasCommands.clear();
|
||||
@@ -97,6 +97,7 @@ CommandTuple::Type CmdMuxOldestRasCas::selectCommand(ReadyCommands &readyCommand
|
||||
readyCasCommands.emplace_back(it);
|
||||
}
|
||||
|
||||
auto result = readyCommands.cend();
|
||||
auto resultRas = readyRasCommands.cend();
|
||||
auto resultCas = readyCasCommands.cend();
|
||||
|
||||
@@ -108,7 +109,7 @@ CommandTuple::Type CmdMuxOldestRasCas::selectCommand(ReadyCommands &readyCommand
|
||||
for (auto it = readyRasCommands.cbegin(); it != readyRasCommands.cend(); it++)
|
||||
{
|
||||
newTimestamp = std::get<CommandTuple::Timestamp>(*it) +
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it)) - memSpec->tCK;
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it));
|
||||
newPayloadID = DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*it));
|
||||
|
||||
if (newTimestamp < lastTimestamp)
|
||||
@@ -133,7 +134,7 @@ CommandTuple::Type CmdMuxOldestRasCas::selectCommand(ReadyCommands &readyCommand
|
||||
for (auto it = readyCasCommands.cbegin(); it != readyCasCommands.cend(); it++)
|
||||
{
|
||||
newTimestamp = std::get<CommandTuple::Timestamp>(*it) +
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it)) - memSpec->tCK;
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it));
|
||||
newPayloadID = DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*it));
|
||||
|
||||
if (newTimestamp < lastTimestamp)
|
||||
@@ -152,38 +153,40 @@ CommandTuple::Type CmdMuxOldestRasCas::selectCommand(ReadyCommands &readyCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (resultRas != readyRasCommands.cend() && resultCas != readyCasCommands.cend())
|
||||
readyRasCasCommands.clear();
|
||||
|
||||
if (resultRas != readyRasCommands.cend())
|
||||
readyRasCasCommands.emplace_back(*resultRas);
|
||||
if (resultCas != readyCasCommands.cend())
|
||||
readyRasCasCommands.emplace_back(*resultCas);
|
||||
|
||||
lastPayloadID = UINT64_MAX;
|
||||
lastTimestamp = sc_max_time();
|
||||
|
||||
for (auto it = readyRasCasCommands.cbegin(); it != readyRasCasCommands.cend(); it++)
|
||||
{
|
||||
if (std::get<CommandTuple::Timestamp>(*resultRas) == sc_time_stamp()
|
||||
&& std::get<CommandTuple::Timestamp>(*resultCas) == sc_time_stamp())
|
||||
newTimestamp = std::get<CommandTuple::Timestamp>(*it);
|
||||
newPayloadID = DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*it));
|
||||
|
||||
if (newTimestamp < lastTimestamp)
|
||||
{
|
||||
if (DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*resultRas))
|
||||
<= DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*resultCas)))
|
||||
return *resultRas;
|
||||
else
|
||||
return *resultCas;
|
||||
lastTimestamp = newTimestamp;
|
||||
lastPayloadID = newPayloadID;
|
||||
result = it;
|
||||
}
|
||||
else if (newTimestamp == lastTimestamp)
|
||||
{
|
||||
if (newPayloadID < lastPayloadID)
|
||||
{
|
||||
lastPayloadID = newPayloadID;
|
||||
result = it;
|
||||
}
|
||||
}
|
||||
else if (std::get<CommandTuple::Timestamp>(*resultRas) == sc_time_stamp())
|
||||
return *resultRas;
|
||||
else if (std::get<CommandTuple::Timestamp>(*resultCas) == sc_time_stamp())
|
||||
return *resultCas;
|
||||
else
|
||||
return CommandTuple::Type(Command::NOP, nullptr, sc_max_time());
|
||||
}
|
||||
else if (resultRas != readyRasCommands.cend())
|
||||
{
|
||||
if (std::get<CommandTuple::Timestamp>(*resultRas) == sc_time_stamp())
|
||||
return *resultRas;
|
||||
else
|
||||
return CommandTuple::Type(Command::NOP, nullptr, sc_max_time());
|
||||
}
|
||||
else if (resultCas != readyCasCommands.cend())
|
||||
{
|
||||
if (std::get<CommandTuple::Timestamp>(*resultCas) == sc_time_stamp())
|
||||
return *resultCas;
|
||||
else
|
||||
return CommandTuple::Type(Command::NOP, nullptr, sc_max_time());
|
||||
}
|
||||
|
||||
if (result != readyCommands.cend() &&
|
||||
std::get<CommandTuple::Timestamp>(*result) == sc_time_stamp())
|
||||
return *result;
|
||||
else
|
||||
return CommandTuple::Type(Command::NOP, nullptr, sc_max_time());
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class CmdMuxOldest : public CmdMuxIF
|
||||
{
|
||||
public:
|
||||
CmdMuxOldest();
|
||||
CommandTuple::Type selectCommand(ReadyCommands &);
|
||||
virtual CommandTuple::Type selectCommand(const ReadyCommands &) override;
|
||||
|
||||
private:
|
||||
const MemSpec *memSpec;
|
||||
@@ -53,12 +53,13 @@ class CmdMuxOldestRasCas : public CmdMuxIF
|
||||
{
|
||||
public:
|
||||
CmdMuxOldestRasCas();
|
||||
CommandTuple::Type selectCommand(ReadyCommands &);
|
||||
virtual CommandTuple::Type selectCommand(const ReadyCommands &) override;
|
||||
|
||||
private:
|
||||
const MemSpec *memSpec;
|
||||
ReadyCommands readyRasCommands;
|
||||
ReadyCommands readyCasCommands;
|
||||
ReadyCommands readyRasCasCommands;
|
||||
};
|
||||
|
||||
#endif // CMDMUXOLDEST_H
|
||||
|
||||
@@ -40,7 +40,7 @@ using namespace tlm;
|
||||
|
||||
CmdMuxStrict::CmdMuxStrict() : memSpec(Configuration::getInstance().memSpec) {}
|
||||
|
||||
CommandTuple::Type CmdMuxStrict::selectCommand(ReadyCommands &readyCommands)
|
||||
CommandTuple::Type CmdMuxStrict::selectCommand(const ReadyCommands &readyCommands)
|
||||
{
|
||||
auto result = readyCommands.cend();
|
||||
uint64_t lastPayloadID = UINT64_MAX;
|
||||
@@ -51,7 +51,7 @@ CommandTuple::Type CmdMuxStrict::selectCommand(ReadyCommands &readyCommands)
|
||||
for (auto it = readyCommands.cbegin(); it != readyCommands.cend(); it++)
|
||||
{
|
||||
newTimestamp = std::get<CommandTuple::Timestamp>(*it) +
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it)) - memSpec->tCK;
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it));
|
||||
newPayloadID = DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*it));
|
||||
|
||||
if (newTimestamp < lastTimestamp)
|
||||
@@ -111,7 +111,7 @@ CmdMuxStrictRasCas::CmdMuxStrictRasCas() : memSpec(Configuration::getInstance().
|
||||
readyCasCommands.reserve(memSpec->numberOfBanks);
|
||||
}
|
||||
|
||||
CommandTuple::Type CmdMuxStrictRasCas::selectCommand(ReadyCommands &readyCommands)
|
||||
CommandTuple::Type CmdMuxStrictRasCas::selectCommand(const ReadyCommands &readyCommands)
|
||||
{
|
||||
readyRasCommands.clear();
|
||||
readyCasCommands.clear();
|
||||
@@ -124,6 +124,7 @@ CommandTuple::Type CmdMuxStrictRasCas::selectCommand(ReadyCommands &readyCommand
|
||||
readyCasCommands.emplace_back(it);
|
||||
}
|
||||
|
||||
auto result = readyCommands.cend();
|
||||
auto resultRas = readyRasCommands.cend();
|
||||
auto resultCas = readyCasCommands.cend();
|
||||
|
||||
@@ -135,7 +136,7 @@ CommandTuple::Type CmdMuxStrictRasCas::selectCommand(ReadyCommands &readyCommand
|
||||
for (auto it = readyRasCommands.cbegin(); it != readyRasCommands.cend(); it++)
|
||||
{
|
||||
newTimestamp = std::get<CommandTuple::Timestamp>(*it) +
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it)) - memSpec->tCK;
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it));
|
||||
newPayloadID = DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*it));
|
||||
|
||||
if (newTimestamp < lastTimestamp)
|
||||
@@ -160,7 +161,7 @@ CommandTuple::Type CmdMuxStrictRasCas::selectCommand(ReadyCommands &readyCommand
|
||||
for (auto it = readyCasCommands.cbegin(); it != readyCasCommands.cend(); it++)
|
||||
{
|
||||
newTimestamp = std::get<CommandTuple::Timestamp>(*it) +
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it)) - memSpec->tCK;
|
||||
memSpec->getCommandLength(std::get<CommandTuple::Command>(*it));
|
||||
newPayloadID = DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*it));
|
||||
|
||||
if (newPayloadID == nextPayloadID)
|
||||
@@ -182,38 +183,40 @@ CommandTuple::Type CmdMuxStrictRasCas::selectCommand(ReadyCommands &readyCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (resultRas != readyRasCommands.cend() && resultCas != readyCasCommands.cend())
|
||||
readyRasCasCommands.clear();
|
||||
|
||||
if (resultRas != readyRasCommands.cend())
|
||||
readyRasCasCommands.emplace_back(*resultRas);
|
||||
if (resultCas != readyCasCommands.cend())
|
||||
readyRasCasCommands.emplace_back(*resultCas);
|
||||
|
||||
lastPayloadID = UINT64_MAX;
|
||||
lastTimestamp = sc_max_time();
|
||||
|
||||
for (auto it = readyRasCasCommands.cbegin(); it != readyRasCasCommands.cend(); it++)
|
||||
{
|
||||
if (std::get<CommandTuple::Timestamp>(*resultRas) == sc_time_stamp()
|
||||
&& std::get<CommandTuple::Timestamp>(*resultCas) == sc_time_stamp())
|
||||
newTimestamp = std::get<CommandTuple::Timestamp>(*it);
|
||||
newPayloadID = DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*it));
|
||||
|
||||
if (newTimestamp < lastTimestamp)
|
||||
{
|
||||
if (DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*resultRas))
|
||||
<= DramExtension::getChannelPayloadID(std::get<CommandTuple::Payload>(*resultCas)))
|
||||
return *resultRas;
|
||||
else
|
||||
return *resultCas;
|
||||
lastTimestamp = newTimestamp;
|
||||
lastPayloadID = newPayloadID;
|
||||
result = it;
|
||||
}
|
||||
else if (newTimestamp == lastTimestamp)
|
||||
{
|
||||
if (newPayloadID < lastPayloadID)
|
||||
{
|
||||
lastPayloadID = newPayloadID;
|
||||
result = it;
|
||||
}
|
||||
}
|
||||
else if (std::get<CommandTuple::Timestamp>(*resultRas) == sc_time_stamp())
|
||||
return *resultRas;
|
||||
else if (std::get<CommandTuple::Timestamp>(*resultCas) == sc_time_stamp())
|
||||
return *resultCas;
|
||||
else
|
||||
return CommandTuple::Type(Command::NOP, nullptr, sc_max_time());
|
||||
}
|
||||
else if (resultRas != readyRasCommands.cend())
|
||||
{
|
||||
if (std::get<CommandTuple::Timestamp>(*resultRas) == sc_time_stamp())
|
||||
return *resultRas;
|
||||
else
|
||||
return CommandTuple::Type(Command::NOP, nullptr, sc_max_time());
|
||||
}
|
||||
else if (resultCas != readyCasCommands.cend())
|
||||
{
|
||||
if (std::get<CommandTuple::Timestamp>(*resultCas) == sc_time_stamp())
|
||||
return *resultCas;
|
||||
else
|
||||
return CommandTuple::Type(Command::NOP, nullptr, sc_max_time());
|
||||
}
|
||||
|
||||
if (result != readyCommands.cend() &&
|
||||
std::get<CommandTuple::Timestamp>(*result) == sc_time_stamp())
|
||||
return *result;
|
||||
else
|
||||
return CommandTuple::Type(Command::NOP, nullptr, sc_max_time());
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class CmdMuxStrict : public CmdMuxIF
|
||||
{
|
||||
public:
|
||||
CmdMuxStrict();
|
||||
CommandTuple::Type selectCommand(ReadyCommands &);
|
||||
virtual CommandTuple::Type selectCommand(const ReadyCommands &) override;
|
||||
|
||||
private:
|
||||
uint64_t nextPayloadID = 1;
|
||||
@@ -53,13 +53,14 @@ class CmdMuxStrictRasCas : public CmdMuxIF
|
||||
{
|
||||
public:
|
||||
CmdMuxStrictRasCas();
|
||||
CommandTuple::Type selectCommand(ReadyCommands &);
|
||||
virtual CommandTuple::Type selectCommand(const ReadyCommands &) override;
|
||||
|
||||
private:
|
||||
uint64_t nextPayloadID = 1;
|
||||
const MemSpec *memSpec;
|
||||
ReadyCommands readyRasCommands;
|
||||
ReadyCommands readyCasCommands;
|
||||
ReadyCommands readyRasCasCommands;
|
||||
};
|
||||
|
||||
#endif // CMDMUXSTRICT_H
|
||||
|
||||
Reference in New Issue
Block a user