53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
/*
|
|
* PrechargeAllChecker.cpp
|
|
*
|
|
* Created on: Apr 3, 2014
|
|
* Author: robert
|
|
*/
|
|
|
|
#include "PrechargeAllChecker.h"
|
|
#include "../../../common/Utils.h"
|
|
|
|
namespace core {
|
|
|
|
void PrechargeAllChecker::delayToSatisfyConstraints(ScheduledCommand& command) const
|
|
{
|
|
sc_assert(command.getCommand() == Command::PrechargeAll);
|
|
|
|
for (unsigned int bank = 0; bank < config.NumberOfBanks; ++bank)
|
|
{
|
|
ScheduledCommand lastCommand = state.getLastScheduledCommand(Bank(bank));
|
|
if (lastCommand.isValidCommand())
|
|
{
|
|
if (lastCommand.getCommand() == Command::Read)
|
|
{
|
|
command.delayToMeetConstraint(lastCommand.getStart(),
|
|
lastCommand.getBurstLength() * config.Timings.clk);
|
|
}
|
|
else if (lastCommand.getCommand() == Command::Write)
|
|
{
|
|
command.delayToMeetConstraint(lastCommand.getEnd(), config.Timings.tWR);
|
|
}
|
|
else if(lastCommand.getCommand() == Command::WriteA)
|
|
{
|
|
command.delayToMeetConstraint(lastCommand.getEnd(), SC_ZERO_TIME);
|
|
if(config.Timings.tWR > config.Timings.tRP)
|
|
command.delayToMeetConstraint(lastCommand.getEnd(), config.Timings.tWR - config.Timings.tRP);
|
|
}
|
|
else if (lastCommand.commandIsIn( {Command::ReadA, Command::PDNAX, Command::PDNPX, Command::SREFX,
|
|
Command::AutoRefresh }))
|
|
{
|
|
|
|
command.delayToMeetConstraint(lastCommand.getEnd(), SC_ZERO_TIME);
|
|
}
|
|
else
|
|
reportFatal("Precharge All Checker",
|
|
"Precharge All can not follow "
|
|
+ commandToString(lastCommand.getCommand()));
|
|
}
|
|
}
|
|
state.bus.moveCommandToNextFreeSlot(command);
|
|
}
|
|
|
|
} /* namespace core */
|