45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
/*
|
|
* PowerDownChecker.cpp
|
|
*
|
|
* Created on: Apr 11, 2014
|
|
* Author: jonny
|
|
*/
|
|
|
|
#include "PowerDownChecker.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()
|
|
&& lastCommandOnBank.commandIsIn( { Command::Read, Command::ReadA, Command::WriteA }))
|
|
{
|
|
command.delayToMeetConstraint(lastCommandOnBank.getEnd(), config.Timings.clk);
|
|
}
|
|
}
|
|
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 */
|
|
|