OpenASIP  2.0
Public Member Functions | List of all members
InputFUBroker Class Reference

#include <InputFUBroker.hh>

Inheritance diagram for InputFUBroker:
Inheritance graph
Collaboration diagram for InputFUBroker:
Collaboration graph

Public Member Functions

 InputFUBroker (std::string, unsigned int initiationInterval=0)
 
virtual ~InputFUBroker ()
 
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 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 *preAssigndBus=0) const override
 
virtual void assign (int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex) override
 
virtual void unassign (MoveNode &node) override
 
virtual void buildResources (const TTAMachine::Machine &target) override
 
virtual void setupResourceLinks (const ResourceMapper &mapper) override
 
- Public Member Functions inherited from FUBroker
 FUBroker (std::string name, unsigned int initiationInterval=0)
 
virtual ~FUBroker ()
 
- 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 SchedulingResourceavailableResource (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
 
SchedulingResourceresourceOf (const TTAMachine::MachinePart &mp) const
 
virtual const TTAMachine::MachinePartmachinePartOf (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)
 

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::ComparatorResourceMap
 
typedef std::map< const MoveNode *, SchedulingResource *, MoveNode::ComparatorMoveResMap
 
- Protected Member Functions inherited from FUBroker
std::pair< bool, const TTAMachine::FunctionUnit * > findDstFUOfMove (const MoveNode &node, const TTAMachine::FunctionUnit *resFU, DataDependenceGraph::NodeSet &processedInputNodes) const
 
std::pair< bool, const TTAMachine::FunctionUnit * > findFUOfPO (ProgramOperation &po, const TTAMachine::FunctionUnit *resFU) const
 
- Protected Member Functions inherited from ResourceBroker
void setResourceMapper (const ResourceMapper &mapper)
 
const ResourceMapperresourceMapper () 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 ResourceMapperresourceMapper_
 
MoveResMap assignedResources_
 
std::string brokerName_
 

Detailed Description

Input function unit broker.

Definition at line 55 of file InputFUBroker.hh.

Constructor & Destructor Documentation

◆ InputFUBroker()

InputFUBroker::InputFUBroker ( std::string  name,
unsigned int  initiationInterval = 0 
)

Constructor.

Definition at line 68 of file InputFUBroker.cc.

69  :
70  FUBroker(name, initiationInterval) {
71 }

◆ ~InputFUBroker()

InputFUBroker::~InputFUBroker ( )
virtual

Destructor.

Definition at line 76 of file InputFUBroker.cc.

76  {
77 }

Member Function Documentation

◆ allAvailableResources()

SchedulingResourceSet InputFUBroker::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
overridevirtual

Return all resources managed by this broker that can be assigned to the given node in the given cycle.

Parameters
cycleCycle.
nodeNode.
Returns
All resources managed by this broker that can be assigned to the given node in the given cycle.

Reimplemented from ResourceBroker.

Definition at line 89 of file InputFUBroker.cc.

95  {
96  if (!isApplicable(node)) {
97  string msg = "Broker not capable of assigning resources to node!";
98  throw ModuleRunTimeError(__FILE__, __LINE__, __func__, msg);
99  }
100 
101  Move& move = const_cast<MoveNode&>(node).move();
102  TerminalFUPort& dst = static_cast<TerminalFUPort&>(move.destination());
103 
104  SchedulingResourceSet resourceSet;
105  ResourceMap::const_iterator resIter = resMap_.begin();
106 
107  if (dynamic_cast<const SpecialRegisterPort*>(&dst.port()) != NULL) {
108  // only gcu applies
109  while (resIter != resMap_.end()) {
110  const ControlUnit* gcu =
111  dynamic_cast<const ControlUnit*>((*resIter).first);
112  if (gcu != NULL) {
113  InputFUResource* fuRes =
114  static_cast<InputFUResource*>((*resIter).second);
115  if (fuRes->isAvailable(cycle)) {
116  resourceSet.insert(*fuRes);
117  }
118  return resourceSet;
119  }
120  resIter++;
121  }
122  abortWithError("No GCU found!");
123  }
124 
125  int opIndex = dst.operationIndex();
126  Operation& op = dst.hintOperation();
127  std::string opName = StringTools::stringToLower(op.name());
128 
129  // check if a unit has already been assigned to some node
130  // of the same operation and use it.
131  const FunctionUnit* foundFU = dstFU;
132 
133  DataDependenceGraph::NodeSet processedInputNodes;
134  auto a = findDstFUOfMove(node, foundFU, processedInputNodes);
135  if (a.first) {
136  foundFU = a.second;
137  } else { // conflicting FUs, cannot schedule
138  if (foundFU != nullptr) {
139  return SchedulingResourceSet();
140  }
141  }
142 
143  if (foundFU) {
144  InputFUResource& foundFURes =
145  static_cast<InputFUResource&>(*resourceOf(*foundFU));
146 
147  // Find what is the port on a new FU for given
148  // operation index. Find a socket for testing.
149  HWOperation* hwOp = foundFU->operationLowercase(opName);
150  Socket* soc = hwOp->port(opIndex)->inputSocket();
151 
152  FUPort* tempPort =
153  dynamic_cast<FUPort*>(hwOp->port(opIndex));
154  if (tempPort == NULL){
155  throw InvalidData(
156  __FILE__, __LINE__, __func__,
157  "Target is missing necessary FUPort!");
158  }
159  bool triggering = false;
160  if (tempPort->isTriggering()) {
161  triggering = true;
162  }
163 
164  InputPSocketResource* pSocket = NULL;
165  try {
166  pSocket = &static_cast<InputPSocketResource&>(
167  resourceMapper().resourceOf(*soc));
168  } catch (const KeyNotFound& e) {
169  std::string msg = "InputFUBroker: finding ";
170  msg += " resource for Socket ";
171  msg += " failed with error: ";
172  msg += e.errorMessageStack();
173  throw KeyNotFound(
174  __FILE__, __LINE__, __func__, msg);
175  }
176  if (foundFURes.canAssign(
177  cycle, node, *pSocket, triggering)) {
178  resourceSet.insert(foundFURes);
179  }
180  return resourceSet;
181  }
182 
183  std::set<TCEString> candidateFUs;
184  std::set<TCEString> allowedFUs;
185  std::set<TCEString> rejectedFUs;
186  // not all nodes have dest operation info set as the RM can be called
187  // for single moves
188  if (node.isDestinationOperation()) {
189  // check if the move or other moves in the same program operation have
190  // candidate FUs set which limits the choice of FU for the node
191  ProgramOperation& destOp = node.destinationOperation();
192  for (int in = 0; in < destOp.inputMoveCount(); ++in) {
193  MoveNode& n = destOp.inputMove(in);
195  candidateFUs, n.move(),
198  allowedFUs, n.move(),
201  rejectedFUs, n.move(),
203  }
204  }
205 
206  // if the move has already the FU assigned, force it to be chosen
207  // kludge implementation that use the candidate set code
208  const TTAMachine::FunctionUnit& targetFU =
209  node.move().destination().functionUnit();
210  if (dynamic_cast<const UniversalFunctionUnit*>(&targetFU) == NULL &&
211  dynamic_cast<const TTAMachine::ControlUnit*>(&targetFU) == NULL) {
212  candidateFUs.clear();
213  candidateFUs.insert(node.move().destination().functionUnit().name());
214  debugLogRM(
215  TCEString("Added candidate FU duo pre-set fu") +
216  node.move().destination().functionUnit().name());
217  }
218 
219  // find units that support operation and are available
220  while (resIter != resMap_.end()) {
221  const FunctionUnit* unit =
222  static_cast<const FunctionUnit*>((*resIter).first);
223 
224  assert(unit != NULL);
225  // in case the unit is limited by a candidate set, skip FUs that are
226  // not in it
227  debugLogRM(TCEString("checking ") << unit->name());
228  if (candidateFUs.size() > 0 &&
229  !AssocTools::containsKey(candidateFUs, unit->name())) {
230  debugLogRM(
231  TCEString("skipped ") << unit->name() << " because it was not "
232  " in the candidate set.");
233  ++resIter;
234  continue;
235  }
236 
237  if (allowedFUs.size() > 0 &&
238  !AssocTools::containsKey(allowedFUs, unit->name())) {
239  debugLogRM(
240  TCEString("skipped ") << unit->name() << " because it was not "
241  " in the allowed set.");
242  ++resIter;
243  continue;
244  }
245 
246  if (AssocTools::containsKey(rejectedFUs, unit->name())) {
247  debugLogRM(
248  TCEString("skipped ") << unit->name() << " because it was"
249  " in the rejected set.");
250  ++resIter;
251  continue;
252  }
253 
254  debugLogRM(TCEString("Found ") + unit->name());
255 
256  const SchedulingResource& res = *resourceOf(*unit);
257  if (res.isInputFUResource()) {
258  const InputFUResource& fuRes =
259  static_cast<InputFUResource&>(*resourceOf(*unit));
260  if (unit->hasOperationLowercase(opName)) {
261  debugLogRM(TCEString("found FU with the op ") + opName);
262  HWOperation* hwOp = unit->operationLowercase(opName);
263  assert(hwOp != NULL);
264  Socket* soc = hwOp->port(opIndex)->inputSocket();
265 
266  FUPort* tempPort =
267  dynamic_cast<FUPort*>(hwOp->port(opIndex));
268  if (tempPort == NULL){
269  throw InvalidData(
270  __FILE__, __LINE__, __func__,
271  "Target is missing necessary FUPort!");
272  }
273  bool triggering = false;
274  if (tempPort->isTriggering()) {
275  triggering = true;
276  }
277 
278  InputPSocketResource* pSocket = NULL;
279  try {
280  pSocket = &static_cast<InputPSocketResource&>(
281  resourceMapper().resourceOf(*soc));
282  } catch (const KeyNotFound& e) {
283  std::string msg = "InputFUBroker: finding ";
284  msg += " resource for Socket ";
285  msg += " failed with error: ";
286  msg += e.errorMessageStack();
287  throw KeyNotFound(
288  __FILE__, __LINE__, __func__, msg);
289  }
290  if (fuRes.canAssign(cycle, node, *pSocket, triggering)) {
291  resourceSet.insert(*(*resIter).second);
292  } else {
293  debugLogRM("could not assign the fuRes to it.");
294  }
295  } else {
296  debugLogRM(TCEString("does not have operation ") + opName);
297  }
298  }
299  resIter++;
300  }
301  if (resourceSet.count() == 0) {
302  debugLogRM("InputFUBroker returned an empty resource set.");
303  }
304 
305  return resourceSet;
306 }

References __func__, abortWithError, MachineConnectivityCheck::addAnnotatedFUs(), TTAProgram::ProgramAnnotation::ANN_ALLOWED_UNIT_DST, TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_DST, TTAProgram::ProgramAnnotation::ANN_REJECTED_UNIT_DST, assert, InputFUResource::canAssign(), AssocTools::containsKey(), SchedulingResourceSet::count(), debugLogRM, TTAProgram::Move::destination(), MoveNode::destinationOperation(), Exception::errorMessageStack(), FUBroker::findDstFUOfMove(), TTAProgram::Terminal::functionUnit(), TTAMachine::FunctionUnit::hasOperationLowercase(), TTAProgram::TerminalFUPort::hintOperation(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), TTAMachine::Port::inputSocket(), SchedulingResourceSet::insert(), isApplicable(), InputFUResource::isAvailable(), MoveNode::isDestinationOperation(), SchedulingResource::isInputFUResource(), TTAMachine::FUPort::isTriggering(), MoveNode::move(), TTAMachine::Component::name(), Operation::name(), TTAProgram::TerminalFUPort::operationIndex(), TTAMachine::FunctionUnit::operationLowercase(), TTAMachine::HWOperation::port(), TTAProgram::TerminalFUPort::port(), ResourceBroker::resMap_, ResourceBroker::resourceMapper(), ResourceMapper::resourceOf(), ResourceBroker::resourceOf(), and StringTools::stringToLower().

Here is the call graph for this function:

◆ assign()

void InputFUBroker::assign ( int  cycle,
MoveNode node,
SchedulingResource res,
int  immWriteCycle,
int  immRegIndex 
)
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.

Parameters
cycleCycle.
nodeNode to assign.
resResource representing Input of and FU
Exceptions
WrongSubclassIf this broker does not recognise the given type of resource.
InvalidParametersIf he given resource cannot be assigned to given node or no corresponding machine part is found.

Implements ResourceBroker.

Definition at line 414 of file InputFUBroker.cc.

415  {
416  if (!isApplicable(node)) {
417  string msg = "Broker not capable of assigning resources to node!";
418  throw WrongSubclass(__FILE__, __LINE__, __func__, msg);
419  }
420 
421  if (!hasResource(res)) {
422  string msg = "Broker does not contain given resource.";
423  throw InvalidData(__FILE__, __LINE__, __func__, msg);
424  }
425 
426  InputFUResource& fuRes = static_cast<InputFUResource&>(res);
427 
428  Move& move = const_cast<MoveNode&>(node).move();
429  TerminalFUPort& dst = static_cast<TerminalFUPort&>(move.destination());
430 
431  if (dynamic_cast<const SpecialRegisterPort*>(&dst.port()) != NULL) {
432 
433  const ControlUnit* gcu =
434  dynamic_cast<const ControlUnit*>(&machinePartOf(fuRes));
435 
436  if (gcu != NULL) {
437  TerminalFUPort* newDst =
438  new TerminalFUPort(*gcu->returnAddressPort());
439  move.setDestination(newDst);
440  fuRes.assign(cycle, node);
441  assignedResources_.insert(
442  std::pair<const MoveNode*, SchedulingResource*>(
443  &node,&fuRes));
444  return;
445  } else {
446  abortWithError("GCU required but tried to assign something else!");
447  }
448  }
449 
450  int opIndex = dst.operationIndex();
451  Operation& op = dst.hintOperation();
452 
453  const FunctionUnit& unit =
454  static_cast<const FunctionUnit&>(machinePartOf(fuRes));
455  HWOperation* hwOp = unit.operation(op.name());
456  TerminalFUPort* newDst = new TerminalFUPort(*hwOp, opIndex);
457  newDst->setProgramOperation(dst.programOperation());
458  move.setDestination(newDst);
459  fuRes.assign(cycle, node);
460  assignedResources_.insert(
461  std::pair<const MoveNode*, SchedulingResource*>(&node, &fuRes));
462 }

References __func__, abortWithError, InputFUResource::assign(), ResourceBroker::assignedResources_, TTAProgram::Move::destination(), ResourceBroker::hasResource(), TTAProgram::TerminalFUPort::hintOperation(), isApplicable(), ResourceBroker::machinePartOf(), Operation::name(), TTAMachine::FunctionUnit::operation(), TTAProgram::TerminalFUPort::operationIndex(), TTAProgram::TerminalFUPort::port(), TTAProgram::TerminalFUPort::programOperation(), TTAMachine::ControlUnit::returnAddressPort(), TTAProgram::Move::setDestination(), and TTAProgram::TerminalFUPort::setProgramOperation().

Here is the call graph for this function:

◆ buildResources()

void InputFUBroker::buildResources ( const TTAMachine::Machine target)
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.

Parameters
targetTarget machine.

Implements ResourceBroker.

Definition at line 503 of file InputFUBroker.cc.

503  {
504 
505  std::map<const TTAMachine::FunctionUnit*,int> nopWeights;
506 
508  for (int i = 0; i < navi.count(); i++) {
509  FunctionUnit* fu = navi.item(i);
510  InputFUResource* fuResource = new InputFUResource(
511  fu->name(), fu->operationCount(), nopWeights[fu],
513  ResourceBroker::addResource(*fu, fuResource);
514  }
515 
516  ControlUnit* gcu = target.controlUnit();
517  InputFUResource* fuResource = new InputFUResource(
518  gcu->name(), gcu->operationCount(), 0, initiationInterval_);
519  ResourceBroker::addResource(*gcu, fuResource);
520 }

References ResourceBroker::addResource(), TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), ResourceBroker::initiationInterval_, TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::name(), and TTAMachine::FunctionUnit::operationCount().

Here is the call graph for this function:

◆ earliestCycle()

int InputFUBroker::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
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.

Parameters
cycleCycle.
nodeNode.
Returns
The earliest cycle, starting from given cycle, where a resource of the type managed by this broker can be assigned to the given node.

Implements ResourceBroker.

Definition at line 320 of file InputFUBroker.cc.

324  {
325  abortWithError("Not implemented.");
326  return -1;
327 }

References abortWithError.

◆ isAlreadyAssigned()

bool InputFUBroker::isAlreadyAssigned ( int  cycle,
const MoveNode node,
const TTAMachine::Bus preassignedBus 
) const
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).

