OpenASIP
2.0
|
#include <IUBroker.hh>
Classes | |
struct | less_width |
Functor for sorting result of allAvailable by register width. More... | |
Public Member Functions | |
IUBroker (std::string) | |
IUBroker (std::string, SimpleResourceManager *, unsigned int initiationInterval=0) | |
virtual | ~IUBroker () |
bool | isAnyResourceAvailable (int useCycle, 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, const MoveNode &, 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, MoveNode &, SchedulingResource &, 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 *preassignedBus) const override |
virtual void | buildResources (const TTAMachine::Machine &target) override |
virtual void | setupResourceLinks (const ResourceMapper &mapper) override |
virtual bool | isIUBroker () const override |
virtual std::shared_ptr< TTAProgram::TerminalImmediate > | immediateValue (const MoveNode &node) const |
virtual int | immediateWriteCycle (const MoveNode &node) const |
void | clearOldResources () |
![]() | |
ResourceBroker (std::string, unsigned int initiationInterval=0) | |
virtual | ~ResourceBroker () |
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 | 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) |
Private Attributes | |
const TTAMachine::Machine * | target_ |
Target machine. More... | |
SimpleResourceManager * | rm_ |
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_ |
Immediate unit broker.
Definition at line 57 of file IUBroker.hh.
IUBroker::IUBroker | ( | std::string | name | ) |
Constructor.
Definition at line 63 of file IUBroker.cc.
IUBroker::IUBroker | ( | std::string | name, |
SimpleResourceManager * | rm, | ||
unsigned int | initiationInterval = 0 |
||
) |
Constructor.
Definition at line 72 of file IUBroker.cc.
|
virtual |
|
overridevirtual |
Return all resources managed by this broker that can be assigned to the given node in the given cycle.
useCycle | Read from immediate register by Node |
node | Node. |
Reimplemented from ResourceBroker.
Definition at line 149 of file IUBroker.cc.
References IUResource::canAssign(), TTAProgram::Terminal::copy(), TTAProgram::Terminal::immediateUnit(), ResourceBroker::initiationInterval_, SchedulingResourceSet::insert(), TTAProgram::Terminal::isImmediateRegister(), SimpleResourceManager::isTemplateAvailable(), ResourceBroker::machinePartOf(), MAX_LIMM_DISTANCE, MoveNode::move(), TTAMachine::BaseRegisterFile::port(), ResourceBroker::resMap_, ResourceBroker::resourceOf(), rm_, and TTAProgram::Move::source().
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.
useCycle | Cycle in which immediate register is read by Node |
node | MoveNode that reads a register |
res | Long immediate register file resource |
immWriteCycle | forced def cycle for the immediate. Not forced if -1 |
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 233 of file IUBroker.cc.
References __func__, assert, IUResource::assign(), ResourceBroker::assignedResources_, IUResource::canAssign(), TTAProgram::Terminal::copy(), ResourceBroker::hasResource(), TTAProgram::Terminal::immediateUnit(), TTAProgram::Terminal::isImmediateRegister(), SimpleResourceManager::isTemplateAvailable(), ResourceBroker::machinePartOf(), MAX_LIMM_DISTANCE, MoveNode::move(), TTAMachine::BaseRegisterFile::port(), ResourceBroker::resourceOf(), rm_, TTAProgram::Move::setSource(), TTAProgram::Move::source(), and MoveNode::toString().
|
overridevirtual |
Return one (any) resource managed by this broker that has a register available for assignment between given definition and use cycles.
useCycle | Use cycle. |
node | Node. |
Reimplemented from ResourceBroker.
Definition at line 122 of file IUBroker.cc.
References __func__, and allAvailableResources().
|
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 453 of file IUBroker.cc.
References ResourceBroker::addResource(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::ImmediateUnit::extensionMode(), TTAMachine::Machine::immediateUnitNavigator(), ResourceBroker::initiationInterval_, TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::ImmediateUnit::latency(), TTAMachine::Component::name(), TTAMachine::BaseRegisterFile::numberOfRegisters(), target_, and TTAMachine::BaseRegisterFile::width().
void IUBroker::clearOldResources | ( | ) |
Clears bookkeeping which is needed for unassigning previously assigned moves. After this call these cannot be unassigned, but new moves which are assigned after this call can still be unassigned.
Definition at line 598 of file IUBroker.cc.
References IUResource::clearOldResources(), and ResourceBroker::resMap_.
Referenced by SimpleBrokerDirector::clearOldResources().
|
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 347 of file IUBroker.cc.
References abortWithError.
|
virtual |
Returns a original Immediate value for a node
node | Node that was changed to immediate register read |
Definition at line 555 of file IUBroker.cc.
References __func__, ResourceBroker::assignedResources_, MapTools::containsKey(), IUResource::immediateValue(), and MoveNode::isSourceImmediateRegister().
Referenced by SimpleBrokerDirector::immediateValue().
|
virtual |
Returns a cycle in which the original Immediate value is written into immediate register.
node | Node that was changed to immediate register read |
Definition at line 578 of file IUBroker.cc.
References __func__, ResourceBroker::assignedResources_, MapTools::containsKey(), IUResource::immediateWriteCycle(), and MoveNode::isSourceImmediateRegister().
Referenced by SimpleBrokerDirector::immediateWriteCycle().
|
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 394 of file IUBroker.cc.
References ResourceBroker::assignedResources_, MapTools::containsKey(), and IUResource::immediateValue().
|
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.
defCycle | Cycle in which the write to long immediate register is |
useCycle | Cycle in which the long immediate register is read by node |
node | Node. |
Reimplemented from ResourceBroker.
Definition at line 97 of file IUBroker.cc.
References allAvailableResources().
|
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 422 of file IUBroker.cc.
References TTAProgram::ProgramAnnotation::ANN_REQUIRES_LIMM, SimpleResourceManager::canTransportImmediate(), TTAProgram::AnnotatedInstructionElement::hasAnnotations(), MoveNode::isMove(), MoveNode::isSourceConstant(), MoveNode::isSourceImmediateRegister(), MoveNode::move(), and rm_.
|
overridevirtual |
Return true always.
Reimplemented from ResourceBroker.
Definition at line 543 of file IUBroker.cc.
|
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 370 of file IUBroker.cc.
References abortWithError.
|
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 484 of file IUBroker.cc.
References __func__, SchedulingResource::addToRelatedGroup(), TTAMachine::Machine::Navigator< ComponentType >::count(), Exception::errorMessageStack(), TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::InstructionTemplate::isOneOfDestinations(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Port::outputSocket(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), ResourceBroker::resMap_, ResourceMapper::resourceOf(), ResourceBroker::setResourceMapper(), and target_.
|
overridevirtual |
Free the Immediate register and set MoveNode source back to TerminalImmediate constant.
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 321 of file IUBroker.cc.
References abortWithError, ResourceBroker::assignedResources_, MapTools::containsKey(), MoveNode::cycle(), MoveNode::toString(), and IUResource::unassign().
|
private |
Definition at line 136 of file IUBroker.hh.
Referenced by allAvailableResources(), assign(), and isApplicable().
|
private |
Target machine.
Definition at line 127 of file IUBroker.hh.
Referenced by buildResources(), and setupResourceLinks().