Files
DRAMSys/DRAM/dram/core/scheduling/ScheduledCommand.h
2014-03-15 18:31:16 +01:00

103 lines
1.7 KiB
C++

/*
* ScheduledCommand.h
*
* Created on: Mar 10, 2014
* Author: jonny
*/
#ifndef SCHEDULEDCOMMAND_H_
#define SCHEDULEDCOMMAND_H_
#include <systemc.h>
#include <tlm.h>
#include "Command.h"
#include "common/dramExtension.h"
namespace controller {
class ScheduledCommand
{
public:
static const ScheduledCommand NoCommand;
ScheduledCommand(tlm::tlm_generic_payload& transaction, Command command, sc_time time,
sc_time executionTime) :
transaction(&transaction), command(command), start(time), executionTime(executionTime), extension(DramExtension::getExtension(&transaction))
{
}
ScheduledCommand() :
transaction(NULL), command(NOP), start(SC_ZERO_TIME), executionTime(SC_ZERO_TIME), extension()
{
}
bool isNoCommand() const
{
return (*this == NoCommand);
}
const sc_time getStart() const
{
return start;
}
void delayStart(sc_time delay)
{
start += delay;
}
const sc_time getEnd() const
{
return start + executionTime;
}
const Command getCommand() const
{
return command;
}
const sc_time getExecutionTime() const
{
return executionTime;
}
tlm::tlm_generic_payload& getTransaction() const
{
assert(transaction);
return *transaction;
}
Bank getBank() const
{
return extension.getBank();
}
Row getRow() const
{
return extension.getRow();
}
inline bool operator==(const ScheduledCommand& b) const
{
return b.command == command && b.start == start && b.executionTime == executionTime;
}
void invalidateTransaction()
{
transaction = NULL;
}
private:
tlm::tlm_generic_payload* transaction;
Command command;
sc_time start;
sc_time executionTime;
DramExtension extension;
};
} /* namespace controller */
#endif /* SCHEDULEDCOMMAND_H_ */