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

71 lines
1.4 KiB
C++

/*
* CommandSchedule.h
*
* Created on: Mar 5, 2014
* Author: jonny
*/
#ifndef COMMANDSCHEDULE_H_
#define COMMANDSCHEDULE_H_
#include <vector>
#include "common/dramExtension.h"
#include "ScheduledCommand.h"
namespace controller {
class CommandSchedule
{
public:
CommandSchedule(tlm::tlm_generic_payload& transaction) :
transaction(&transaction), extension(DramExtension::getExtension(&transaction))
{
}
virtual ~CommandSchedule()
{
}
ScheduledCommand& add(Command command, sc_time time, sc_time executionTime)
{
assert(scheduledCommands.empty() || time >= scheduledCommands.back().getEnd());
scheduledCommands.push_back(ScheduledCommand(*transaction, command, time, executionTime));
return scheduledCommands.back();
}
const std::vector<ScheduledCommand>& getScheduledCommands() const
{
return scheduledCommands;
}
sc_time getStart() const
{
return scheduledCommands.front().getStart();
}
sc_time getEnd() const
{
return scheduledCommands.back().getEnd();
}
sc_time getExecutionTime() const
{
return scheduledCommands.back().getEnd() - scheduledCommands.front().getStart();
}
Bank getBank() const
{
return extension.getBank();
}
private:
std::vector<ScheduledCommand> scheduledCommands;
tlm::tlm_generic_payload* transaction;
DramExtension extension;
};
} /* namespace controller */
#endif /* COMMANDSCHEDULE_H_ */