77 lines
2.0 KiB
C++
77 lines
2.0 KiB
C++
/*
|
|
* ActivateScheduler.cpp
|
|
*
|
|
* Created on: Mar 12, 2014
|
|
* Author: jonny
|
|
*/
|
|
|
|
#include <map>
|
|
#include <algorithm>
|
|
#include "core/utils/Utils.h"
|
|
#include "core/scheduling/checker/ActivateChecker.h"
|
|
|
|
|
|
namespace controller {
|
|
|
|
void ActivateChecker::check(ScheduledCommand& command) const
|
|
{
|
|
if (command.getCommand() != Activate)
|
|
return;
|
|
check_activateToActivate(command);
|
|
check_nActivateWindow(command);
|
|
check_bus(command);
|
|
}
|
|
|
|
sc_time ActivateChecker::getExecutionTime(const tlm::tlm_generic_payload& transaction,
|
|
Command command) const
|
|
{
|
|
assert(command == Activate);
|
|
return config.Timings.tRCD;
|
|
}
|
|
|
|
void ActivateChecker::check_activateToActivate(ScheduledCommand& command) const
|
|
{
|
|
if (bus.notYetScheduled(Activate))
|
|
return;
|
|
|
|
sc_time lastActivate = bus.getLastCommand(Activate).getStart();
|
|
sc_time lastActivateOnBank = bus.getLastCommand(Activate, command.getBank()).getStart();
|
|
|
|
command.delayStart(delayByConstraint(lastActivate, command.getStart(), config.Timings.tRRD));
|
|
command.delayStart(
|
|
delayByConstraint(lastActivateOnBank, command.getStart(), config.Timings.tRC));
|
|
}
|
|
|
|
void ActivateChecker::check_prechargeToActivate(ScheduledCommand& command) const
|
|
{
|
|
sc_time lastPrechargeOnBank = std::max(
|
|
bus.getLastCommand(Precharge, command.getBank()).getStart(),
|
|
bus.getLastCommand(PrechargeAll, command.getBank()).getStart());
|
|
command.delayStart(
|
|
delayByConstraint(lastPrechargeOnBank, command.getStart(), config.Timings.tRC));
|
|
}
|
|
|
|
void ActivateChecker::check_nActivateWindow(ScheduledCommand& command) const
|
|
{
|
|
if (!nActivateWindow.isFull())
|
|
return;
|
|
command.delayStart(
|
|
delayByConstraint(nActivateWindow.getOldest(), command.getStart(),
|
|
config.Timings.tTAW));
|
|
}
|
|
|
|
void ActivateChecker::check_bus(ScheduledCommand& command) const
|
|
{
|
|
command.delayStart(bus.getEarliestStartTime(command) - command.getStart());
|
|
}
|
|
|
|
void ActivateChecker::cb_IInternalScheduler(const ScheduledCommand& command)
|
|
{
|
|
if (command.getCommand() == Activate)
|
|
{
|
|
nActivateWindow.put(command.getStart());
|
|
}
|
|
}
|
|
|
|
} /* namespace controller */
|