OpenASIP
2.0
|
#include <ExecutionPipelineBroker.hh>
Public Member Functions | |
ExecutionPipelineBroker (std::string, unsigned int initiationInterval=0) | |
virtual | ~ExecutionPipelineBroker () |
virtual void | assign (int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex) override |
virtual void | unassign (MoveNode &node) override |
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 |
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 bool | isAlreadyAssigned (int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const override |
virtual bool | isApplicable (const MoveNode &node, const TTAMachine::Bus *) const override |
virtual void | buildResources (const TTAMachine::Machine &target) override |
virtual void | setupResourceLinks (const ResourceMapper &mapper) override |
virtual int | highestKnownCycle () const |
virtual bool | isExecutionPipelineBroker () const override |
virtual void | setInitiationInterval (unsigned int cycles) override |
virtual int | longestLatency () const |
virtual void | setMaxCycle (unsigned int maxCycle) override |
void | setDDG (const DataDependenceGraph *ddg) |
Public Member Functions inherited from ResourceBroker | |
ResourceBroker (std::string, unsigned int initiationInterval=0) | |
virtual | ~ResourceBroker () |
virtual bool | isAnyResourceAvailable (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 |
virtual SchedulingResource & | availableResource (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 |
virtual SchedulingResourceSet | allAvailableResources (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 |
virtual bool | isAvailable (SchedulingResource &des, const MoveNode &node, int cycle, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const |
SchedulingResource * | resourceOf (const TTAMachine::MachinePart &mp) const |
virtual const TTAMachine::MachinePart & | machinePartOf (const SchedulingResource &r) const |
bool | hasResourceOf (const TTAMachine::MachinePart &mp) const |
bool | hasResource (const SchedulingResource &r) const |
int | resourceCount () const |
virtual bool | isBusBroker () const |
virtual bool | isITemplateBroker () const |
virtual bool | isIUBroker () const |
void | validateResources () const |
virtual std::string | brokerName () const |
void | resources (ResourceSet &contents) |
virtual void | clear () |
Private Types | |
typedef std::map< SchedulingResource *, const TTAMachine::FunctionUnit * > | FUPipelineMap |
Map to link FU's and pipelines. More... | |
Private Member Functions | |
bool | isMoveTrigger (const MoveNode &node) const |
bool | isLoopBypass (const MoveNode &node) const |
int | latestFromSource (int, const MoveNode &, const TTAMachine::FunctionUnit *srcFU) const |
int | latestFromDestination (int, const MoveNode &, const TTAMachine::FunctionUnit *dstFU) const |
int | earliestFromSource (int, const MoveNode &, const TTAMachine::FunctionUnit *srcFU) const |
int | earliestFromDestination (int, const MoveNode &, const TTAMachine::FunctionUnit *dstFU) const |
Private Attributes | |
FUPipelineMap | fuPipelineMap_ |
FU's and their corresponding pipeline resources. More... | |
int | longestLatency_ |
Longest latency of all operations of all the FUs. More... | |
const DataDependenceGraph * | ddg_ |
Additional Inherited Members | |
Public Types inherited from ResourceBroker | |
typedef std::set< SchedulingResource * > | ResourceSet |
Protected Types inherited from ResourceBroker | |
typedef std::map< const TTAMachine::MachinePart *, SchedulingResource *, TTAMachine::MachinePart::Comparator > | ResourceMap |
typedef std::map< const MoveNode *, SchedulingResource *, MoveNode::Comparator > | MoveResMap |
Protected Member Functions inherited from ResourceBroker | |
void | setResourceMapper (const ResourceMapper &mapper) |
const ResourceMapper & | resourceMapper () const |
unsigned int | instructionIndex (unsigned int) const |
void | addResource (const TTAMachine::MachinePart &mp, SchedulingResource *res) |
Protected Attributes inherited from ResourceBroker | |
unsigned int | initiationInterval_ |
ResourceMap | resMap_ |
const ResourceMapper * | resourceMapper_ |
MoveResMap | assignedResources_ |
std::string | brokerName_ |
Execution pipeline broker.
Definition at line 53 of file ExecutionPipelineBroker.hh.
|
private |
Map to link FU's and pipelines.
Definition at line 97 of file ExecutionPipelineBroker.hh.
ExecutionPipelineBroker::ExecutionPipelineBroker | ( | std::string | name, |
unsigned int | initiationInterval = 0 |
||
) |
Constructor.
Definition at line 62 of file ExecutionPipelineBroker.cc.
References fuPipelineMap_, and ResourceBroker::setInitiationInterval().
|
virtual |
|
overridevirtual |
Mark given resource as in use for the given node, and assign the corresponding machine part (if applicable) to the node's move.
If the node is already assigned to given resource, this method does nothing.
WrongSubclass | If this broker does not recognise the given type of resource. |
InvalidParameters | If he given resource cannot be assigned to given node or no corresponding machine part is found. |
Implements ResourceBroker.
Definition at line 102 of file ExecutionPipelineBroker.cc.
References abortWithError.
|
overridevirtual |
Build all resource objects of the controlled type required to model scheduling resources of the given target processor.
This method cannot set up the resource links (dependent and related resources) of the constructed resource objects.
target | Target machine. |
Implements ResourceBroker.
Definition at line 255 of file ExecutionPipelineBroker.cc.
References ResourceBroker::addResource(), TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), fuPipelineMap_, ResourceBroker::initiationInterval_, TTAMachine::Machine::Navigator< ComponentType >::item(), longestLatency_, and TTAMachine::FunctionUnit::maxLatency().
|
overridevirtual |
Return the earliest cycle, starting from given cycle, where a resource of the type managed by this broker can be assigned to the given node.
Considers source and destination terminals independently and compares the results. Returns -1 if no assignment is possible.
cycle | Cycle. |
node | Node. |
srcFU | if not null, srcFu that has to be used. |
dstFU | if not null, dstFU that has to be used. |
immWriteCycle | if not -1 and src is imm, write cycle of limm. |
Implements ResourceBroker.
Definition at line 137 of file ExecutionPipelineBroker.cc.
References debugLogRM, earliestFromDestination(), and earliestFromSource().
Referenced by SimpleBrokerDirector::earliestCycle().
|
private |
Return earliest cycle, starting from given parameter and going towards INT_MAX, in which the node can be scheduled. Taking into account destination terminal of Move (operand write).
This method may return too early for some cases but there is canassign test after this always at higher level in RM so this does not matter; having this method is just performance optimization to avoid calling slow canAssign() for too small values.
cycle | Starting cycle for tests |
node | MoveNode to find earliest cycle for |
Definition at line 719 of file ExecutionPipelineBroker.cc.
References MoveNode::cycle(), debugLogRM, TTAProgram::Move::destination(), MoveNode::destinationOperation(), MoveNode::destinationOperationCount(), ProgramOperation::fuFromOutMove(), TTAProgram::Terminal::functionUnit(), ResourceBroker::initiationInterval_, ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), MoveNode::isDestinationOperation(), isMoveTrigger(), MoveNode::isScheduled(), TTAProgram::Move::isTriggering(), TTAMachine::HWOperation::latency(), MoveNode::move(), Operation::name(), TTAMachine::FunctionUnit::operation(), ProgramOperation::operation(), ProgramOperation::outputIndexOfMove(), ProgramOperation::outputMove(), and ProgramOperation::outputMoveCount().
Referenced by earliestCycle().
|
private |
Returns earliest cycle, starting from given parameter and going towards INT_MAX, in which the node can be scheduled. Taking into account source Terminal of Move (result read) and other operands already scheduled.
cycle | Starting cycle for tests |
node | MoveNode to find earliest cycle for |
Definition at line 600 of file ExecutionPipelineBroker.cc.
References assert, MoveNode::cycle(), debugLogRM, TTAProgram::Move::destination(), MoveNode::earliestResultReadCycle(), TTAProgram::Terminal::functionUnit(), ResourceBroker::initiationInterval_, ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), TTAProgram::Terminal::isFUPort(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), TTAProgram::Move::isTriggering(), TTAMachine::HWOperation::latency(), MoveNode::move(), Operation::name(), TTAMachine::FunctionUnit::operation(), ProgramOperation::operation(), TTAProgram::Terminal::operationIndex(), TTAMachine::HWOperation::port(), ResourceBroker::resourceOf(), ExecutionPipelineResource::resultNotOverWritten(), TTAProgram::Move::source(), and MoveNode::sourceOperation().
Referenced by earliestCycle().
|
virtual |
Return the highest cycle any of the pipeline is known to be used
Definition at line 366 of file ExecutionPipelineBroker.cc.
References ExecutionPipelineResource::highestKnownCycle(), and ResourceBroker::resMap_.
|
overridevirtual |
Return true if the given node is already assigned a resource of the type managed by this broker, and the assignment appears valid (that is, the broker has marked that resource as in use in the given cycle).
cycle | Cycle. |
node | Node. |
Implements ResourceBroker.
Definition at line 222 of file ExecutionPipelineBroker.cc.
References abortWithError.
|
overridevirtual |
Return true if the given node needs a resource of the type managed by this broker, false otherwise.
node | Node. |
Implements ResourceBroker.
Definition at line 240 of file ExecutionPipelineBroker.cc.
|
overridevirtual |
Reimplemented from ResourceBroker.
Definition at line 378 of file ExecutionPipelineBroker.cc.
|
private |
Definition at line 399 of file ExecutionPipelineBroker.cc.
References ddg_, BoostGraph< GraphNode, GraphEdge >::hasNode(), and DataDependenceGraph::operationInEdges().
Referenced by latestFromDestination(), and latestFromSource().
|
private |
Definition at line 664 of file ExecutionPipelineBroker.cc.
References TTAProgram::Move::destination(), MoveNode::destinationOperation(), MoveNode::destinationOperationCount(), TTAProgram::Terminal::functionUnit(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), MoveNode::isDestinationOperation(), MoveNode::isScheduled(), TTAProgram::Move::isTriggering(), MoveNode::move(), Operation::name(), ProgramOperation::operation(), TTAProgram::Terminal::operationIndex(), and TTAMachine::FunctionUnit::triggerPort().
Referenced by earliestFromDestination().
|
overridevirtual |
Return the latest cycle, starting from given cycle, where a resource of the type managed by this broker can be assigned to the given node.
cycle | Cycle. |
node | Node. |
srcFU | if not null, srcFu that has to be used. |
dstFU | if not null, dstFU that has to be used. |
immWriteCycle | if not -1 and src is imm, write cycle of limm. |
Implements ResourceBroker.
Definition at line 193 of file ExecutionPipelineBroker.cc.
References latestFromDestination(), and latestFromSource().
Referenced by SimpleBrokerDirector::latestCycle().
|
private |
Returns latest cycle, starting from given parameter and going towards zero, in which the node can be scheduled. Taking into account destination terminal of Move (operand write).
cycle | Starting cycle for tests |
node | MoveNode to find latest cycle for |
Definition at line 538 of file ExecutionPipelineBroker.cc.
References MoveNode::cycle(), TTAProgram::Move::destination(), MoveNode::destinationOperation(), MoveNode::destinationOperationCount(), TTAProgram::Terminal::functionUnit(), ResourceBroker::initiationInterval_, ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), isLoopBypass(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), TTAProgram::Move::isTriggering(), TTAMachine::HWOperation::latency(), MoveNode::move(), Operation::name(), TTAMachine::FunctionUnit::operation(), ProgramOperation::operation(), TTAProgram::Terminal::operationIndex(), ProgramOperation::outputIndexFromGuardOfMove(), ProgramOperation::outputMove(), ProgramOperation::outputMoveCount(), TTAProgram::Move::source(), and MoveNode::sourceOperation().
Referenced by latestCycle().
|
private |
Returns latest cycle, starting from given parameter and going towards zero, in which the node can be scheduled. Taking into account source terminal of Move (result read).
cycle | Starting cycle for tests |
node | MoveNode to find latest cycle for |
Definition at line 425 of file ExecutionPipelineBroker.cc.
References __func__, assert, MoveNode::cycle(), debugLogRM, TTAProgram::Move::destination(), MoveNode::earliestResultReadCycle(), ProgramOperation::fuFromOutMove(), TTAProgram::Terminal::functionUnit(), MoveNode::guardOperation(), ResourceBroker::initiationInterval_, ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), MoveNode::isGuardOperation(), isLoopBypass(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), TTAProgram::Move::isTriggering(), MoveNode::move(), Operation::name(), ExecutionPipelineResource::nextResultCycle(), TTAMachine::FunctionUnit::operation(), ProgramOperation::operation(), TTAProgram::Terminal::operationIndex(), ProgramOperation::outputMove(), ProgramOperation::outputMoveCount(), TTAMachine::HWOperation::port(), ResourceBroker::resourceOf(), TTAProgram::Move::source(), MoveNode::sourceOperation(), and MoveNode::toString().
Referenced by latestCycle().
|
inlinevirtual |
Definition at line 88 of file ExecutionPipelineBroker.hh.
References longestLatency_.
Referenced by SimpleBrokerDirector::latestCycle().
void ExecutionPipelineBroker::setDDG | ( | const DataDependenceGraph * | ddg | ) |
Definition at line 806 of file ExecutionPipelineBroker.cc.
References ddg_, and ResourceBroker::resMap_.
Referenced by SimpleBrokerDirector::setDDG().
|
overridevirtual |
Set initiation interval, if ii = 0 then initiation interval is not used.
ii | initiation interval |
Reimplemented from ResourceBroker.
Definition at line 388 of file ExecutionPipelineBroker.cc.
References fuPipelineMap_, and ResourceBroker::initiationInterval_.
|
overridevirtual |
Reimplemented from ResourceBroker.
Definition at line 74 of file ExecutionPipelineBroker.cc.
References fuPipelineMap_.
Referenced by SimpleBrokerDirector::setMaxCycle().
|
overridevirtual |
Complete resource initialisation by creating the references to other resources due to a dependency or a relation. Use the given resource mapper to lookup dependent and related resources using machine parts as keys.
mapper | Resource mapper. |
Implements ResourceBroker.
Definition at line 291 of file ExecutionPipelineBroker.cc.
References __func__, abortWithError, SchedulingResource::addToRelatedGroup(), Exception::errorMessageStack(), fuPipelineMap_, TTAMachine::Port::inputSocket(), TTAMachine::BaseFUPort::isTriggering(), SchedulingResource::name(), TTAMachine::Port::outputSocket(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), ResourceBroker::resMap_, ResourceMapper::resourceOf(), and ResourceBroker::setResourceMapper().
|
overridevirtual |
Free the resource type managed by this broker and unassign it from given node.
If this broker is not applicable to the given node, or the node is not assigned a resource of the managed type, this method does nothing.
node | Node. |
Implements ResourceBroker.
Definition at line 118 of file ExecutionPipelineBroker.cc.
References abortWithError.
|
private |
Definition at line 111 of file ExecutionPipelineBroker.hh.
Referenced by isLoopBypass(), and setDDG().
|
private |
FU's and their corresponding pipeline resources.
Definition at line 108 of file ExecutionPipelineBroker.hh.
Referenced by buildResources(), ExecutionPipelineBroker(), setInitiationInterval(), setMaxCycle(), and setupResourceLinks().
|
private |
Longest latency of all operations of all the FUs.
Definition at line 110 of file ExecutionPipelineBroker.hh.
Referenced by buildResources(), and longestLatency().