Parameters
cycleCycle. Not used.
nodeNode.
Returns
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) and recorded for node that it is using it (could be inUse because some other operation is executed).

Implements ResourceBroker.

Definition at line 365 of file InputFUBroker.cc.

366  {
367  cycle = instructionIndex(cycle);
368  Terminal& dst = const_cast<MoveNode&>(node).move().destination();
369  if (dst.isFUPort()) {
370  const FunctionUnit& fu = dst.functionUnit();
371  if (hasResourceOf(fu)) {
373  return true;
374  }
375  }
376  }
377  return false;
378 }

References ResourceBroker::assignedResources_, MapTools::containsKey(), TTAProgram::Terminal::functionUnit(), ResourceBroker::hasResourceOf(), ResourceBroker::instructionIndex(), and TTAProgram::Terminal::isFUPort().

Here is the call graph for this function:

◆ isApplicable()

bool InputFUBroker::isApplicable ( const MoveNode node,
const TTAMachine::Bus preAssigndBus = 0 
) const
overridevirtual

Return true if the given node needs a resource of the type managed by this broker, false otherwise.

Parameters
nodeNode.
Returns
True if the given node needs a resource of the type managed by this broker, false otherwise.

Implements ResourceBroker.

Definition at line 389 of file InputFUBroker.cc.

