Add earliest time of issuance to command tuple and adapt cmd muxes.
This commit is contained in:
@@ -44,12 +44,9 @@ BankMachine::BankMachine(SchedulerIF *scheduler, CheckerIF *checker, Bank bank)
|
|||||||
bankgroup = BankGroup(bank.ID() / memSpec->banksPerGroup);
|
bankgroup = BankGroup(bank.ID() / memSpec->banksPerGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<Command, tlm_generic_payload *> BankMachine::getNextCommand()
|
std::tuple<Command, tlm_generic_payload *, sc_time> BankMachine::getNextCommand()
|
||||||
{
|
{
|
||||||
if (sc_time_stamp() == timeToSchedule)
|
return std::tuple<Command, tlm_generic_payload *, sc_time>(nextCommand, currentPayload, timeToSchedule);
|
||||||
return std::tuple<Command, tlm_generic_payload *>(nextCommand, currentPayload);
|
|
||||||
else
|
|
||||||
return std::tuple<Command, tlm_generic_payload *>(Command::NOP, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BankMachine::updateState(Command command)
|
void BankMachine::updateState(Command command)
|
||||||
@@ -124,6 +121,7 @@ BankMachineOpen::BankMachineOpen(SchedulerIF *scheduler, CheckerIF *checker, Ban
|
|||||||
sc_time BankMachineOpen::start()
|
sc_time BankMachineOpen::start()
|
||||||
{
|
{
|
||||||
timeToSchedule = sc_max_time();
|
timeToSchedule = sc_max_time();
|
||||||
|
nextCommand = Command::NOP;
|
||||||
|
|
||||||
if (sleeping)
|
if (sleeping)
|
||||||
return timeToSchedule;
|
return timeToSchedule;
|
||||||
@@ -134,30 +132,26 @@ sc_time BankMachineOpen::start()
|
|||||||
|
|
||||||
if (currentState == BmState::Precharged && !blocked) // row miss
|
if (currentState == BmState::Precharged && !blocked) // row miss
|
||||||
{
|
{
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::ACT, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::ACT;
|
nextCommand = Command::ACT;
|
||||||
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, bankgroup, bank);
|
||||||
}
|
}
|
||||||
else if (currentState == BmState::Activated)
|
else if (currentState == BmState::Activated)
|
||||||
{
|
{
|
||||||
if (DramExtension::getRow(currentPayload) == currentRow) // row hit
|
if (DramExtension::getRow(currentPayload) == currentRow) // row hit
|
||||||
{
|
{
|
||||||
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::RD, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::RD;
|
nextCommand = Command::RD;
|
||||||
}
|
|
||||||
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::WR, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::WR;
|
nextCommand = Command::WR;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
||||||
|
|
||||||
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, bankgroup, bank);
|
||||||
}
|
}
|
||||||
else if (!blocked) // row miss
|
else if (!blocked) // row miss
|
||||||
{
|
{
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::PRE, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::PRE;
|
nextCommand = Command::PRE;
|
||||||
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, bankgroup, bank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return timeToSchedule;
|
return timeToSchedule;
|
||||||
@@ -169,6 +163,7 @@ BankMachineClosed::BankMachineClosed(SchedulerIF *scheduler, CheckerIF *checker,
|
|||||||
sc_time BankMachineClosed::start()
|
sc_time BankMachineClosed::start()
|
||||||
{
|
{
|
||||||
timeToSchedule = sc_max_time();
|
timeToSchedule = sc_max_time();
|
||||||
|
nextCommand = Command::NOP;
|
||||||
|
|
||||||
if (sleeping)
|
if (sleeping)
|
||||||
return timeToSchedule;
|
return timeToSchedule;
|
||||||
@@ -179,23 +174,19 @@ sc_time BankMachineClosed::start()
|
|||||||
|
|
||||||
if (currentState == BmState::Precharged && !blocked) // row miss
|
if (currentState == BmState::Precharged && !blocked) // row miss
|
||||||
{
|
{
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::ACT, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::ACT;
|
nextCommand = Command::ACT;
|
||||||
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, bankgroup, bank);
|
||||||
}
|
}
|
||||||
else if (currentState == BmState::Activated)
|
else if (currentState == BmState::Activated)
|
||||||
{
|
{
|
||||||
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::RDA, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::RDA;
|
nextCommand = Command::RDA;
|
||||||
}
|
|
||||||
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::WRA, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::WRA;
|
nextCommand = Command::WRA;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
||||||
|
|
||||||
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, bankgroup, bank);
|
||||||
}
|
}
|
||||||
return timeToSchedule;
|
return timeToSchedule;
|
||||||
}
|
}
|
||||||
@@ -206,6 +197,7 @@ BankMachineOpenAdaptive::BankMachineOpenAdaptive(SchedulerIF *scheduler, Checker
|
|||||||
sc_time BankMachineOpenAdaptive::start()
|
sc_time BankMachineOpenAdaptive::start()
|
||||||
{
|
{
|
||||||
timeToSchedule = sc_max_time();
|
timeToSchedule = sc_max_time();
|
||||||
|
nextCommand = Command::NOP;
|
||||||
|
|
||||||
if (sleeping)
|
if (sleeping)
|
||||||
return timeToSchedule;
|
return timeToSchedule;
|
||||||
@@ -216,8 +208,8 @@ sc_time BankMachineOpenAdaptive::start()
|
|||||||
|
|
||||||
if (currentState == BmState::Precharged && !blocked) // row miss
|
if (currentState == BmState::Precharged && !blocked) // row miss
|
||||||
{
|
{
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::ACT, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::ACT;
|
nextCommand = Command::ACT;
|
||||||
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, bankgroup, bank);
|
||||||
}
|
}
|
||||||
else if (currentState == BmState::Activated)
|
else if (currentState == BmState::Activated)
|
||||||
{
|
{
|
||||||
@@ -226,38 +218,27 @@ sc_time BankMachineOpenAdaptive::start()
|
|||||||
if (scheduler->hasFurtherRequest(bank) && !scheduler->hasFurtherRowHit(bank, currentRow))
|
if (scheduler->hasFurtherRequest(bank) && !scheduler->hasFurtherRowHit(bank, currentRow))
|
||||||
{
|
{
|
||||||
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::RDA, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::RDA;
|
nextCommand = Command::RDA;
|
||||||
}
|
|
||||||
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::WRA, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::WRA;
|
nextCommand = Command::WRA;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::RD, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::RD;
|
nextCommand = Command::RD;
|
||||||
}
|
|
||||||
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::WR, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::WR;
|
nextCommand = Command::WR;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
||||||
}
|
}
|
||||||
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, bankgroup, bank);
|
||||||
}
|
}
|
||||||
else if (!blocked) // row miss
|
else if (!blocked) // row miss
|
||||||
{
|
{
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::PRE, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::PRE;
|
nextCommand = Command::PRE;
|
||||||
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, bankgroup, bank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return timeToSchedule;
|
return timeToSchedule;
|
||||||
@@ -269,6 +250,7 @@ BankMachineClosedAdaptive::BankMachineClosedAdaptive(SchedulerIF *scheduler, Che
|
|||||||
sc_time BankMachineClosedAdaptive::start()
|
sc_time BankMachineClosedAdaptive::start()
|
||||||
{
|
{
|
||||||
timeToSchedule = sc_max_time();
|
timeToSchedule = sc_max_time();
|
||||||
|
nextCommand = Command::NOP;
|
||||||
|
|
||||||
if (sleeping)
|
if (sleeping)
|
||||||
return timeToSchedule;
|
return timeToSchedule;
|
||||||
@@ -279,8 +261,8 @@ sc_time BankMachineClosedAdaptive::start()
|
|||||||
|
|
||||||
if (currentState == BmState::Precharged && !blocked) // row miss
|
if (currentState == BmState::Precharged && !blocked) // row miss
|
||||||
{
|
{
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::ACT, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::ACT;
|
nextCommand = Command::ACT;
|
||||||
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, bankgroup, bank);
|
||||||
}
|
}
|
||||||
else if (currentState == BmState::Activated)
|
else if (currentState == BmState::Activated)
|
||||||
{
|
{
|
||||||
@@ -289,38 +271,27 @@ sc_time BankMachineClosedAdaptive::start()
|
|||||||
if (scheduler->hasFurtherRowHit(bank, currentRow))
|
if (scheduler->hasFurtherRowHit(bank, currentRow))
|
||||||
{
|
{
|
||||||
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::RD, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::RD;
|
nextCommand = Command::RD;
|
||||||
}
|
|
||||||
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::WR, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::WR;
|
nextCommand = Command::WR;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
if (currentPayload->get_command() == TLM_READ_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::RDA, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::RDA;
|
nextCommand = Command::RDA;
|
||||||
}
|
|
||||||
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
else if (currentPayload->get_command() == TLM_WRITE_COMMAND)
|
||||||
{
|
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::WRA, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::WRA;
|
nextCommand = Command::WRA;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
SC_REPORT_FATAL("BankMachine", "Wrong TLM command");
|
||||||
}
|
}
|
||||||
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, bankgroup, bank);
|
||||||
}
|
}
|
||||||
else if (!blocked) // row miss TODO: remove this, can never happen
|
else if (!blocked) // row miss TODO: remove this, can never happen
|
||||||
{
|
{
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(Command::PRE, rank, bankgroup, bank);
|
|
||||||
nextCommand = Command::PRE;
|
nextCommand = Command::PRE;
|
||||||
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, bankgroup, bank);
|
||||||
SC_REPORT_FATAL("BankMachine", "Should never be reached for this policy");
|
SC_REPORT_FATAL("BankMachine", "Should never be reached for this policy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class BankMachine
|
|||||||
public:
|
public:
|
||||||
virtual ~BankMachine() {}
|
virtual ~BankMachine() {}
|
||||||
virtual sc_time start() = 0;
|
virtual sc_time start() = 0;
|
||||||
std::tuple<Command, tlm::tlm_generic_payload *> getNextCommand();
|
std::tuple<Command, tlm::tlm_generic_payload *, sc_time> getNextCommand();
|
||||||
void updateState(Command);
|
void updateState(Command);
|
||||||
void block();
|
void block();
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ protected:
|
|||||||
tlm::tlm_generic_payload *currentPayload = nullptr;
|
tlm::tlm_generic_payload *currentPayload = nullptr;
|
||||||
SchedulerIF *scheduler;
|
SchedulerIF *scheduler;
|
||||||
CheckerIF *checker;
|
CheckerIF *checker;
|
||||||
Command nextCommand;
|
Command nextCommand = Command::NOP;
|
||||||
BmState currentState = BmState::Precharged;
|
BmState currentState = BmState::Precharged;
|
||||||
Row currentRow;
|
Row currentRow;
|
||||||
sc_time timeToSchedule = sc_max_time();
|
sc_time timeToSchedule = sc_max_time();
|
||||||
|
|||||||
@@ -239,30 +239,26 @@ void Controller::controllerMethod()
|
|||||||
it->start();
|
it->start();
|
||||||
|
|
||||||
// (5) Choose one request and send it to DRAM
|
// (5) Choose one request and send it to DRAM
|
||||||
std::tuple<Command, tlm_generic_payload *> commandTuple;
|
std::tuple<Command, tlm_generic_payload *, sc_time> commandTuple;
|
||||||
std::vector<std::tuple<Command, tlm_generic_payload *>> readyCommands;
|
std::list<std::tuple<Command, tlm_generic_payload *, sc_time>> readyCommands;
|
||||||
// (5.1) Check for power-down commands (PDEA/PDEP/SREFEN or PDXA/PDXP/SREFEX)
|
|
||||||
for (unsigned rankID = 0; rankID < memSpec->numberOfRanks; rankID++)
|
for (unsigned rankID = 0; rankID < memSpec->numberOfRanks; rankID++)
|
||||||
{
|
{
|
||||||
|
// (5.1) Check for power-down commands (PDEA/PDEP/SREFEN or PDXA/PDXP/SREFEX)
|
||||||
commandTuple = powerDownManagers[rankID]->getNextCommand();
|
commandTuple = powerDownManagers[rankID]->getNextCommand();
|
||||||
if (std::get<1>(commandTuple) != nullptr)
|
if (std::get<0>(commandTuple) != Command::NOP)
|
||||||
readyCommands.push_back(commandTuple);
|
readyCommands.push_back(commandTuple);
|
||||||
else
|
|
||||||
|
// (5.2) Check for refresh commands (PREA/PRE or REFA/REFB)
|
||||||
|
commandTuple = refreshManagers[rankID]->getNextCommand();
|
||||||
|
if (std::get<0>(commandTuple) != Command::NOP)
|
||||||
|
readyCommands.push_back(commandTuple);
|
||||||
|
|
||||||
|
// (5.3) Check for bank commands (PRE, ACT, RD/RDA or WR/WRA)
|
||||||
|
for (auto it : bankMachinesOnRank[rankID])
|
||||||
{
|
{
|
||||||
// (5.2) Check for refresh commands (PREA/PRE or REFA/REFB)
|
commandTuple = it->getNextCommand();
|
||||||
commandTuple = refreshManagers[rankID]->getNextCommand();
|
if (std::get<0>(commandTuple) != Command::NOP)
|
||||||
if (std::get<1>(commandTuple) != nullptr)
|
|
||||||
readyCommands.push_back(commandTuple);
|
readyCommands.push_back(commandTuple);
|
||||||
else
|
|
||||||
{
|
|
||||||
// (5.3) Check for bank commands (PRE, ACT, RD/RDA or WR/WRA)
|
|
||||||
for (auto it : bankMachinesOnRank[rankID])
|
|
||||||
{
|
|
||||||
commandTuple = it->getNextCommand();
|
|
||||||
if (std::get<1>(commandTuple) != nullptr)
|
|
||||||
readyCommands.push_back(commandTuple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +266,7 @@ void Controller::controllerMethod()
|
|||||||
if (!readyCommands.empty())
|
if (!readyCommands.empty())
|
||||||
{
|
{
|
||||||
commandTuple = cmdMux->selectCommand(readyCommands);
|
commandTuple = cmdMux->selectCommand(readyCommands);
|
||||||
if (std::get<1>(commandTuple) != nullptr) // can happen with FIFO strict
|
if (std::get<0>(commandTuple) != Command::NOP) // can happen with FIFO strict
|
||||||
{
|
{
|
||||||
Rank rank = DramExtension::getRank(std::get<1>(commandTuple));
|
Rank rank = DramExtension::getRank(std::get<1>(commandTuple));
|
||||||
BankGroup bankgroup = DramExtension::getBankGroup(std::get<1>(commandTuple));
|
BankGroup bankgroup = DramExtension::getBankGroup(std::get<1>(commandTuple));
|
||||||
@@ -305,7 +301,10 @@ void Controller::controllerMethod()
|
|||||||
sendToDram(std::get<0>(commandTuple), std::get<1>(commandTuple));
|
sendToDram(std::get<0>(commandTuple), std::get<1>(commandTuple));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
//std::cout << "Ready command blocked at " << sc_time_stamp() << std::endl;
|
||||||
readyCmdBlocked = true;
|
readyCmdBlocked = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// (6) Accept request from arbiter if scheduler is not full, otherwise backpressure (start END_REQ)
|
// (6) Accept request from arbiter if scheduler is not full, otherwise backpressure (start END_REQ)
|
||||||
|
|||||||
@@ -35,17 +35,18 @@
|
|||||||
#ifndef CMDMUXIF_H
|
#ifndef CMDMUXIF_H
|
||||||
#define CMDMUXIF_H
|
#define CMDMUXIF_H
|
||||||
|
|
||||||
|
#include <systemc.h>
|
||||||
#include <tlm.h>
|
#include <tlm.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <list>
|
||||||
#include "../Command.h"
|
#include "../Command.h"
|
||||||
|
|
||||||
class CmdMuxIF
|
class CmdMuxIF
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~CmdMuxIF() {}
|
virtual ~CmdMuxIF() {}
|
||||||
virtual std::tuple<Command, tlm::tlm_generic_payload *>
|
virtual std::tuple<Command, tlm::tlm_generic_payload *, sc_time>
|
||||||
selectCommand(std::vector<std::tuple<Command, tlm::tlm_generic_payload *>> &) = 0;
|
selectCommand(std::list<std::tuple<Command, tlm::tlm_generic_payload *, sc_time>> &) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CMDMUXIF_H
|
#endif // CMDMUXIF_H
|
||||||
|
|||||||
@@ -38,23 +38,30 @@
|
|||||||
|
|
||||||
using namespace tlm;
|
using namespace tlm;
|
||||||
|
|
||||||
std::tuple<Command, tlm_generic_payload *>
|
std::tuple<Command, tlm_generic_payload *, sc_time>
|
||||||
CmdMuxOldest::selectCommand(std::vector<std::tuple<Command, tlm_generic_payload *>> &readyCommands)
|
CmdMuxOldest::selectCommand(std::list<std::tuple<Command, tlm_generic_payload *, sc_time>> &readyCommands)
|
||||||
{
|
{
|
||||||
auto it = readyCommands.begin();
|
readyCommands.remove_if([](std::tuple<Command, tlm_generic_payload *, sc_time> element){return std::get<2>(element) != sc_time_stamp();});
|
||||||
auto result = it;
|
|
||||||
uint64_t lastPayloadID = DramExtension::getPayloadID(std::get<1>(*it));
|
|
||||||
it++;
|
|
||||||
|
|
||||||
while (it != readyCommands.end())
|
if (!readyCommands.empty())
|
||||||
{
|
{
|
||||||
uint64_t newPayloadID = DramExtension::getPayloadID(std::get<1>(*it));
|
auto it = readyCommands.begin();
|
||||||
if (newPayloadID < lastPayloadID)
|
auto result = it;
|
||||||
{
|
uint64_t lastPayloadID = DramExtension::getPayloadID(std::get<1>(*it));
|
||||||
lastPayloadID = newPayloadID;
|
|
||||||
result = it;
|
|
||||||
}
|
|
||||||
it++;
|
it++;
|
||||||
|
|
||||||
|
while (it != readyCommands.end())
|
||||||
|
{
|
||||||
|
uint64_t newPayloadID = DramExtension::getPayloadID(std::get<1>(*it));
|
||||||
|
if (newPayloadID < lastPayloadID)
|
||||||
|
{
|
||||||
|
lastPayloadID = newPayloadID;
|
||||||
|
result = it;
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
return *result;
|
||||||
}
|
}
|
||||||
return *result;
|
else
|
||||||
|
return std::tuple<Command, tlm_generic_payload *, sc_time>(Command::NOP, nullptr, sc_max_time());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,8 @@
|
|||||||
class CmdMuxOldest : public CmdMuxIF
|
class CmdMuxOldest : public CmdMuxIF
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::tuple<Command, tlm::tlm_generic_payload *>
|
std::tuple<Command, tlm::tlm_generic_payload *, sc_time>
|
||||||
selectCommand(std::vector<std::tuple<Command, tlm::tlm_generic_payload *>> &);
|
selectCommand(std::list<std::tuple<Command, tlm::tlm_generic_payload *, sc_time>> &);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CMDMUXOLDEST_H
|
#endif // CMDMUXOLDEST_H
|
||||||
|
|||||||
@@ -38,24 +38,29 @@
|
|||||||
|
|
||||||
using namespace tlm;
|
using namespace tlm;
|
||||||
|
|
||||||
std::tuple<Command, tlm_generic_payload *>
|
std::tuple<Command, tlm_generic_payload *, sc_time>
|
||||||
CmdMuxStrict::selectCommand(std::vector<std::tuple<Command, tlm_generic_payload *>> &readyCommands)
|
CmdMuxStrict::selectCommand(std::list<std::tuple<Command, tlm_generic_payload *, sc_time>> &readyCommands)
|
||||||
{
|
{
|
||||||
for (auto it : readyCommands)
|
readyCommands.remove_if([](std::tuple<Command, tlm_generic_payload *, sc_time> element){return std::get<2>(element) != sc_time_stamp();});
|
||||||
|
|
||||||
|
if (!readyCommands.empty())
|
||||||
{
|
{
|
||||||
if (isCasCommand(std::get<0>(it)))
|
for (auto it : readyCommands)
|
||||||
{
|
{
|
||||||
if (DramExtension::getPayloadID(std::get<1>(it)) == nextPayloadID)
|
if (isCasCommand(std::get<0>(it)))
|
||||||
{
|
{
|
||||||
nextPayloadID++;
|
if (DramExtension::getPayloadID(std::get<1>(it)) == nextPayloadID)
|
||||||
return it;
|
{
|
||||||
|
nextPayloadID++;
|
||||||
|
return it;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (auto it : readyCommands)
|
||||||
|
{
|
||||||
|
if (isRasCommand(std::get<0>(it)))
|
||||||
|
return it;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (auto it : readyCommands)
|
return std::tuple<Command, tlm_generic_payload *, sc_time>(Command::NOP, nullptr, sc_max_time());
|
||||||
{
|
|
||||||
if (isRasCommand(std::get<0>(it)))
|
|
||||||
return it;
|
|
||||||
}
|
|
||||||
return std::pair<Command, tlm_generic_payload *>(Command::NOP, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,8 @@
|
|||||||
class CmdMuxStrict : public CmdMuxIF
|
class CmdMuxStrict : public CmdMuxIF
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::tuple<Command, tlm::tlm_generic_payload *>
|
std::tuple<Command, tlm::tlm_generic_payload *, sc_time>
|
||||||
selectCommand(std::vector<std::tuple<Command, tlm::tlm_generic_payload *>> &);
|
selectCommand(std::list<std::tuple<Command, tlm::tlm_generic_payload *, sc_time>> &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint64_t nextPayloadID = 0;
|
uint64_t nextPayloadID = 0;
|
||||||
|
|||||||
@@ -36,9 +36,9 @@
|
|||||||
|
|
||||||
using namespace tlm;
|
using namespace tlm;
|
||||||
|
|
||||||
std::tuple<Command, tlm_generic_payload *> PowerDownManagerDummy::getNextCommand()
|
std::tuple<Command, tlm_generic_payload *, sc_time> PowerDownManagerDummy::getNextCommand()
|
||||||
{
|
{
|
||||||
return std::tuple<Command, tlm_generic_payload *>(Command::NOP, nullptr);
|
return std::tuple<Command, tlm_generic_payload *, sc_time>(Command::NOP, nullptr, sc_max_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_time PowerDownManagerDummy::start()
|
sc_time PowerDownManagerDummy::start()
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
virtual void triggerExit() override {}
|
virtual void triggerExit() override {}
|
||||||
virtual void triggerInterruption() override {}
|
virtual void triggerInterruption() override {}
|
||||||
|
|
||||||
virtual std::tuple<Command, tlm::tlm_generic_payload *> getNextCommand() override;
|
virtual std::tuple<Command, tlm::tlm_generic_payload *, sc_time> getNextCommand() override;
|
||||||
virtual void updateState(Command) override {}
|
virtual void updateState(Command) override {}
|
||||||
virtual sc_time start() override;
|
virtual sc_time start() override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
virtual void triggerExit() = 0;
|
virtual void triggerExit() = 0;
|
||||||
virtual void triggerInterruption() = 0;
|
virtual void triggerInterruption() = 0;
|
||||||
|
|
||||||
virtual std::tuple<Command, tlm::tlm_generic_payload *> getNextCommand() = 0;
|
virtual std::tuple<Command, tlm::tlm_generic_payload *, sc_time> getNextCommand() = 0;
|
||||||
virtual void updateState(Command) = 0;
|
virtual void updateState(Command) = 0;
|
||||||
virtual sc_time start() = 0;
|
virtual sc_time start() = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -69,17 +69,15 @@ void PowerDownManagerStaggered::triggerInterruption()
|
|||||||
exitTriggered = true;
|
exitTriggered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<Command, tlm_generic_payload *> PowerDownManagerStaggered::getNextCommand()
|
std::tuple<Command, tlm_generic_payload *, sc_time> PowerDownManagerStaggered::getNextCommand()
|
||||||
{
|
{
|
||||||
if (sc_time_stamp() == timeToSchedule)
|
return std::tuple<Command, tlm_generic_payload *, sc_time>(nextCommand, &powerDownPayload, timeToSchedule);
|
||||||
return std::tuple<Command, tlm_generic_payload *>(nextCommand, &powerDownPayload);
|
|
||||||
else
|
|
||||||
return std::tuple<Command, tlm_generic_payload *>(Command::NOP, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_time PowerDownManagerStaggered::start()
|
sc_time PowerDownManagerStaggered::start()
|
||||||
{
|
{
|
||||||
timeToSchedule = sc_max_time();
|
timeToSchedule = sc_max_time();
|
||||||
|
nextCommand = Command::NOP;
|
||||||
|
|
||||||
if (exitTriggered)
|
if (exitTriggered)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
virtual void triggerExit() override;
|
virtual void triggerExit() override;
|
||||||
virtual void triggerInterruption() override;
|
virtual void triggerInterruption() override;
|
||||||
|
|
||||||
virtual std::tuple<Command, tlm::tlm_generic_payload *> getNextCommand() override;
|
virtual std::tuple<Command, tlm::tlm_generic_payload *, sc_time> getNextCommand() override;
|
||||||
virtual void updateState(Command) override;
|
virtual void updateState(Command) override;
|
||||||
virtual sc_time start() override;
|
virtual sc_time start() override;
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ private:
|
|||||||
CheckerIF *checker;
|
CheckerIF *checker;
|
||||||
|
|
||||||
sc_time timeToSchedule = sc_max_time();
|
sc_time timeToSchedule = sc_max_time();
|
||||||
Command nextCommand;
|
Command nextCommand = Command::NOP;
|
||||||
|
|
||||||
bool controllerIdle = true;
|
bool controllerIdle = true;
|
||||||
bool entryTriggered = true;
|
bool entryTriggered = true;
|
||||||
|
|||||||
@@ -54,23 +54,22 @@ RefreshManagerBankwise::RefreshManagerBankwise(std::vector<BankMachine *> &bankM
|
|||||||
allBankMachines.push_back(bankMachines[bankID]);
|
allBankMachines.push_back(bankMachines[bankID]);
|
||||||
}
|
}
|
||||||
remainingBankMachines = allBankMachines;
|
remainingBankMachines = allBankMachines;
|
||||||
|
currentBankMachine = *remainingBankMachines.begin();
|
||||||
|
|
||||||
maxPostponed = config.refreshMaxPostponed * memSpec->banksPerRank;
|
maxPostponed = config.refreshMaxPostponed * memSpec->banksPerRank;
|
||||||
maxPulledin = -(config.refreshMaxPulledin * memSpec->banksPerRank);
|
maxPulledin = -(config.refreshMaxPulledin * memSpec->banksPerRank);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<Command, tlm_generic_payload *> RefreshManagerBankwise::getNextCommand()
|
std::tuple<Command, tlm_generic_payload *, sc_time> RefreshManagerBankwise::getNextCommand()
|
||||||
{
|
{
|
||||||
if (sc_time_stamp() == timeToSchedule)
|
return std::tuple<Command, tlm_generic_payload *, sc_time>
|
||||||
return std::tuple<Command, tlm_generic_payload *>
|
(nextCommand, &refreshPayloads[currentBankMachine->getBank().ID() % memSpec->banksPerRank], timeToSchedule);
|
||||||
(nextCommand, &refreshPayloads[currentBankMachine->getBank().ID() % memSpec->banksPerRank]);
|
|
||||||
else
|
|
||||||
return std::tuple<Command, tlm_generic_payload *>(Command::NOP, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_time RefreshManagerBankwise::start()
|
sc_time RefreshManagerBankwise::start()
|
||||||
{
|
{
|
||||||
timeToSchedule = sc_max_time();
|
timeToSchedule = sc_max_time();
|
||||||
|
nextCommand = Command::NOP;
|
||||||
|
|
||||||
if (sc_time_stamp() >= timeForNextTrigger)
|
if (sc_time_stamp() >= timeForNextTrigger)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class RefreshManagerBankwise final : public RefreshManagerIF
|
|||||||
public:
|
public:
|
||||||
RefreshManagerBankwise(std::vector<BankMachine *> &, PowerDownManagerIF *, Rank, CheckerIF *);
|
RefreshManagerBankwise(std::vector<BankMachine *> &, PowerDownManagerIF *, Rank, CheckerIF *);
|
||||||
|
|
||||||
virtual std::tuple<Command, tlm::tlm_generic_payload *> getNextCommand() override;
|
virtual std::tuple<Command, tlm::tlm_generic_payload *, sc_time> getNextCommand() override;
|
||||||
virtual sc_time start() override;
|
virtual sc_time start() override;
|
||||||
virtual void updateState(Command) override;
|
virtual void updateState(Command) override;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ private:
|
|||||||
sc_time timeToSchedule = sc_max_time();
|
sc_time timeToSchedule = sc_max_time();
|
||||||
Rank rank;
|
Rank rank;
|
||||||
CheckerIF *checker;
|
CheckerIF *checker;
|
||||||
Command nextCommand;
|
Command nextCommand = Command::NOP;
|
||||||
|
|
||||||
std::list<BankMachine *> remainingBankMachines;
|
std::list<BankMachine *> remainingBankMachines;
|
||||||
std::list<BankMachine *> allBankMachines;
|
std::list<BankMachine *> allBankMachines;
|
||||||
|
|||||||
@@ -36,9 +36,9 @@
|
|||||||
|
|
||||||
using namespace tlm;
|
using namespace tlm;
|
||||||
|
|
||||||
std::tuple<Command, tlm_generic_payload *> RefreshManagerDummy::getNextCommand()
|
std::tuple<Command, tlm_generic_payload *, sc_time> RefreshManagerDummy::getNextCommand()
|
||||||
{
|
{
|
||||||
return std::tuple<Command, tlm_generic_payload *>(Command::NOP, nullptr);
|
return std::tuple<Command, tlm_generic_payload *, sc_time>(Command::NOP, nullptr, sc_max_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_time RefreshManagerDummy::start()
|
sc_time RefreshManagerDummy::start()
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
class RefreshManagerDummy final : public RefreshManagerIF
|
class RefreshManagerDummy final : public RefreshManagerIF
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual std::tuple<Command, tlm::tlm_generic_payload *> getNextCommand() override;
|
virtual std::tuple<Command, tlm::tlm_generic_payload *, sc_time> getNextCommand() override;
|
||||||
virtual sc_time start() override;
|
virtual sc_time start() override;
|
||||||
virtual void updateState(Command) override {}
|
virtual void updateState(Command) override {}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class RefreshManagerIF
|
|||||||
public:
|
public:
|
||||||
virtual ~RefreshManagerIF() {}
|
virtual ~RefreshManagerIF() {}
|
||||||
|
|
||||||
virtual std::tuple<Command, tlm::tlm_generic_payload *> getNextCommand() = 0;
|
virtual std::tuple<Command, tlm::tlm_generic_payload *, sc_time> getNextCommand() = 0;
|
||||||
virtual sc_time start() = 0;
|
virtual sc_time start() = 0;
|
||||||
virtual void updateState(Command) = 0;
|
virtual void updateState(Command) = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -52,17 +52,15 @@ RefreshManagerRankwise::RefreshManagerRankwise(std::vector<BankMachine *> &bankM
|
|||||||
maxPulledin = -config.refreshMaxPulledin;
|
maxPulledin = -config.refreshMaxPulledin;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<Command, tlm_generic_payload *> RefreshManagerRankwise::getNextCommand()
|
std::tuple<Command, tlm_generic_payload *, sc_time> RefreshManagerRankwise::getNextCommand()
|
||||||
{
|
{
|
||||||
if (sc_time_stamp() == timeToSchedule)
|
return std::tuple<Command, tlm_generic_payload *, sc_time>(nextCommand, &refreshPayload, timeToSchedule);
|
||||||
return std::tuple<Command, tlm_generic_payload *>(nextCommand, &refreshPayload);
|
|
||||||
else
|
|
||||||
return std::tuple<Command, tlm_generic_payload *>(Command::NOP, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_time RefreshManagerRankwise::start()
|
sc_time RefreshManagerRankwise::start()
|
||||||
{
|
{
|
||||||
timeToSchedule = sc_max_time();
|
timeToSchedule = sc_max_time();
|
||||||
|
nextCommand = Command::NOP;
|
||||||
|
|
||||||
if (sc_time_stamp() >= timeForNextTrigger)
|
if (sc_time_stamp() >= timeForNextTrigger)
|
||||||
{
|
{
|
||||||
@@ -130,7 +128,7 @@ sc_time RefreshManagerRankwise::start()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// nextCommand stays Command::REFA
|
nextCommand = Command::REFA;
|
||||||
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0));
|
timeToSchedule = checker->timeToSatisfyConstraints(nextCommand, rank, BankGroup(0), Bank(0));
|
||||||
return timeToSchedule;
|
return timeToSchedule;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class RefreshManagerRankwise final : public RefreshManagerIF
|
|||||||
public:
|
public:
|
||||||
RefreshManagerRankwise(std::vector<BankMachine *> &, PowerDownManagerIF *, Rank, CheckerIF *);
|
RefreshManagerRankwise(std::vector<BankMachine *> &, PowerDownManagerIF *, Rank, CheckerIF *);
|
||||||
|
|
||||||
virtual std::tuple<Command, tlm::tlm_generic_payload *> getNextCommand() override;
|
virtual std::tuple<Command, tlm::tlm_generic_payload *, sc_time> getNextCommand() override;
|
||||||
virtual sc_time start() override;
|
virtual sc_time start() override;
|
||||||
virtual void updateState(Command) override;
|
virtual void updateState(Command) override;
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ private:
|
|||||||
sc_time timeToSchedule = sc_max_time();
|
sc_time timeToSchedule = sc_max_time();
|
||||||
Rank rank;
|
Rank rank;
|
||||||
CheckerIF *checker;
|
CheckerIF *checker;
|
||||||
Command nextCommand;
|
Command nextCommand = Command::NOP;
|
||||||
|
|
||||||
unsigned activatedBanks = 0;
|
unsigned activatedBanks = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ The content of [ddr3.json](DRAMSys/library/resources/configs/simulator/ddr3.json
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- *SimulationName* (boolean)
|
- *SimulationName* (string)
|
||||||
- Give the name of the simulation for distinguishing from other simulations.
|
- Give the name of the simulation for distinguishing from other simulations.
|
||||||
- *Debug* (boolean)
|
- *Debug* (boolean)
|
||||||
- true: enables debug output on console (only supported by a debug build)
|
- true: enables debug output on console (only supported by a debug build)
|
||||||
|
|||||||
Reference in New Issue
Block a user