OpenASIP
2.0
|
#include <ResourceBroker.hh>
Public Types | |
typedef std::set< SchedulingResource * > | ResourceSet |
Public Member Functions | |
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 |
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 =0 |
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 =0 |
virtual bool | isAlreadyAssigned (int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const =0 |
virtual bool | isApplicable (const MoveNode &node, const TTAMachine::Bus *preassignedBus) const =0 |
virtual void | assign (int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex)=0 |
virtual void | unassign (MoveNode &node)=0 |
virtual void | buildResources (const TTAMachine::Machine &target)=0 |
virtual void | setupResourceLinks (const ResourceMapper &mapper)=0 |
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 |
virtual bool | isExecutionPipelineBroker () const |
void | validateResources () const |
virtual std::string | brokerName () const |
void | resources (ResourceSet &contents) |
virtual void | setInitiationInterval (unsigned int cycles) |
virtual void | clear () |
virtual void | setMaxCycle (unsigned int) |
Protected Types | |
typedef std::map< const TTAMachine::MachinePart *, SchedulingResource *, TTAMachine::MachinePart::Comparator > | ResourceMap |
typedef std::map< const MoveNode *, SchedulingResource *, MoveNode::Comparator > | MoveResMap |
Protected Member Functions | |
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 | |
unsigned int | initiationInterval_ |
ResourceMap | resMap_ |
const ResourceMapper * | resourceMapper_ |
MoveResMap | assignedResources_ |
std::string | brokerName_ |
Base interface for resource brokers.
Definition at line 61 of file ResourceBroker.hh.
|
protected |
Definition at line 154 of file ResourceBroker.hh.
|
protected |
Definition at line 147 of file ResourceBroker.hh.
typedef std::set<SchedulingResource*> ResourceBroker::ResourceSet |
Definition at line 66 of file ResourceBroker.hh.
ResourceBroker::ResourceBroker | ( | std::string | name, |
unsigned int | initiationInterval = 0 |
||
) |
|
virtual |
Destructor.
Definition at line 59 of file ResourceBroker.cc.
References MapTools::deleteAllValues(), and resMap_.
|
protected |
Add resource - machine part pair to the broker.
mp | Machine part. |
res | Corresponding resource. |
Definition at line 265 of file ResourceBroker.cc.
References resMap_.
Referenced by ExecutionPipelineBroker::buildResources(), OutputFUBroker::buildResources(), InputPSocketBroker::buildResources(), InputFUBroker::buildResources(), OutputPSocketBroker::buildResources(), ITemplateBroker::buildResources(), IUBroker::buildResources(), and BusBroker::buildResources().
|
virtual |
Return all resources managed by this broker that can be assigned to the given node in the given cycle.
cycle | Cycle. |
node | Node. |
Reimplemented in ITemplateBroker, IUBroker, BusBroker, OutputPSocketBroker, InputFUBroker, InputPSocketBroker, and OutputFUBroker.
Definition at line 143 of file ResourceBroker.cc.
Referenced by PendingAssignment::isAssignmentPossible(), and isAvailable().
|
pure virtual |
Implemented in IUBroker, BusBroker, InputFUBroker, ITemplateBroker, OutputPSocketBroker, InputPSocketBroker, OutputFUBroker, and ExecutionPipelineBroker.
Referenced by PendingAssignment::tryNext().
|
virtual |
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. |
InstanceNotFound | If no available resource is found. |
Reimplemented in BusBroker, and IUBroker.
Definition at line 111 of file ResourceBroker.cc.
References __func__, SchedulingResource::canAssign(), SchedulingResource::isAvailable(), and resMap_.
|
virtual |
Returns the name of particular broker. Used for debugging mainly.
Definition at line 356 of file ResourceBroker.cc.
References brokerName_.
Referenced by validateResources().
|
pure virtual |
Implemented in IUBroker, ITemplateBroker, OutputPSocketBroker, InputFUBroker, InputPSocketBroker, OutputFUBroker, ExecutionPipelineBroker, and BusBroker.
|
virtual |
Clears all resources managed by the broker so that the broker can be reused.
Reimplemented in BusBroker, and ITemplateBroker.
Definition at line 365 of file ResourceBroker.cc.
References assignedResources_, and resMap_.
Referenced by ITemplateBroker::clear(), and BusBroker::clear().
|
pure virtual |
Implemented in ITemplateBroker, BusBroker, IUBroker, OutputPSocketBroker, InputPSocketBroker, InputFUBroker, OutputFUBroker, and ExecutionPipelineBroker.
bool ResourceBroker::hasResource | ( | const SchedulingResource & | r | ) | const |
Return true if this broker holds given resource instance.
r | Scheduling resource. |
Definition at line 214 of file ResourceBroker.cc.
References MapTools::containsValue(), and resMap_.
Referenced by OutputFUBroker::assign(), InputPSocketBroker::assign(), OutputPSocketBroker::assign(), InputFUBroker::assign(), IUBroker::assign(), and BusBroker::assign().
bool ResourceBroker::hasResourceOf | ( | const TTAMachine::MachinePart & | mp | ) | const |
Return true if this broker holds a resource instance that models given machine part.
mp | Machine part. |
Definition at line 203 of file ResourceBroker.cc.
References MapTools::containsKey(), and resMap_.
Referenced by FUBroker::findDstFUOfMove(), FUBroker::findFUOfPO(), OutputFUBroker::isAlreadyAssigned(), InputFUBroker::isAlreadyAssigned(), and BusBroker::isInUse().
|
protected |
Return the instruction index corresponding to cycle.
If modulo scheduling is not used (ie. initiation interval is 0), then index is equal to cycle.
cycle | Cycle to get instruction index. |
Definition at line 249 of file ResourceBroker.cc.
References initiationInterval_.
Referenced by OutputFUBroker::allAvailableResources(), InputPSocketBroker::allAvailableResources(), OutputPSocketBroker::allAvailableResources(), ITemplateBroker::allAvailableResources(), BusBroker::allAvailableResources(), InputPSocketBroker::assign(), OutputPSocketBroker::assign(), ITemplateBroker::assign(), BusBroker::assign(), ITemplateBroker::assignImmediate(), BusBroker::availableResource(), ITemplateBroker::findITemplates(), ITemplateBroker::instruction(), OutputFUBroker::isAlreadyAssigned(), InputFUBroker::isAlreadyAssigned(), InputPSocketBroker::isAlreadyAssigned(), OutputPSocketBroker::isAlreadyAssigned(), ITemplateBroker::isAlreadyAssigned(), BusBroker::isAlreadyAssigned(), OutputPSocketBroker::isAnyResourceAvailable(), BusBroker::isAnyResourceAvailable(), ITemplateBroker::isAnyResourceAvailable(), BusBroker::isAvailable(), BusBroker::isInUse(), and ITemplateBroker::unassignImmediate().
|
pure virtual |
Implemented in BusBroker, IUBroker, ITemplateBroker, OutputPSocketBroker, InputFUBroker, OutputFUBroker, ExecutionPipelineBroker, and InputPSocketBroker.
Referenced by AssignmentPlan::backtrack(), PendingAssignment::forget(), AssignmentPlan::tryNextAssignment(), and PendingAssignment::undoAssignment().
|
virtual |
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. |
Reimplemented in ITemplateBroker, IUBroker, BusBroker, and OutputPSocketBroker.
Definition at line 75 of file ResourceBroker.cc.
References SchedulingResource::canAssign(), SchedulingResource::isAvailable(), and resMap_.
|
pure virtual |
Implemented in InputPSocketBroker, IUBroker, InputFUBroker, OutputFUBroker, OutputPSocketBroker, BusBroker, ITemplateBroker, and ExecutionPipelineBroker.
Referenced by AssignmentPlan::tryCachedAssignment().
|
virtual |
Tells whether the given resource is available for given node at given cycle.
Reimplemented in BusBroker.
Definition at line 158 of file ResourceBroker.cc.
References allAvailableResources(), and resources().
|
virtual |
Reimplemented in BusBroker.
Definition at line 303 of file ResourceBroker.cc.
Referenced by SimpleBrokerDirector::busBroker().
|
virtual |
Reimplemented in ExecutionPipelineBroker.
Definition at line 318 of file ResourceBroker.cc.
Referenced by SimpleBrokerDirector::executionPipelineBroker().
|
virtual |
Reimplemented in ITemplateBroker.
Definition at line 308 of file ResourceBroker.cc.
Referenced by SimpleBrokerDirector::instructionTemplateBroker().
|
virtual |
Reimplemented in IUBroker.
Definition at line 313 of file ResourceBroker.cc.
Referenced by SimpleBrokerDirector::immediateUnitBroker().
|
pure virtual |
Implemented in ITemplateBroker, BusBroker, IUBroker, OutputPSocketBroker, InputPSocketBroker, InputFUBroker, OutputFUBroker, and ExecutionPipelineBroker.
|
virtual |
Return the machine part that models the given resource.
r | Scheduling resource. |
KeyNotFound | If no corresponding machine part is found or r is not one of the primary resources of this broker. |
Definition at line 181 of file ResourceBroker.cc.
References __func__, SchedulingResource::name(), and resMap_.
Referenced by IUBroker::allAvailableResources(), BusBroker::allAvailableResources(), OutputFUBroker::assign(), InputPSocketBroker::assign(), OutputPSocketBroker::assign(), ITemplateBroker::assign(), InputFUBroker::assign(), IUBroker::assign(), BusBroker::assign(), ITemplateBroker::assignImmediate(), BusBroker::hasGuard(), ITemplateBroker::instruction(), BusBroker::isAvailable(), ITemplateBroker::reselectTemplate(), and OutputFUBroker::unassign().
int ResourceBroker::resourceCount | ( | ) | const |
Definition at line 298 of file ResourceBroker.cc.
References resMap_.
|
protected |
Return the resource mapper set for this broker.
Definition at line 234 of file ResourceBroker.cc.
References resourceMapper_.
Referenced by InputFUBroker::allAvailableResources().
|
inline |
Referenced by OutputFUBroker::allAvailableResources(), InputPSocketBroker::allAvailableResources(), InputFUBroker::allAvailableResources(), OutputPSocketBroker::allAvailableResources(), IUBroker::allAvailableResources(), BusBroker::allAvailableResources(), ITemplateBroker::assign(), IUBroker::assign(), ITemplateBroker::assignImmediate(), ExecutionPipelineBroker::earliestFromSource(), ITemplateBroker::findITemplates(), InputPSocketBroker::isAlreadyAssigned(), OutputPSocketBroker::isAlreadyAssigned(), ITemplateBroker::isAlreadyAssigned(), OutputPSocketBroker::isAnyResourceAvailable(), BusBroker::isAvailable(), BusBroker::isInUse(), ExecutionPipelineBroker::latestFromSource(), InputPSocketBroker::setupResourceLinks(), OutputPSocketBroker::setupResourceLinks(), BusBroker::setupResourceLinks(), OutputFUBroker::unassign(), InputPSocketBroker::unassign(), InputFUBroker::unassign(), BusBroker::unassign(), and ITemplateBroker::unassignImmediate().
void ResourceBroker::resources | ( | ResourceSet & | contents | ) |
Get resources
contents | Set to which resources are copied to. |
Definition at line 279 of file ResourceBroker.cc.
References resMap_.
Referenced by ITemplateBroker::assignImmediate(), isAvailable(), and ITemplateBroker::reselectTemplate().
|
virtual |
Set initiation interval, if ii = 0 then initiation interval is not used.
ii | initiation interval |
Reimplemented in ExecutionPipelineBroker.
Definition at line 292 of file ResourceBroker.cc.
References initiationInterval_.
Referenced by ExecutionPipelineBroker::ExecutionPipelineBroker().
|
inlinevirtual |
|
protected |
Set the resource mapper for this broker.
mapper | Resource mapper. |
Definition at line 224 of file ResourceBroker.cc.
References resourceMapper_.
Referenced by ExecutionPipelineBroker::setupResourceLinks(), OutputFUBroker::setupResourceLinks(), InputPSocketBroker::setupResourceLinks(), InputFUBroker::setupResourceLinks(), OutputPSocketBroker::setupResourceLinks(), ITemplateBroker::setupResourceLinks(), IUBroker::setupResourceLinks(), and BusBroker::setupResourceLinks().
|
pure virtual |
Implemented in IUBroker, ITemplateBroker, OutputPSocketBroker, InputFUBroker, InputPSocketBroker, OutputFUBroker, ExecutionPipelineBroker, and BusBroker.
|
pure virtual |
Implemented in IUBroker, InputFUBroker, ITemplateBroker, OutputPSocketBroker, InputPSocketBroker, OutputFUBroker, ExecutionPipelineBroker, and BusBroker.
Referenced by PendingAssignment::forget(), and PendingAssignment::undoAssignment().
void ResourceBroker::validateResources | ( | ) | const |
Tests if is each resource has correct related and dependent groups.
ModuleRunTimeError | in case resource does not have correct related or dependent resources. |
Definition at line 329 of file ResourceBroker.cc.
References __func__, brokerName(), and resMap_.
|
protected |
Definition at line 167 of file ResourceBroker.hh.
Referenced by OutputFUBroker::assign(), InputPSocketBroker::assign(), OutputPSocketBroker::assign(), InputFUBroker::assign(), IUBroker::assign(), BusBroker::assign(), clear(), IUBroker::immediateValue(), IUBroker::immediateWriteCycle(), OutputFUBroker::isAlreadyAssigned(), InputFUBroker::isAlreadyAssigned(), InputPSocketBroker::isAlreadyAssigned(), OutputPSocketBroker::isAlreadyAssigned(), IUBroker::isAlreadyAssigned(), BusBroker::isAlreadyAssigned(), OutputFUBroker::unassign(), InputPSocketBroker::unassign(), OutputPSocketBroker::unassign(), InputFUBroker::unassign(), IUBroker::unassign(), and BusBroker::unassign().
|
protected |
Definition at line 168 of file ResourceBroker.hh.
Referenced by brokerName().
|
protected |
Definition at line 158 of file ResourceBroker.hh.
Referenced by IUBroker::allAvailableResources(), ExecutionPipelineBroker::buildResources(), InputPSocketBroker::buildResources(), InputFUBroker::buildResources(), OutputPSocketBroker::buildResources(), ITemplateBroker::buildResources(), IUBroker::buildResources(), BusBroker::buildResources(), ExecutionPipelineBroker::earliestFromDestination(), ExecutionPipelineBroker::earliestFromSource(), instructionIndex(), ExecutionPipelineBroker::latestFromDestination(), ExecutionPipelineBroker::latestFromSource(), ExecutionPipelineBroker::setInitiationInterval(), setInitiationInterval(), and BusBroker::setupResourceLinks().
|
protected |
Definition at line 165 of file ResourceBroker.hh.
Referenced by addResource(), OutputFUBroker::allAvailableResources(), InputFUBroker::allAvailableResources(), IUBroker::allAvailableResources(), BusBroker::allAvailableResources(), availableResource(), BusBroker::canTransportImmediate(), clear(), IUBroker::clearOldResources(), ITemplateBroker::findITemplates(), BusBroker::hasGuard(), hasResource(), hasResourceOf(), ExecutionPipelineBroker::highestKnownCycle(), isAnyResourceAvailable(), machinePartOf(), resourceCount(), resources(), ExecutionPipelineBroker::setDDG(), ExecutionPipelineBroker::setupResourceLinks(), OutputFUBroker::setupResourceLinks(), InputPSocketBroker::setupResourceLinks(), InputFUBroker::setupResourceLinks(), OutputPSocketBroker::setupResourceLinks(), ITemplateBroker::setupResourceLinks(), IUBroker::setupResourceLinks(), BusBroker::setupResourceLinks(), validateResources(), and ~ResourceBroker().
|
protected |
Definition at line 166 of file ResourceBroker.hh.
Referenced by resourceMapper(), and setResourceMapper().