/* * CommandSchedule.h * * Created on: Mar 5, 2014 * Author: jonny */ #ifndef COMMANDSCHEDULE_H_ #define COMMANDSCHEDULE_H_ #include #include "common/dramextension.h" #include "ScheduledCommand.h" namespace controller { class CommandSchedule { public: CommandSchedule(const tlm::tlm_generic_payload& transaction) : transaction(transaction) {}; virtual ~CommandSchedule() {} void add(Command command, sc_time time, sc_time executionTime) { assert(scheduledCommands.empty() || time >= scheduledCommands.back().getEnd()); scheduledCommands.push_back(ScheduledCommand(transaction, command, time, executionTime)); } void add(ScheduledCommand scheduledCommand) { assert(&scheduledCommand.getTransaction() == &transaction); scheduledCommands.push_back(scheduledCommand); } const std::vector& 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 scheduledCommands; const tlm::tlm_generic_payload& transaction; }; } /* namespace controller */ #endif /* COMMANDSCHEDULE_H_ */