Go to the documentation of this file.
73 unsigned int initiationInterval) :
75 target_(NULL), rm_(rm) {
103 int immRegIndex)
const {
105 useCycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex).
107 return (resultCount > 0);
132 useCycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex).
135 std::string message =
"No immediate register resource available.";
155 int immRegIndex)
const {
157 int defCycle = useCycle;
158 if (immWriteCycle != -1) {
159 defCycle = immWriteCycle;
175 std::vector<IUResource*> tmpResult;
182 while (defCycle >= 0 && (useCycle - defCycle) < maxLimmDistance &&
184 ResourceMap::const_iterator resIter =
resMap_.begin();
185 while (resIter !=
resMap_.end()) {
188 if (immu == NULL ||
resourceOf(*immu) == (*resIter).second) {
189 if (iuRes->
canAssign(defCycle, useCycle, node, immRegIndex)) {
198 auto imm = std::make_shared<Immediate>(tempImm, newSrc);
200 tmpResult.push_back(iuRes);
206 sort(tmpResult.begin(), tmpResult.end(),
less_width());
207 std::vector<IUResource*>::iterator tmpItr = tmpResult.begin();
208 while (tmpItr != tmpResult.end()) {
209 results.
insert(*(*tmpItr));
212 if (immWriteCycle != -1) {
237 int defCycle = useCycle;
238 if (immWriteCycle != -1) {
239 defCycle = immWriteCycle;
256 iuRes->
assign(useCycle, node);
258 std::pair<const MoveNode*, SchedulingResource*>(&node, iuRes));
266 if (iuRes.
canAssign(defCycle, useCycle, node, immRegIndex)) {
274 auto imm = std::make_shared<Immediate>(tempImm, newSrc);
279 if (immWriteCycle != -1) {
280 std::cerr <<
"Use cycle: " << useCycle <<
" imm cycle: "
281 << immWriteCycle <<
" node: " << node.
toString()
283 assert(NULL &&
"Can't assign forced imm write at cycle");
288 if (immRegIndex != -1)
290 iuRes.
assign(defCycle, useCycle, node, index);
298 std::pair<const MoveNode*, SchedulingResource*>(&node, &iuRes));
303 string msg =
"Broker does not contain given resource.";
323 TCEString msg =
"Trying to unassign Long Immediate register ";
324 msg +=
"that was not assigned previously: " + node.
toString();
329 MapTools::valueForKey<SchedulingResource*>(
403 MapTools::valueForKey<SchedulingResource*>(
458 for (
int i = 0; i < navi.
count(); i++) {
460 bool extension =
false;
488 for (ResourceMap::iterator resIter =
resMap_.begin();
489 resIter !=
resMap_.end(); resIter++) {
495 for (
int i = 0; i < iu->
portCount(); i++) {
503 std::string msg =
"IUBroker: finding ";
504 msg +=
" resource for Socket ";
505 msg +=
" failed with error: ";
516 for (
int i = 0; i < navi.
count(); i++) {
524 std::string msg =
"IUBroker: finding ";
525 msg +=
" resource for Template ";
526 msg +=
" failed with error: ";
554 std::shared_ptr<TTAProgram::TerminalImmediate>
561 MapTools::valueForKey<SchedulingResource*>(
566 "MoveNode was not assigned Immediate resource.");
584 MapTools::valueForKey<SchedulingResource*>(
589 "MoveNode was not assigned Immediate resource.");
599 for (ResourceMap::iterator i =
resMap_.begin(); i !=
resMap_.end(); i++) {
virtual bool isAlreadyAssigned(int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const override
unsigned int initiationInterval_
virtual TCEString name() const
std::string toString() const
const TTAMachine::Machine * target_
Target machine.
static const int MAX_LIMM_DISTANCE
virtual bool isIUBroker() const override
virtual bool isApplicable(const MoveNode &node, const TTAMachine::Bus *preassignedBus) 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
bool hasResource(const SchedulingResource &r) const
bool isSourceConstant() const
MoveResMap assignedResources_
SchedulingResource & resourceOf(const TTAMachine::MachinePart &mp, int index=0) const
void addResource(const TTAMachine::MachinePart &mp, SchedulingResource *res)
virtual int numberOfRegisters() const
bool isSourceImmediateRegister() const
#define assert(condition)
virtual bool isImmediateRegister() const
void setResourceMapper(const ResourceMapper &mapper)
#define abortWithError(message)
virtual void addToRelatedGroup(const int group, SchedulingResource &resource)
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 ImmediateUnitNavigator immediateUnitNavigator() const
virtual void assign(const int cycle, MoveNode &node) override
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
std::string errorMessageStack(bool messagesOnly=false) const
SchedulingResource * resourceOf(const TTAMachine::MachinePart &mp) const
virtual const TTAMachine::ImmediateUnit & immediateUnit() const
virtual bool canAssign(const int, const MoveNode &) const override
SimpleResourceManager * rm_
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 isOneOfDestinations(const ImmediateUnit &dstUnit) const
int immediateWriteCycle(const MoveNode &node) const
virtual int portCount() const
bool hasAnnotations(ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID) 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 override
virtual void unassign(MoveNode &node) override
TTAProgram::Move & move()
virtual RFPort * port(const std::string &name) const
virtual void unassign(const int cycle, MoveNode &node) override
std::shared_ptr< TTAProgram::TerminalImmediate > immediateValue(const MoveNode &node) const
virtual bool canTransportImmediate(const MoveNode &node, const TTAMachine::Bus *preAssignedBus=NULL) const
virtual bool isTemplateAvailable(int, std::shared_ptr< TTAProgram::Immediate >) const
virtual Terminal * copy() const =0
virtual Socket * outputSocket() const
virtual std::shared_ptr< TTAProgram::TerminalImmediate > immediateValue(const MoveNode &node) const
Terminal & source() const
virtual void setupResourceLinks(const ResourceMapper &mapper) override
virtual const TTAMachine::MachinePart & machinePartOf(const SchedulingResource &r) const
ComponentType * item(int index) const
virtual void buildResources(const TTAMachine::Machine &target) override
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
virtual int width() const
void insert(SchedulingResource &resource)
virtual int immediateWriteCycle(const MoveNode &node) const
Functor for sorting result of allAvailable by register width.
void setSource(Terminal *src)