72 lines
2.3 KiB
C++
72 lines
2.3 KiB
C++
/*
|
|
* PowerDownChecker.cpp
|
|
*
|
|
* Created on: Apr 11, 2014
|
|
* Author: jonny
|
|
*/
|
|
|
|
#include "PowerDownChecker.h"
|
|
#include "../../../common/Utils.h"
|
|
|
|
namespace core {
|
|
void PowerDownChecker::delayToSatisfyConstraints(ScheduledCommand& command) const
|
|
{
|
|
sc_assert(
|
|
command.commandIsIn(
|
|
{ Command::SREF, Command::PDNA, Command::PDNP, Command::PDNAX, Command::PDNPX, Command::SREFX }));
|
|
|
|
if (command.commandIsIn( { Command::SREF, Command::PDNA, Command::PDNP }))
|
|
{
|
|
ScheduledCommand lastCommandOnBank = state.getLastScheduledCommand(command.getBank());
|
|
|
|
if (lastCommandOnBank.isValidCommand())
|
|
{
|
|
if (lastCommandOnBank.getCommand() == Command::Read || lastCommandOnBank.getCommand() == Command::ReadA)
|
|
{
|
|
command.delayToMeetConstraint(lastCommandOnBank.getStart(),
|
|
config.Timings.tRL + getReadAcessTime() + config.Timings.clk);
|
|
}
|
|
else if (lastCommandOnBank.getCommand() == Command::Write)
|
|
{
|
|
command.delayToMeetConstraint(lastCommandOnBank.getStart(),
|
|
config.Timings.tWL + getWriteAcessTime() + config.Timings.tWR);
|
|
}
|
|
else if (lastCommandOnBank.getCommand() == Command::WriteA)
|
|
{
|
|
command.delayToMeetConstraint(lastCommandOnBank.getStart(),
|
|
config.Timings.tWL + getWriteAcessTime() + config.Timings.tWR + config.Timings.clk);
|
|
}
|
|
else if (lastCommandOnBank.getCommand() == Command::AutoRefresh)
|
|
{
|
|
command.delayToMeetConstraint(lastCommandOnBank.getStart(), config.Timings.tRFC);
|
|
}
|
|
else if (lastCommandOnBank.getCommand() == Command::PDNPX || lastCommandOnBank.getCommand() == Command::PDNAX)
|
|
{
|
|
command.delayToMeetConstraint(lastCommandOnBank.getStart(), config.Timings.tXP);
|
|
}
|
|
else
|
|
{
|
|
reportFatal("Powerdown checker", commandToString(command.getCommand()) + " can not follow " + commandToString(lastCommandOnBank.getCommand()));
|
|
}
|
|
}
|
|
}
|
|
|
|
else if (command.getCommand() == Command::PDNAX)
|
|
{
|
|
command.delayToMeetConstraint(state.getLastCommand(Command::PDNA).getStart(), config.Timings.tCKE);
|
|
}
|
|
else if (command.getCommand() == Command::PDNPX)
|
|
{
|
|
command.delayToMeetConstraint(state.getLastCommand(Command::PDNP).getStart(), config.Timings.tCKE);
|
|
}
|
|
else if (command.getCommand() == Command::SREFX)
|
|
{
|
|
command.delayToMeetConstraint(state.getLastCommand(Command::SREF).getStart(), config.Timings.tCKESR);
|
|
}
|
|
|
|
state.bus.moveCommandToNextFreeSlot(command);
|
|
}
|
|
|
|
} /* namespace core */
|
|
|