Improved placement of refresh commands.
This commit is contained in:
@@ -44,7 +44,7 @@ BankMachine::BankMachine(SchedulerIF *scheduler, CheckerIF *checker, Bank bank)
|
||||
|
||||
std::pair<Command, tlm_generic_payload *> BankMachine::getNextCommand()
|
||||
{
|
||||
if (sc_time_stamp() == timeToSchedule && !blocked)
|
||||
if (sc_time_stamp() == timeToSchedule)
|
||||
return std::pair<Command, tlm_generic_payload *>(nextCommand, currentPayload);
|
||||
else
|
||||
return std::pair<Command, tlm_generic_payload *>(Command::NOP, nullptr);
|
||||
@@ -67,10 +67,14 @@ void BankMachine::updateState(Command command)
|
||||
currentPayload = nullptr;
|
||||
}
|
||||
else if (command == Command::PDEA || command == Command::PDEP || command == Command::SREFEN)
|
||||
blocked = true;
|
||||
else if (command == Command::REFA || command == Command::REFB
|
||||
|| command == Command::PDXA || command == Command::PDXP)
|
||||
sleeping = true;
|
||||
else if (command == Command::REFA || command == Command::REFB)
|
||||
{
|
||||
sleeping = false;
|
||||
blocked = false;
|
||||
}
|
||||
else if (command == Command::PDXA || command == Command::PDXP)
|
||||
sleeping = false;
|
||||
}
|
||||
|
||||
void BankMachine::block()
|
||||
@@ -114,17 +118,19 @@ BankMachineOpen::BankMachineOpen(SchedulerIF *scheduler, CheckerIF *checker, Ban
|
||||
sc_time BankMachineOpen::start()
|
||||
{
|
||||
timeToSchedule = sc_max_time();
|
||||
sc_time delay = sc_max_time() - sc_time_stamp();
|
||||
|
||||
if (blocked)
|
||||
return sc_max_time() - sc_time_stamp();
|
||||
else if (currentPayload == nullptr)
|
||||
if (currentPayload == nullptr)
|
||||
{
|
||||
currentPayload = scheduler->getNextRequest(this);
|
||||
if (currentPayload == nullptr)
|
||||
return sc_max_time() - sc_time_stamp();
|
||||
return delay;
|
||||
}
|
||||
sc_time delay;
|
||||
if (currentState == BmState::Precharged) // row miss
|
||||
|
||||
if (sleeping)
|
||||
return delay;
|
||||
|
||||
if (currentState == BmState::Precharged && !blocked) // row miss
|
||||
{
|
||||
delay = checker->delayToSatisfyConstraints(Command::ACT, rank, bankgroup, bank);
|
||||
nextCommand = Command::ACT;
|
||||
@@ -152,6 +158,7 @@ sc_time BankMachineOpen::start()
|
||||
nextCommand = Command::PRE;
|
||||
}
|
||||
}
|
||||
|
||||
timeToSchedule = sc_time_stamp() + delay;
|
||||
return delay;
|
||||
}
|
||||
@@ -162,17 +169,19 @@ BankMachineClosed::BankMachineClosed(SchedulerIF *scheduler, CheckerIF *checker,
|
||||
sc_time BankMachineClosed::start()
|
||||
{
|
||||
timeToSchedule = sc_max_time();
|
||||
sc_time delay = sc_max_time() - sc_time_stamp();
|
||||
|
||||
if (blocked)
|
||||
return sc_max_time() - sc_time_stamp();
|
||||
else if (currentPayload == nullptr)
|
||||
if (currentPayload == nullptr)
|
||||
{
|
||||
currentPayload = scheduler->getNextRequest(this);
|
||||
if (currentPayload == nullptr)
|
||||
return sc_max_time() - sc_time_stamp();
|
||||
return delay;
|
||||
}
|
||||
sc_time delay;
|
||||
if (currentState == BmState::Precharged) // row miss
|
||||
|
||||
if (sleeping)
|
||||
return delay;
|
||||
|
||||
if (currentState == BmState::Precharged && !blocked) // row miss
|
||||
{
|
||||
delay = checker->delayToSatisfyConstraints(Command::ACT, rank, bankgroup, bank);
|
||||
nextCommand = Command::ACT;
|
||||
@@ -210,17 +219,19 @@ BankMachineOpenAdaptive::BankMachineOpenAdaptive(SchedulerIF *scheduler, Checker
|
||||
sc_time BankMachineOpenAdaptive::start()
|
||||
{
|
||||
timeToSchedule = sc_max_time();
|
||||
sc_time delay = sc_max_time() - sc_time_stamp();
|
||||
|
||||
if (blocked)
|
||||
return sc_max_time() - sc_time_stamp();
|
||||
else if (currentPayload == nullptr)
|
||||
if (currentPayload == nullptr)
|
||||
{
|
||||
currentPayload = scheduler->getNextRequest(this);
|
||||
if (currentPayload == nullptr)
|
||||
return sc_max_time() - sc_time_stamp();
|
||||
return delay;
|
||||
}
|
||||
sc_time delay;
|
||||
if (currentState == BmState::Precharged) // row miss
|
||||
|
||||
if (sleeping)
|
||||
return delay;
|
||||
|
||||
if (currentState == BmState::Precharged && !blocked) // row miss
|
||||
{
|
||||
delay = checker->delayToSatisfyConstraints(Command::ACT, rank, bankgroup, bank);
|
||||
nextCommand = Command::ACT;
|
||||
@@ -276,17 +287,19 @@ BankMachineClosedAdaptive::BankMachineClosedAdaptive(SchedulerIF *scheduler, Che
|
||||
sc_time BankMachineClosedAdaptive::start()
|
||||
{
|
||||
timeToSchedule = sc_max_time();
|
||||
sc_time delay = sc_max_time() - sc_time_stamp();
|
||||
|
||||
if (blocked)
|
||||
return sc_max_time() - sc_time_stamp();
|
||||
else if (currentPayload == nullptr)
|
||||
if (currentPayload == nullptr)
|
||||
{
|
||||
currentPayload = scheduler->getNextRequest(this);
|
||||
if (currentPayload == nullptr)
|
||||
return sc_max_time() - sc_time_stamp();
|
||||
return delay;
|
||||
}
|
||||
sc_time delay;
|
||||
if (currentState == BmState::Precharged) // row miss
|
||||
|
||||
if (sleeping)
|
||||
return delay;
|
||||
|
||||
if (currentState == BmState::Precharged && !blocked) // row miss
|
||||
{
|
||||
delay = checker->delayToSatisfyConstraints(Command::ACT, rank, bankgroup, bank);
|
||||
nextCommand = Command::ACT;
|
||||
|
||||
@@ -84,6 +84,7 @@ protected:
|
||||
BankGroup bankgroup = BankGroup(0);
|
||||
Bank bank;
|
||||
bool blocked = false;
|
||||
bool sleeping = false;
|
||||
};
|
||||
|
||||
class BankMachineOpen final : public BankMachine
|
||||
|
||||
@@ -90,7 +90,7 @@ sc_time RefreshManager::start()
|
||||
if (state == RmState::Regular)
|
||||
{
|
||||
bool forcedRefresh = (flexibilityCounter == maxPostponed);
|
||||
if (!forcedRefresh && !controllerIdle)
|
||||
if (!forcedRefresh && !controllerIdle) // no forced refresh & controller is busy -> postpone
|
||||
{
|
||||
flexibilityCounter++;
|
||||
timeForNextTrigger += memSpec->getRefreshIntervalAB();
|
||||
@@ -98,6 +98,12 @@ sc_time RefreshManager::start()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (forcedRefresh)
|
||||
{
|
||||
for (auto it : bankMachines)
|
||||
it->block();
|
||||
}
|
||||
|
||||
if (activatedBanks > 0)
|
||||
nextCommand = Command::PREA;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user