Files
DRAMSys/DRAM/src/core/scheduling/CommandSchedule.h
Janik Schlemminger dacaec7f11 connecting components in controller
commandbus changing state when scheduling commands
added some tests
2014-03-14 16:35:44 -07:00

63 lines
1.3 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(const tlm::tlm_generic_payload& transaction) : transaction(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();
}
common::Bank getBank() const
{
return common::DramExtension::getExtension(&transaction).getBank();
}
private:
std::vector<ScheduledCommand> scheduledCommands;
const tlm::tlm_generic_payload& transaction;
};
} /* namespace controller */
#endif /* COMMANDSCHEDULE_H_ */