390  {
391  if (!node.isMove()) {
392  return false;
393  }
394  Move& move = const_cast<MoveNode&>(node).move();
395  return move.destination().isFUPort();
396 }

References TTAProgram::Move::destination(), TTAProgram::Terminal::isFUPort(), and MoveNode::isMove().

Referenced by allAvailableResources(), assign(), and unassign().

Here is the call graph for this function:

◆ latestCycle()

int InputFUBroker::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
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.

Parameters
cycleCycle.
nodeNode.
Returns
The latest cycle, starting from given cycle, where a resource of the type managed by this broker can be assigned to the given node.

Implements ResourceBroker.

Definition at line 341 of file InputFUBroker.cc.

345  {
346  abortWithError("Not implemented.");
347  return -1;
348 }

References abortWithError.

◆ setupResourceLinks()

void InputFUBroker::setupResourceLinks ( const ResourceMapper mapper)
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.

Parameters
mapperResource mapper.

Implements ResourceBroker.

Definition at line 531 of file InputFUBroker.cc.

531  {
532 
533  setResourceMapper(mapper);
534 
535  for (ResourceMap::iterator resIter = resMap_.begin();
536  resIter != resMap_.end(); resIter++) {
537 
538  const FunctionUnit* fu =
539  dynamic_cast<const FunctionUnit*>((*resIter).first);
540  if (fu == NULL){
541  throw InvalidData(
542  __FILE__, __LINE__, __func__,
543  "Broker has other resource then FU registered!");
544  }
545 
546  SchedulingResource* fuResource = (*resIter).second;
547 
548  for (int i = 0; i < fu->portCount(); i++) {
549  Port* port = fu->port(i);
550  if (port->inputSocket() != NULL) {
551  SchedulingResource& depRes =
552  mapper.resourceOf(*port->inputSocket());
553  fuResource->addToDependentGroup(0, depRes);
554  }
555  }
556 
557  int fuCount = mapper.resourceCount(*fu);
558  for (int i = 0; i < fuCount; i++) {
559  SchedulingResource* depRes = &mapper.resourceOf(*fu, i);
560  if (depRes->isExecutionPipelineResource()){
561  fuResource->addToDependentGroup(1, *depRes);
562  break;
563  }
564  }
565  }
566 }

