Files
DRAMSys/dram/src/core/scheduling/ScheduledCommand.cpp

113 lines
2.3 KiB
C++

/*
* ScheduledCommand.cpp
*
* Created on: Mar 30, 2014
* Author: robert
*/
#include "ScheduledCommand.h"
#include "../TimingCalculation.h"
#include "../../common/Utils.h"
#include "../configuration/Configuration.h"
namespace core {
bool ScheduledCommand::isNoCommand() const
{
return (command == Command::NOP && start == SC_ZERO_TIME && executionTime == SC_ZERO_TIME && end == SC_ZERO_TIME);
}
bool ScheduledCommand::isValidCommand() const
{
return !isNoCommand();
}
const sc_time ScheduledCommand::getStart() const
{
return start;
}
void ScheduledCommand::setStart(sc_time newStart)
{
start = newStart;
end = newStart + executionTime;
}
void ScheduledCommand::delayStart(sc_time delay)
{
setStart(start+delay);
}
void ScheduledCommand::delayToMeetConstraint(sc_time previous, sc_time constraint)
{
delayStart(getDelayToMeetConstraint(previous, start, constraint));
}
const sc_time ScheduledCommand::getEnd() const
{
return end;
}
const Command ScheduledCommand::getCommand() const
{
return command;
}
const sc_time ScheduledCommand::getExecutionTime() const
{
return executionTime;
}
Bank ScheduledCommand::getBank() const
{
return extension.getBank();
}
BankGroup ScheduledCommand::getBankGroup() const
{
return extension.getBankGroup();
}
Row ScheduledCommand::getRow() const
{
return extension.getRow();
}
unsigned int ScheduledCommand::getBurstLength() const
{
return extension.getBurstlength();
}
bool ScheduledCommand::operator ==(const ScheduledCommand& b) const
{
return b.command == command && b.start == start && b.executionTime == executionTime && b.end == end;
}
bool ScheduledCommand::commandIsIn(const std::vector<Command>& commandSet) const
{
return isIn(command, commandSet);
}
TimeInterval ScheduledCommand::getIntervalOnDataStrobe() const
{
sc_assert(
getCommand() == Command::Read || getCommand() == Command::ReadA
|| getCommand() == Command::Write
|| getCommand() == Command::WriteA);
TimingConfiguration& timings = Configuration::getInstance().Timings;
if (getCommand() == Command::Read || getCommand() == Command::ReadA)
{
return TimeInterval(getStart() + timings.tRL,getStart() + timings.tRL + getReadAcessTime());
}
else
{
return TimeInterval(getStart() + timings.tWL - timings.clk / 2, getStart() + timings.tWL + getWriteAcessTime() - timings.clk / 2);
}
}
}