38 lines
1017 B
C++
38 lines
1017 B
C++
/*
|
|
* CommandSequenceScheduler.cpp
|
|
*
|
|
* Created on: Mar 9, 2014
|
|
* Author: jonny
|
|
*/
|
|
|
|
#include "CommandSequenceScheduler.h"
|
|
#include "../ControllerCore.h"
|
|
#include "../../common/DebugManager.h"
|
|
#include "../TimingCalculation.h"
|
|
|
|
namespace core {
|
|
|
|
CommandSchedule CommandSequenceScheduler::schedule(CommandSequence commands, sc_time start,
|
|
tlm::tlm_generic_payload& transaction)
|
|
{
|
|
CommandSchedule schedule(transaction);
|
|
|
|
for (Command cmd : commands)
|
|
{
|
|
ControllerCore::printDebugMessage("Scheduling command " + commandToString(cmd));
|
|
|
|
ICommandChecker& checker = controller.getCommandChecker(cmd);
|
|
|
|
sc_time executionTime = getExecutionTime(cmd,transaction);
|
|
ScheduledCommand& scheduledCommand = schedule.add(cmd, start, executionTime);
|
|
checker.delayToSatisfyConstraints(scheduledCommand);
|
|
|
|
sc_assert(scheduledCommand.getStart()>=start && scheduledCommand.getStart() < scheduledCommand.getEnd());
|
|
controller.state.change(scheduledCommand);
|
|
}
|
|
|
|
return schedule;
|
|
}
|
|
|
|
} /* namespace controller */
|