OpenASIP
2.0
|
#include <BusBroker.hh>
Public Member Functions | |
BusBroker (std::string name, ResourceBroker &ipBroker, ResourceBroker &opBroker, const TTAMachine::Machine &mach, unsigned int initiationInterval=0) | |
virtual | ~BusBroker () |
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 override |
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 override |
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 override |
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 override |
virtual void | assign (int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex) override |
virtual void | unassign (MoveNode &node) |
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) |
virtual void | setupResourceLinks (const ResourceMapper &mapper) |
virtual bool | isBusBroker () const |
virtual bool | canTransportImmediate (const MoveNode &node, const TTAMachine::Bus *preAssigndBus) const |
virtual bool | isInUse (int cycle, const MoveNode &node) const |
virtual bool | hasGuard (const MoveNode &node) const |
void | clear () override |
void | setCFG (const ControlFlowGraph *cfg) |
void | setBBN (const BasicBlockNode *bbn) |
![]() | |
ResourceBroker (std::string, unsigned int initiationInterval=0) | |
virtual | ~ResourceBroker () |
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 | isITemplateBroker () const |
virtual bool | isIUBroker () const |
virtual bool | isExecutionPipelineBroker () const |
void | validateResources () const |
virtual std::string | brokerName () const |
void | resources (ResourceSet &contents) |
virtual void | setInitiationInterval (unsigned int cycles) |
virtual void | setMaxCycle (unsigned int) |
Private Member Functions | |
bool | jumpToBBN (const MoveNode &mn, BasicBlockNode &bbn) const |
bool | canPerformSIMMJump (const MoveNode &mn, ShortImmPSocketResource &immRes) const |
virtual bool | canTransportImmediate (const MoveNode &node, ShortImmPSocketResource &immRes) const |
virtual ShortImmPSocketResource & | findImmResource (BusResource &busRes) const |
Private Attributes | |
std::list< SchedulingResource * > | shortImmPSocketResources_ |
std::map< const MoveNode *, bool > | busPreassigned_ |
ResourceBroker & | inputPSocketBroker_ |
ResourceBroker & | outputPSocketBroker_ |
bool | hasLimm_ |
const TTAMachine::Machine * | mach_ |
const ControlFlowGraph * | cfg_ |
const BasicBlockNode * | bbn_ |
Additional Inherited Members | |
![]() | |
typedef std::set< SchedulingResource * > | ResourceSet |
![]() | |
typedef std::map< const TTAMachine::MachinePart *, SchedulingResource *, TTAMachine::MachinePart::Comparator > | ResourceMap |
typedef std::map< const MoveNode *, SchedulingResource *, MoveNode::Comparator > | MoveResMap |
![]() | |
void | setResourceMapper (const ResourceMapper &mapper) |
const ResourceMapper & | resourceMapper () const |
unsigned int | instructionIndex (unsigned int) const |
void | addResource (const TTAMachine::MachinePart &mp, SchedulingResource *res) |
![]() | |
unsigned int | initiationInterval_ |
ResourceMap | resMap_ |
const ResourceMapper * | resourceMapper_ |
MoveResMap | assignedResources_ |
std::string | brokerName_ |
Bus broker.
Definition at line 60 of file BusBroker.hh.
BusBroker::BusBroker | ( | std::string | name, |
ResourceBroker & | ipBroker, | ||
ResourceBroker & | opBroker, | ||
const TTAMachine::Machine & | mach, | ||
unsigned int | initiationInterval = 0 |
||
) |
Constructor.
name | name for this broker. |
ipsb | reference to InputPSocketBroker of this RM. |
opsb | reference to OutputPSocketBroker of this RM. |
initiationInterval | initiationinterval when doing loop scheduling. |
Definition at line 73 of file BusBroker.cc.
|
virtual |
Destructor.
Definition at line 86 of file BusBroker.cc.
References SequenceTools::deleteAllItems(), and shortImmPSocketResources_.
|
overridevirtual |
Return all resources managed by this broker that can be assigned to the given node in the given cycle.
cycle | Cycle. |
node | Node. |
bus | if not null, bus that has to be used. |
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. |
Reimplemented from ResourceBroker.
Definition at line 178 of file BusBroker.cc.
References __func__, TTAProgram::Move::bus(), BusResource::canAssign(), canTransportImmediate(), SchedulingResourceSet::count(), TTAProgram::Move::destination(), Exception::errorMessageStack(), findImmResource(), TTAProgram::MoveGuard::guard(), TTAProgram::Move::guard(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), inputPSocketBroker_, TTAMachine::Port::inputSocket(), SchedulingResourceSet::insert(), UniversalMachine::instance(), ResourceBroker::instructionIndex(), TTAMachine::Guard::isEqual(), TTAProgram::Terminal::isImmediate(), TTAProgram::Move::isUnconditional(), ResourceBroker::machinePartOf(), TTAMachine::Port::name(), TTAMachine::Component::name(), outputPSocketBroker_, TTAMachine::Port::outputSocket(), TTAMachine::Port::parentUnit(), TTAProgram::Terminal::port(), SchedulingResourceSet::remove(), ResourceBroker::resMap_, SchedulingResourceSet::resource(), ResourceBroker::resourceOf(), TTAProgram::Move::source(), and UniversalMachine::universalBus().
Referenced by availableResource(), and isAnyResourceAvailable().
|
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.
cycle | Cycle for which to assign bus |
node | Node which will be transfered using a bus |
res | ResourceObject referring to particular bus to assign |
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 474 of file BusBroker.cc.
References __func__, assert, BusResource::assign(), ResourceBroker::assignedResources_, TTAProgram::Move::bus(), busPreassigned_, TTAProgram::MoveGuard::guard(), TTAProgram::Move::guard(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), ResourceBroker::hasResource(), UniversalMachine::instance(), ResourceBroker::instructionIndex(), TTAMachine::Guard::isEqual(), TTAProgram::Move::isUnconditional(), ResourceBroker::machinePartOf(), TTAProgram::Move::setBus(), TTAProgram::Move::setGuard(), and UniversalMachine::universalBus().
|
overridevirtual |
Return one (any) resource managed by this broker that can be assigned to the given node in the given cycle.
If no change occurs to the state of the resources, the broker should always return the same object. If a resource of the type managed by this broker is already assigned to the node, it is returned.
cycle | Cycle. |
node | Node. |
bus | if not null, bus that has to be used. |
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. |
InstanceNotFound | If no available resource is found. |
Reimplemented from ResourceBroker.
Definition at line 141 of file BusBroker.cc.
References __func__, allAvailableResources(), assert, SchedulingResourceSet::count(), ResourceBroker::instructionIndex(), and SchedulingResourceSet::resource().
|
virtual |
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 646 of file BusBroker.cc.
References ResourceBroker::addResource(), assert, TTAMachine::TemplateSlot::bus(), TTAMachine::Machine::busNavigator(), TTAMachine::Segment::connectionCount(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::TemplateSlot::destination(), hasLimm_, TTAMachine::Machine::immediateUnitNavigator(), ResourceBroker::initiationInterval_, TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::name(), TTAMachine::Bus::segment(), TTAMachine::Bus::segmentCount(), TTAMachine::InstructionTemplate::slot(), TTAMachine::InstructionTemplate::slotCount(), and TTAMachine::Bus::width().
|
private |
Definition at line 801 of file BusBroker.cc.
Referenced by canTransportImmediate().
|
virtual |
Return true if immediate in given node can be transported by any bus in broker, with the guard which the move contains.
node | Node that contains immediate read. |
Definition at line 756 of file BusBroker.cc.
References MachineConnectivityCheck::busConnectedToDestination(), findImmResource(), TTAProgram::MoveGuard::guard(), TTAProgram::Move::guard(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), hasLimm_, TTAMachine::Guard::isEqual(), TTAProgram::Move::isUnconditional(), MoveNode::move(), and ResourceBroker::resMap_.
Referenced by allAvailableResources(), SimpleBrokerDirector::canTransportImmediate(), and isAvailable().
|
privatevirtual |
Return true if immediate in given node can be transported by bus that is represented by given p-socket resource.
node | Node that contains immediate read. |
immRes | P-socket resource representing write if immediate to related bus. |
Definition at line 817 of file BusBroker.cc.
References canPerformSIMMJump(), ShortImmPSocketResource::immediateWidth(), TTAProgram::Move::isJump(), mach_, MachineConnectivityCheck::requiredImmediateWidth(), ShortImmPSocketResource::signExtends(), and TTAProgram::Move::source().
|
overridevirtual |
Clears all resources managed by the broker so that the broker can be reused.
Reimplemented from ResourceBroker.
Definition at line 889 of file BusBroker.cc.
References busPreassigned_, ResourceBroker::clear(), and shortImmPSocketResources_.
|
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.
cycle | Cycle. |
node | Node. |
Implements ResourceBroker.
Definition at line 550 of file BusBroker.cc.
References abortWithError.
|
privatevirtual |
Return the short immediate p-socket resource related to given bus.
busRes | Bus resource. |
Definition at line 846 of file BusBroker.cc.
References SchedulingResource::isShortImmPSocketResource(), SchedulingResource::relatedResource(), and SchedulingResource::relatedResourceCount().
Referenced by allAvailableResources(), canTransportImmediate(), and isAvailable().
|
virtual |
Tests if any of a buses known to BusBroker supports a guard required by MoveNode.
node | MoveNode to test. |
Definition at line 868 of file BusBroker.cc.
References TTAProgram::MoveGuard::guard(), TTAProgram::Move::guard(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), TTAMachine::Guard::isEqual(), ResourceBroker::machinePartOf(), and ResourceBroker::resMap_.
Referenced by SimpleBrokerDirector::hasGuard().
|
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 594 of file BusBroker.cc.
References ResourceBroker::assignedResources_, MapTools::containsKey(), ResourceBroker::instructionIndex(), and isInUse().
|
overridevirtual |
Return true if one of the resources managed by this broker is suitable for the request contained in the node and can be assigned to it in given cycle.
cycle | Cycle. |
node | Node. |
bus | if not null, bus that has to be used. |
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. |
Reimplemented from ResourceBroker.
Definition at line 106 of file BusBroker.cc.
References allAvailableResources(), SchedulingResourceSet::count(), and ResourceBroker::instructionIndex().
|
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 632 of file BusBroker.cc.
References MoveNode::isMove().
|
overridevirtual |
Tells whether the given resource is available for given node at given cycle.
Reimplemented from ResourceBroker.
Definition at line 332 of file BusBroker.cc.
References __func__, BusResource::canAssign(), canTransportImmediate(), TTAProgram::Move::destination(), Exception::errorMessageStack(), findImmResource(), TTAProgram::MoveGuard::guard(), TTAProgram::Move::guard(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), inputPSocketBroker_, TTAMachine::Port::inputSocket(), ResourceBroker::instructionIndex(), TTAMachine::Guard::isEqual(), TTAProgram::Terminal::isImmediate(), TTAProgram::Move::isUnconditional(), ResourceBroker::machinePartOf(), TTAMachine::Port::name(), TTAMachine::Component::name(), outputPSocketBroker_, TTAMachine::Port::outputSocket(), TTAMachine::Port::parentUnit(), TTAProgram::Terminal::port(), ResourceBroker::resourceOf(), and TTAProgram::Move::source().
|
virtual |
Return true always.
Reimplemented from ResourceBroker.
Definition at line 743 of file BusBroker.cc.
|
virtual |
Return true if given node already uses a resource of the type managed by this broker and assignment appears to be valid.
cycle | Cycle to test |
node | Node to test |
Definition at line 612 of file BusBroker.cc.
References ResourceBroker::hasResourceOf(), ResourceBroker::instructionIndex(), BusResource::isInUse(), and ResourceBroker::resourceOf().
Referenced by isAlreadyAssigned().
|
private |
|
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. |
Implements ResourceBroker.
Definition at line 571 of file BusBroker.cc.
References abortWithError.
|
inline |
Definition at line 136 of file BusBroker.hh.
References bbn_.
Referenced by SimpleBrokerDirector::setBBN().
|
inline |
Definition at line 135 of file BusBroker.hh.
References cfg_.
Referenced by SimpleBrokerDirector::setCFG().
|
virtual |
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 688 of file BusBroker.cc.
References __func__, SchedulingResource::addToRelatedGroup(), TTAMachine::Segment::connection(), TTAMachine::Segment::connectionCount(), TTAMachine::Bus::immediateWidth(), ResourceBroker::initiationInterval_, inputPSocketBroker_, TTAMachine::Component::name(), outputPSocketBroker_, ResourceBroker::resMap_, ResourceBroker::resourceOf(), TTAMachine::Bus::segment(), TTAMachine::Bus::segmentCount(), ResourceBroker::setResourceMapper(), shortImmPSocketResources_, and TTAMachine::Bus::signExtends().
|
virtual |
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 to unassign. |
Implements ResourceBroker.
Definition at line 522 of file BusBroker.cc.
References ResourceBroker::assignedResources_, TTAProgram::Move::bus(), busPreassigned_, MapTools::containsKey(), MoveNode::cycle(), UniversalMachine::instance(), ResourceBroker::resourceOf(), TTAProgram::Move::setBus(), BusResource::unassign(), and UniversalMachine::universalBus().
|
private |
Definition at line 153 of file BusBroker.hh.
Referenced by setBBN().
|
private |
Definition at line 147 of file BusBroker.hh.
Referenced by assign(), clear(), and unassign().
|
private |
Definition at line 152 of file BusBroker.hh.
Referenced by setCFG().
|
private |
Definition at line 150 of file BusBroker.hh.
Referenced by buildResources(), and canTransportImmediate().
|
private |
Definition at line 148 of file BusBroker.hh.
Referenced by allAvailableResources(), isAvailable(), and setupResourceLinks().
|
private |
Definition at line 151 of file BusBroker.hh.
Referenced by canTransportImmediate().
|
private |
Definition at line 149 of file BusBroker.hh.
Referenced by allAvailableResources(), isAvailable(), and setupResourceLinks().
|
private |
Definition at line 146 of file BusBroker.hh.
Referenced by clear(), setupResourceLinks(), and ~BusBroker().