References __func__, SchedulingResource::addToDependentGroup(), TTAMachine::Port::inputSocket(), SchedulingResource::isExecutionPipelineResource(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), ResourceBroker::resMap_, ResourceMapper::resourceCount(), ResourceMapper::resourceOf(), and ResourceBroker::setResourceMapper().

Here is the call graph for this function:

◆ unassign()

void InputFUBroker::unassign ( MoveNode node)
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.

Parameters
nodeNode.

Implements ResourceBroker.

Definition at line 474 of file InputFUBroker.cc.

474  {
475  if (!isApplicable(node)) {
476  return;
477  }
479  return;
480  } else {
481  Move& move = const_cast<MoveNode&>(node).move();
482  TerminalFUPort& dst =
483  static_cast<TerminalFUPort&>(move.destination());
484  InputFUResource& res =
485  static_cast<InputFUResource&>(*resourceOf(dst.functionUnit()));
486  res.unassign(node.cycle(), node);
487  assignedResources_.erase(&node);
488  return;
489  }
490 
491 }

References ResourceBroker::assignedResources_, MapTools::containsKey(), MoveNode::cycle(), TTAProgram::Move::destination(), TTAProgram::TerminalFUPort::functionUnit(), isApplicable(), ResourceBroker::resourceOf(), and InputFUResource::unassign().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
TTAProgram::Terminal::isFUPort
virtual bool isFUPort() const
Definition: Terminal.cc:118
SchedulingResource::addToDependentGroup
virtual void addToDependentGroup(const int group, SchedulingResource &resource)
Definition: SchedulingResource.cc:101
TTAProgram::TerminalFUPort::setProgramOperation
void setProgramOperation(ProgramOperationPtr po)
Definition: TerminalFUPort.hh:94
TTAMachine::Port::inputSocket
virtual Socket * inputSocket() const
Definition: Port.cc:261
ResourceBroker::initiationInterval_
unsigned int initiationInterval_
Definition: ResourceBroker.hh:158
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAProgram::TerminalFUPort::functionUnit
virtual const TTAMachine::FunctionUnit & functionUnit() const
Definition: TerminalFUPort.cc:202
TTAMachine::HWOperation
Definition: HWOperation.hh:52
ResourceBroker::resMap_
ResourceMap resMap_
Definition: ResourceBroker.hh:165
MoveNode::isDestinationOperation
bool isDestinationOperation() const
AssocTools::containsKey
static bool containsKey(const ContainerType &aContainer, const KeyType &aKey)
BoostGraph< MoveNode, DataDependenceEdge >::NodeSet
std::set< MoveNode *, typename MoveNode ::Comparator > NodeSet
Definition: BoostGraph.hh:86
FUBroker::FUBroker
FUBroker(std::string name, unsigned int initiationInterval=0)
Definition: FUBroker.hh:51
TTAProgram::Move::destination
Terminal & destination() const
Definition: Move.cc:323
TTAMachine::FunctionUnit::operationLowercase
virtual HWOperation * operationLowercase(const std::string &name) const
Definition: FunctionUnit.cc:378
ResourceBroker::hasResource
bool hasResource(const SchedulingResource &r) const
Definition: ResourceBroker.cc:214
ProgramOperation
Definition: ProgramOperation.hh:70
MoveNode
Definition: MoveNode.hh:65
UniversalFunctionUnit
Definition: UniversalFunctionUnit.hh:50
ResourceBroker::assignedResources_
MoveResMap assignedResources_
Definition: ResourceBroker.hh:167
TTAMachine::FunctionUnit::port
virtual BaseFUPort * port(const std::string &name) const
Definition: FunctionUnit.cc:145
ResourceMapper::resourceOf
SchedulingResource & resourceOf(const TTAMachine::MachinePart &mp, int index=0) const
Definition: ResourceMapper.cc:96
TTAMachine::Machine::Navigator::count
int count() const
TTAMachine::FUPort::isTriggering
virtual bool isTriggering() const
Definition: FUPort.cc:182
ResourceBroker::addResource
void addResource(const TTAMachine::MachinePart &mp, SchedulingResource *res)
Definition: ResourceBroker.cc:265
ResourceBroker::hasResourceOf
bool hasResourceOf(const TTAMachine::MachinePart &mp) const
Definition: ResourceBroker.cc:203
Operation::name
virtual TCEString name() const
Definition: Operation.cc:93
InputFUResource::unassign
virtual void unassign(const int cycle, MoveNode &node) override
Definition: InputFUResource.cc:115
debugLogRM
#define debugLogRM(__X)
Definition: ResourceManager.hh:123
SchedulingResourceSet
Definition: SchedulingResource.hh:161
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::HWOperation::port
virtual FUPort * port(int operand) const
Definition: HWOperation.cc:320
InputPSocketResource
Definition: InputPSocketResource.hh:47
TTAProgram::TerminalFUPort::hintOperation
virtual Operation & hintOperation() const
Definition: TerminalFUPort.cc:262
TTAMachine::FUPort
Definition: FUPort.hh:46
MoveNode::isMove
bool isMove() const
ResourceBroker::setResourceMapper
void setResourceMapper(const ResourceMapper &mapper)
Definition: ResourceBroker.cc:224
TTAProgram::ProgramAnnotation::ANN_REJECTED_UNIT_DST
@ ANN_REJECTED_UNIT_DST
Dst. unit rejected.
Definition: ProgramAnnotation.hh:119
TTAProgram::Move::setDestination
void setDestination(Terminal *dst)
Definition: Move.cc:333
MachineConnectivityCheck::addAnnotatedFUs
static void addAnnotatedFUs(std::set< TCEString > &candidateFUs, const TTAProgram::Move &m, TTAProgram::ProgramAnnotation::Id id)
Definition: MachineConnectivityCheck.cc:1856
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
MoveNode::cycle
int cycle() const
Definition: MoveNode.cc:421
TTAProgram::TerminalFUPort::operationIndex
virtual int operationIndex() const
Definition: TerminalFUPort.cc:238
TTAMachine::SpecialRegisterPort
Definition: SpecialRegisterPort.hh:48
InvalidData
Definition: Exception.hh:149
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
WrongSubclass
Definition: Exception.hh:336
SchedulingResource
Definition: SchedulingResource.hh:52
TTAMachine::Port
Definition: Port.hh:54
__func__
#define __func__
Definition: Application.hh:67
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
InputFUResource::assign
virtual void assign(const int cycle, MoveNode &node) override
Definition: InputFUResource.cc:86
TTAMachine::Socket
Definition: Socket.hh:53
Exception::errorMessageStack
std::string errorMessageStack(bool messagesOnly=false) const
Definition: Exception.cc:138
TTAMachine::FunctionUnit::operationCount
virtual int operationCount() const
Definition: FunctionUnit.cc:419
ResourceBroker::resourceOf
SchedulingResource * resourceOf(const TTAMachine::MachinePart &mp) const
TTAProgram::TerminalFUPort::port
virtual const TTAMachine::Port & port() const
Definition: TerminalFUPort.cc:291
SchedulingResource::isExecutionPipelineResource
virtual bool isExecutionPipelineResource() const
TTAProgram::Move
Definition: Move.hh:55
ModuleRunTimeError
Definition: Exception.hh:1043
SchedulingResource::isInputFUResource
virtual bool isInputFUResource() const
TTAProgram::ProgramAnnotation::ANN_ALLOWED_UNIT_DST
@ ANN_ALLOWED_UNIT_DST
Dst. unit candidate.
Definition: ProgramAnnotation.hh:113
ProgramOperation::inputMoveCount
int inputMoveCount() const
Definition: ProgramOperation.cc:600
TTAMachine::Unit::portCount
virtual int portCount() const
Definition: Unit.cc:135
Operation
Definition: Operation.hh:59
TTAProgram::TerminalFUPort
Definition: TerminalFUPort.hh:56
TTAProgram::Terminal::functionUnit
virtual const TTAMachine::FunctionUnit & functionUnit() const
Definition: Terminal.cc:251
MoveNode::destinationOperation
ProgramOperation & destinationOperation(unsigned int index=0) const
TTAProgram::TerminalFUPort::programOperation
ProgramOperationPtr programOperation() const
Definition: TerminalFUPort.hh:97
MoveNode::move
TTAProgram::Move & move()
InputFUResource
Definition: InputFUResource.hh:49
MapTools::containsKey
static bool containsKey(const MapType &aMap, const KeyType &aKey)
SchedulingResourceSet::count
int count() const
Definition: SchedulingResource.cc:251
ResourceMapper::resourceCount
int resourceCount(const TTAMachine::MachinePart &mp) const
Definition: ResourceMapper.cc:76
TTAMachine::FunctionUnit::hasOperationLowercase
virtual bool hasOperationLowercase(const std::string &name) const
Definition: FunctionUnit.cc:341
TCEString
Definition: TCEString.hh:53
ResourceBroker::instructionIndex
unsigned int instructionIndex(unsigned int) const
Definition: ResourceBroker.cc:249
InputFUBroker::isApplicable
virtual bool isApplicable(const MoveNode &node, const TTAMachine::Bus *preAssigndBus=0) const override
Definition: InputFUBroker.cc:389
ResourceBroker::resourceMapper
const ResourceMapper & resourceMapper() const
Definition: ResourceBroker.cc:234
TTAProgram::Terminal
Definition: Terminal.hh:60
ResourceBroker::machinePartOf
virtual const TTAMachine::MachinePart & machinePartOf(const SchedulingResource &r) const
Definition: ResourceBroker.cc:181
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
KeyNotFound
Definition: Exception.hh:285
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363
TTAMachine::ControlUnit::returnAddressPort
SpecialRegisterPort * returnAddressPort() const
Definition: ControlUnit.cc:307
SchedulingResourceSet::insert
void insert(SchedulingResource &resource)
Definition: SchedulingResource.cc:236
InputFUResource::canAssign
virtual bool canAssign(const int cycle, const MoveNode &node) const override
Definition: InputFUResource.cc:70
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
InputFUResource::isAvailable
virtual bool isAvailable(const int cycle) const override
Definition: InputFUResource.cc:194
StringTools::stringToLower
static std::string stringToLower(const std::string &source)
Definition: StringTools.cc:160
FUBroker::findDstFUOfMove
std::pair< bool, const TTAMachine::FunctionUnit * > findDstFUOfMove(const MoveNode &node, const TTAMachine::FunctionUnit *resFU, DataDependenceGraph::NodeSet &processedInputNodes) const
Definition: FUBroker.cc:37
ProgramOperation::inputMove
MoveNode & inputMove(int index) const
Definition: ProgramOperation.cc:621
TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_DST
@ ANN_CONN_CANDIDATE_UNIT_DST
Dst. unit candidate.
Definition: ProgramAnnotation.hh:116