Code was commented and its readability was improved.
This commit is contained in:
@@ -58,8 +58,17 @@ RefreshManagerBankwise::~RefreshManagerBankwise()
|
||||
|
||||
bool RefreshManagerBankwise::hasCollision(const ScheduledCommand& command)
|
||||
{
|
||||
return command.getStart() < controllerCore.state.getLastCommand(Command::AutoRefresh, command.getBank()).getEnd()
|
||||
|| command.getEnd() > nextPlannedRefreshs[command.getBank()];}
|
||||
Bank bank = command.getBank();
|
||||
// Get the last AutoRefresh command for this bank and the time of its end
|
||||
ScheduledCommand lastAutoRefreshCmd = controllerCore.state.getLastCommand(Command::AutoRefresh, bank);
|
||||
sc_time endTimeLastAutoRefreshCmd = lastAutoRefreshCmd.getEnd();
|
||||
// Get the time of the next planned refresh for this bank
|
||||
sc_time timeNextPlannedRefresh = nextPlannedRefreshs[command.getBank()];
|
||||
// Collision:
|
||||
// - the start time of the command is before the end time of the last auto refresh command for this bank
|
||||
// - the end time of the command is after the next planned refresh for this bank
|
||||
return command.getStart() < endTimeLastAutoRefreshCmd || command.getEnd() > timeNextPlannedRefresh;
|
||||
}
|
||||
|
||||
void RefreshManagerBankwise::scheduleRefresh(tlm::tlm_generic_payload& payload, sc_time time)
|
||||
{
|
||||
|
||||
@@ -37,67 +37,72 @@
|
||||
#include "PowerDownChecker.h"
|
||||
#include "../../TimingCalculation.h"
|
||||
|
||||
void PowerDownChecker::delayToSatisfyConstraints(ScheduledCommand& command) const
|
||||
sc_time PowerDownChecker::getTimeConstraintToEnterPowerDown(Command lastCmd, Command pdnCmd) const
|
||||
{
|
||||
sc_assert(
|
||||
command.commandIsIn(
|
||||
{ Command::SREF, Command::PDNA, Command::PDNP, Command::PDNAX, Command::PDNPX, Command::SREFX }));
|
||||
sc_assert(pdnCmd == Command::SREF || pdnCmd == Command::PDNA || pdnCmd == Command::PDNP);
|
||||
|
||||
if (command.commandIsIn( { Command::SREF, Command::PDNA, Command::PDNP }))
|
||||
{
|
||||
ScheduledCommand lastCommandOnBank = state.getLastScheduledCommand(command.getBank());
|
||||
sc_time constraint;
|
||||
|
||||
if (lastCommandOnBank.isValidCommand())
|
||||
{
|
||||
if (lastCommandOnBank.getCommand() == Command::Read || lastCommandOnBank.getCommand() == Command::ReadA)
|
||||
{
|
||||
command.establishMinDistanceFromStart(lastCommandOnBank.getStart(),
|
||||
config.memSpec.tRL + getReadAccessTime() + config.memSpec.clk);
|
||||
}
|
||||
else if (lastCommandOnBank.getCommand() == Command::Write)
|
||||
{
|
||||
command.establishMinDistanceFromStart(lastCommandOnBank.getStart(),
|
||||
config.memSpec.tWL + getWriteAccessTime() + config.memSpec.tWR);
|
||||
}
|
||||
else if (lastCommandOnBank.getCommand() == Command::WriteA)
|
||||
{
|
||||
command.establishMinDistanceFromStart(lastCommandOnBank.getStart(),
|
||||
config.memSpec.tWL + getWriteAccessTime() + config.memSpec.tWR + config.memSpec.clk);
|
||||
}
|
||||
else if (lastCommandOnBank.getCommand() == Command::AutoRefresh)
|
||||
{
|
||||
command.establishMinDistanceFromStart(lastCommandOnBank.getStart(), config.memSpec.tRFC);
|
||||
}
|
||||
else if (lastCommandOnBank.getCommand() == Command::PDNPX || lastCommandOnBank.getCommand() == Command::PDNAX)
|
||||
{
|
||||
command.establishMinDistanceFromStart(lastCommandOnBank.getStart(), config.memSpec.tXP);
|
||||
}
|
||||
if (lastCmd == Command::Read || lastCmd == Command::ReadA) {
|
||||
constraint = config.memSpec.tRL + getReadAccessTime() + config.memSpec.clk;
|
||||
} else if (lastCmd == Command::Write) {
|
||||
constraint = config.memSpec.tWL + getWriteAccessTime() + config.memSpec.tWR;
|
||||
} else if (lastCmd == Command::WriteA) {
|
||||
constraint = config.memSpec.tWL + getWriteAccessTime() + config.memSpec.tWR + config.memSpec.clk;
|
||||
} else if (lastCmd == Command::AutoRefresh) {
|
||||
constraint = config.memSpec.tRFC;
|
||||
} else if (lastCmd == Command::PDNPX || lastCmd == Command::PDNAX) {
|
||||
constraint = config.memSpec.tXP;
|
||||
} else if (lastCmd == Command::SREFX) {
|
||||
constraint = config.memSpec.tXSR;
|
||||
} else {
|
||||
reportFatal("Powerdown checker", commandToString(pdnCmd) + " can not follow " + commandToString(lastCmd));
|
||||
}
|
||||
|
||||
else if (lastCommandOnBank.getCommand() == Command::SREFX)
|
||||
{
|
||||
command.establishMinDistanceFromStart(lastCommandOnBank.getStart(), config.memSpec.tXSR);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
reportFatal("Powerdown checker", commandToString(command.getCommand()) + " can not follow " + commandToString(lastCommandOnBank.getCommand()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (command.getCommand() == Command::PDNAX)
|
||||
{
|
||||
command.establishMinDistanceFromStart(state.getLastCommand(Command::PDNA).getStart(), config.memSpec.tCKE);
|
||||
}
|
||||
else if (command.getCommand() == Command::PDNPX)
|
||||
{
|
||||
command.establishMinDistanceFromStart(state.getLastCommand(Command::PDNP).getStart(), config.memSpec.tCKE);
|
||||
}
|
||||
else if (command.getCommand() == Command::SREFX)
|
||||
{
|
||||
command.establishMinDistanceFromStart(state.getLastCommand(Command::SREF).getStart(), config.memSpec.tCKESR);
|
||||
}
|
||||
|
||||
state.bus.moveCommandToNextFreeSlot(command);
|
||||
return constraint;
|
||||
}
|
||||
|
||||
void PowerDownChecker::delayToSatisfyConstraints(ScheduledCommand &command) const
|
||||
{
|
||||
sc_assert(command.commandIsIn({Command::PDNA, Command::PDNP, Command::SREF, Command::PDNAX, Command::PDNPX, Command::SREFX}));
|
||||
|
||||
// Power Down commmand (one of the listed above)
|
||||
Command pdnCmd = command.getCommand();
|
||||
Bank bank = command.getBank();
|
||||
|
||||
sc_time timeConstraint;
|
||||
|
||||
if (pdnCmd == Command::PDNA || pdnCmd == Command::PDNP || pdnCmd == Command::SREF) {
|
||||
// Entering in one of the Power Down modes:
|
||||
// PDNA - Active Power Down
|
||||
// PDNP - Precharge Power Down
|
||||
// SREF - Self Refresh
|
||||
|
||||
// Get the last scheduled command on this bank
|
||||
ScheduledCommand lastSchedCmdOnBank = state.getLastScheduledCommand(bank);
|
||||
// Get the start time for the last scheduled command on this bank
|
||||
sc_time lastSchedCmdOnBankStart = lastSchedCmdOnBank.getStart();
|
||||
// Get the last command on this bank itself
|
||||
Command lastCmdBank = lastSchedCmdOnBank.getCommand();
|
||||
|
||||
timeConstraint = getTimeConstraintToEnterPowerDown(lastCmdBank, pdnCmd);
|
||||
|
||||
command.establishMinDistanceFromStart(lastSchedCmdOnBankStart, timeConstraint);
|
||||
|
||||
} else if (pdnCmd == Command::PDNAX) {
|
||||
// Leaving Active Power Down
|
||||
timeConstraint = config.memSpec.tCKE;
|
||||
command.establishMinDistanceFromStart(state.getLastCommand(Command::PDNA).getStart(), timeConstraint);
|
||||
} else if (pdnCmd == Command::PDNPX) {
|
||||
// Leaving Precharge Power Down
|
||||
timeConstraint = config.memSpec.tCKE;
|
||||
command.establishMinDistanceFromStart(state.getLastCommand(Command::PDNP).getStart(), timeConstraint);
|
||||
} else if (pdnCmd == Command::SREFX) {
|
||||
// Leaving Self Refresh
|
||||
timeConstraint = config.memSpec.tCKESR;
|
||||
command.establishMinDistanceFromStart(state.getLastCommand(Command::SREF).getStart(), timeConstraint);
|
||||
}
|
||||
|
||||
state.bus.moveCommandToNextFreeSlot(command);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,29 +37,25 @@
|
||||
#ifndef POWERDOWNCHECKER_H_
|
||||
#define POWERDOWNCHECKER_H_
|
||||
|
||||
#include <systemc>
|
||||
|
||||
#include "../../../ControllerState.h"
|
||||
#include "../../configuration/Configuration.h"
|
||||
#include "ICommandChecker.h"
|
||||
#include <systemc>
|
||||
|
||||
|
||||
class PowerDownChecker : public ICommandChecker
|
||||
{
|
||||
public:
|
||||
PowerDownChecker(const Configuration& config, ControllerState& state) :
|
||||
config(config), state(state)
|
||||
{
|
||||
}
|
||||
virtual ~PowerDownChecker()
|
||||
{
|
||||
}
|
||||
PowerDownChecker(const Configuration &config, ControllerState &state) : config(config), state(state) {}
|
||||
virtual ~PowerDownChecker() {}
|
||||
|
||||
virtual void delayToSatisfyConstraints(ScheduledCommand& command) const override;
|
||||
|
||||
private:
|
||||
const Configuration& config;
|
||||
ControllerState& state;
|
||||
const Configuration &config;
|
||||
ControllerState &state;
|
||||
sc_time getTimeConstraintToEnterPowerDown(Command lastCmd, Command pdnCmd) const;
|
||||
};
|
||||
|
||||
|
||||
#endif /* POWERDOWNCHECKER_H_ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user