Go to the documentation of this file.
63 unsigned int initiationInterval):
64 ResourceBroker(name, initiationInterval), longestLatency_(0), ddg_(NULL) {
78 i->first->setMaxCycle(maxCycle);
147 if (efs == -1 || efs == INT_MAX) {
152 if (efd == -1 || efd == INT_MAX) {
161 if (efs == -1 || efs == INT_MAX) {
169 if (efd == -1 || efd == INT_MAX) {
258 for (
int i = 0; i < navi.
count(); i++) {
266 pair<SchedulingResource*, const FunctionUnit*>(epResource, fu));
295 for (ResourceMap::iterator resIter =
resMap_.begin();
296 resIter !=
resMap_.end(); resIter++) {
300 if (fuOriginal == NULL){
303 "ExecutionPipelineBroker has something "
304 "else then FU registered!");
313 fu = MapTools::valueForKey<const FunctionUnit*>(
316 std::string msg =
"Pipeline resource \'";
317 msg += epResource->
name();
318 msg +=
"\' not found";
322 for (
int i = 0; i < fu->
portCount(); i++) {
331 std::string msg =
"ExecutionPipelineBroker: finding ";
332 msg +=
" resource for Socket ";
333 msg +=
" failed with error: ";
335 msg +=
" for resource " + epResource->
name();
346 std::string msg =
"ExecutionPipelineBroker: finding ";
347 msg +=
" resource for Socket ";
348 msg +=
" failed with error: ";
350 msg +=
" for resource " + epResource->
name();
368 for (ResourceMap::const_iterator resIter =
resMap_.begin();
369 resIter !=
resMap_.end(); resIter++) {
395 i->first->setInitiationInterval(ii);
405 for (
auto e : inEdges) {
406 if (e->isBackEdge()) {
438 const MoveNode* lastOperandNode = NULL;
439 const MoveNode* lastResultNode = NULL;
444 if (tempNode->
isScheduled() && tempNode != &node) {
445 minCycle = std::max(tempNode->
cycle(), minCycle);
446 lastOperandNode = tempNode;
448 triggerNode = tempNode;
455 if (tempNode->
isScheduled() && tempNode != &node) {
456 int tempCycle = tempNode->
cycle();
460 minCycle = std::max(tempCycle, minCycle);
461 lastResultNode = tempNode;
465 if (minCycle == -1) {
468 if (minCycle > cycle && lastResultNode == NULL) {
473 if (triggerNode != NULL) {
476 && lastResultNode == NULL) {
480 "Some operand move is written after the result move "
493 assert(lastOperandNode != NULL || lastResultNode != NULL);
495 if (lastOperandNode != NULL) {
506 if (srcFU != NULL && fu != srcFU) {
515 int triggerCycle = triggerNode != NULL && triggerNode->
isScheduled() ?
516 triggerNode->
cycle() :
521 port, minCycle, node, triggerNode, triggerCycle);
522 if (cycle < nextResult || nextResult < minCycle) {
550 if (tempNode->
isScheduled() && tempNode != &node) {
552 latest = std::min(tempNode->
cycle(), latest);
559 if (tempNode->
isScheduled() && tempNode != &node) {
562 if (dstUnit != NULL && dstUnit != fu) {
568 const int outputIndex =
575 int tempCycle = tempNode->
cycle();
580 latest = std::min(latest,
581 tempCycle - hwop.
latency(outputIndex));
615 const int outputIndex =
621 if (tempNode->
isScheduled() && tempNode != &node) {
623 if (srcFU != NULL&& fu != srcFU) {
626 minCycle = std::max(tempNode->
cycle()+1, minCycle);
628 triggerNode = tempNode;
630 latency = hwop->
latency(outputIndex);
631 minCycle = std::max(triggerNode->
cycle() + latency, cycle);
635 if (minCycle == -1) {
642 minCycle = std::max(cycle,1);
645 if (triggerNode != NULL && triggerNode->
isScheduled()) {
646 int triggerCycle = triggerNode->
cycle();
655 port, triggerNode, triggerCycle)) {
660 return std::max(minCycle, cycle);
679 if (tempNode != &node) {
688 auto hwop = fu->operation(
690 auto port = hwop->port(
692 if (port == triggeringPort) {
728 int minCycle = cycle;
740 if (tempNode->
isScheduled() && tempNode != &node) {
743 if (dstFU != NULL && fu != dstFU) {
749 minCycle = std::max(tempNode->
cycle(), minCycle);
753 int triggerCycle = tempNode->
cycle();
754 if (triggerCycle < cycle) {
765 int minResultCycle = INT_MAX;
774 if (dstFU != NULL && fu != dstFU) {
778 const int outputIndex =
783 unsigned int latency = hwop->
latency(outputIndex);
794 if (minResultCycle < minCycle) {
807 for (ResourceMap::iterator i =
resMap_.begin(); i !=
resMap_.end(); i++) {
virtual bool isApplicable(const MoveNode &node, const TTAMachine::Bus *) const override
const Operation & operation() const
virtual bool isFUPort() const
virtual ~ExecutionPipelineBroker()
int outputIndexFromGuardOfMove(const MoveNode &node) const
bool isTriggering() const
virtual int latestCycle(int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
virtual Socket * inputSocket() const
int longestLatency_
Longest latency of all operations of all the FUs.
unsigned int initiationInterval_
std::string toString() const
virtual int highestKnownCycle() const
virtual void buildResources(const TTAMachine::Machine &target) override
bool isDestinationOperation() const
virtual BaseFUPort * triggerPort() const
int latestFromDestination(int, const MoveNode &, const TTAMachine::FunctionUnit *dstFU) const
Terminal & destination() const
virtual void assign(int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex) override
int earliestFromSource(int, const MoveNode &, const TTAMachine::FunctionUnit *srcFU) const
const TTAMachine::FunctionUnit * fuFromOutMove(const MoveNode &outputNode) const
ExecutionPipelineBroker(std::string, unsigned int initiationInterval=0)
virtual BaseFUPort * port(const std::string &name) const
SchedulingResource & resourceOf(const TTAMachine::MachinePart &mp, int index=0) const
void addResource(const TTAMachine::MachinePart &mp, SchedulingResource *res)
virtual TCEString name() const
virtual int maxLatency() const
const DataDependenceGraph * ddg_
ProgramOperation & sourceOperation() const
#define assert(condition)
virtual void setMaxCycle(unsigned int maxCycle) override
virtual FUPort * port(int operand) const
void setResourceMapper(const ResourceMapper &mapper)
bool isGuardOperation() const
EdgeSet operationInEdges(const MoveNode &node) const
int earliestResultReadCycle() const
virtual ControlUnit * controlUnit() const
virtual bool isAlreadyAssigned(int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const override
virtual int operationIndex() const
#define abortWithError(message)
virtual void addToRelatedGroup(const int group, SchedulingResource &resource)
bool resultNotOverWritten(int resultReadCycle, int resultReadyCycle, const MoveNode &node, const TTAMachine::Port &port, const MoveNode *trigger, int triggerCycle) const
bool isLoopBypass(const MoveNode &node) const
bool isMoveTrigger(const MoveNode &node) const
virtual FunctionUnitNavigator functionUnitNavigator() const
virtual void unassign(MoveNode &node) override
int latestFromSource(int, const MoveNode &, const TTAMachine::FunctionUnit *srcFU) const
FUPipelineMap fuPipelineMap_
FU's and their corresponding pipeline resources.
std::string errorMessageStack(bool messagesOnly=false) const
virtual void setInitiationInterval(unsigned int cycles)
SchedulingResource * resourceOf(const TTAMachine::MachinePart &mp) const
bool isSourceOperation() const
unsigned int destinationOperationCount() const
int inputMoveCount() const
virtual bool isTriggering() const =0
bool hasNode(const Node &) const
virtual int portCount() const
int outputMoveCount() const
virtual const TTAMachine::FunctionUnit & functionUnit() const
virtual bool isExecutionPipelineBroker() const override
ProgramOperation & destinationOperation(unsigned int index=0) const
TTAProgram::Move & move()
virtual void setInitiationInterval(unsigned int cycles) override
virtual void setupResourceLinks(const ResourceMapper &mapper) override
int nextResultCycle(const TTAMachine::Port &port, int cycle, const MoveNode &node, const MoveNode *trigger=NULL, int triggerCycle=INT_MAX) const
virtual Socket * outputSocket() const
Terminal & source() const
void setDDG(const DataDependenceGraph *ddg)
virtual int earliestCycle(int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
ComponentType * item(int index) const
virtual HWOperation * operation(const std::string &name) const
virtual const std::string & name() const
int earliestFromDestination(int, const MoveNode &, const TTAMachine::FunctionUnit *dstFU) const
MoveNode & outputMove(int index) const
int highestKnownCycle() const
int outputIndexOfMove(const MoveNode &mn) const
MoveNode & inputMove(int index) const
ProgramOperation & guardOperation() const