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

#include <OutputFUBroker.hh>

Inheritance diagram for OutputFUBroker:
Inheritance graph
Collaboration diagram for OutputFUBroker:
Collaboration graph

Public Member Functions

 OutputFUBroker (std::string, unsigned int initiationInterval=0)
 
virtual ~OutputFUBroker ()
 
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 void assign (int cycle, MoveNode &node, SchedulingResource &res, 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 *b=0) const 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

Output function unit broker.

Definition at line 50 of file OutputFUBroker.hh.

Constructor & Destructor Documentation

◆ OutputFUBroker()

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

Constructor.

Definition at line 65 of file OutputFUBroker.cc.

65  :
66  FUBroker(name, initiationInterval) {
67 }

◆ ~OutputFUBroker()

OutputFUBroker::~OutputFUBroker ( )
virtual

Destructor.

Definition at line 72 of file OutputFUBroker.cc.

72  {
73 }

Member Function Documentation

◆ allAvailableResources()

SchedulingResourceSet OutputFUBroker::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 85 of file OutputFUBroker.cc.

92  {
93 
94  int modCycle = instructionIndex(cycle);
95  if (!isApplicable(node)) {
96  string msg = "Broker not capable of assigning resources to node: "
97  + node.toString();
98  throw ModuleRunTimeError(__FILE__, __LINE__, __func__, msg);
99  }
100 
101  const TTAMachine::FunctionUnit* foundFU = srcFU;
102  int opIndex = -1;
103  ProgramOperation* PO = nullptr;
104  SchedulingResourceSet resourceSet;
105  ResourceMap::const_iterator resIter = resMap_.begin();
106 
107  const Operation* op = nullptr;
108 
109  if (node.move().source().isFUPort()) {
110  TerminalFUPort& src =
111  static_cast<TerminalFUPort&>(node.move().source());
112 
113  if (dynamic_cast<const SpecialRegisterPort*>(&src.port()) != NULL) {
114  // only gcu applies
115  while (resIter != resMap_.end()) {
116  const ControlUnit* gcu =
117  dynamic_cast<const ControlUnit*>((*resIter).first);
118  if (gcu != NULL) {
119  if ((*resIter).second->isAvailable(modCycle)) {
120  resourceSet.insert(*(*resIter).second);
121  }
122  return resourceSet;
123  }
124  resIter++;
125  }
126  abortWithError("No GCU found!");
127  }
128 
129  op = &src.hintOperation();
130  opIndex = src.operationIndex();
131 
132  // check if a unit has already been assigned to some node
133  // of the same operation and use it.
134  if (node.isSourceOperation()) {
135  PO = &node.sourceOperation();
136  } else {
137  assert(false);
138  }
139  } else {
140  // port guard?
141  PO = &node.guardOperation();
142  opIndex = PO->outputIndexFromGuardOfMove(node);
143  op = &PO->operation();
144  }
145 
146  auto a = findFUOfPO(*PO, foundFU);
147  if (a.first) {
148  foundFU = a.second;
149  } else { // conflicting FUs, cannot schedule
150  return SchedulingResourceSet();
151  }
152 
153  if (foundFU) {
154  OutputFUResource& fuRes =
155  static_cast<OutputFUResource&>(*resourceOf(*foundFU));
156  // Find what is the port on a new FU for given
157  // operation index. Find a socket for testing.
158  HWOperation* hwOp = foundFU->operation(op->name());
159  assert(hwOp != nullptr);
160  Port* resultPort = hwOp->port(opIndex);
161  assert (resultPort != nullptr);
162  if (fuRes.canAssign(cycle, node, *resultPort)) {
163  resourceSet.insert(fuRes);
164  }
165  return resourceSet;
166  }
167 
168  // check if the move has a candidate FU set which limits the
169  // choice of FU for the node
170  std::set<TCEString> candidateFUs;
171  std::set<TCEString> allowedFUs;
172  std::set<TCEString> rejectedFUs;
173 
174  // TODO: why is this in loop for operands but not in loop for results?
175  // do multiple return values break or work?
177  candidateFUs, node.move(),
180  allowedFUs, node.move(),
183  rejectedFUs, node.move(),
185 
186  // find units that support operation and are available at given cycle
187  while (resIter != resMap_.end()) {
188  const FunctionUnit* unit =
189  static_cast<const FunctionUnit*>((*resIter).first);
190  if (srcFU != NULL && unit != srcFU) {
191  debugLogRM(TCEString("Skipping unit") << unit->name()
192  << " because it's not the pre-set one: "
193  << srcFU->name());
194  resIter++;
195  continue;
196  }
197  // in case the unit is limited by a candidate set, skip FUs that are
198  // not in it
199  debugLogRM(TCEString("checking ") << unit->name());
200  if (candidateFUs.size() > 0 &&
201  !AssocTools::containsKey(candidateFUs, unit->name())) {
202  ++resIter;
203  continue;
204  }
205  if (allowedFUs.size() > 0 &&
206  !AssocTools::containsKey(allowedFUs, unit->name())) {
207  debugLogRM(
208  TCEString("skipped ") << unit->name() << " because it was not"
209  " in the allowed set. The set contents: ");
210  for (auto allowedUnit : allowedFUs)
211  debugLogRM(allowedUnit + "\n");
212  ++resIter;
213  continue;
214  }
215 
216  if (AssocTools::containsKey(rejectedFUs, unit->name())) {
217  debugLogRM(
218  TCEString("skipped ") << unit->name() << " because it was"
219  " in the rejected set.");
220  ++resIter;
221  continue;
222  }
223 
224  if (unit->hasOperation(op->name())) {
225  OutputFUResource& fuRes =
226  static_cast<OutputFUResource&>(*resourceOf(*unit));
227  // Find what is the port on a new FU for given
228  // operation index. Find a socket for testing.
229  HWOperation* hwOp = unit->operation(op->name());
230  Port* resultPort = hwOp->port(opIndex);
231  if (fuRes.canAssign(cycle, node, *resultPort)) {
232  debugLogRM("testing " + op->name());
233  resourceSet.insert(*(*resIter).second);
234  } else {
235  debugLogRM("could not assign the fuRes to it.");
236  }
237  } else {
238  debugLogRM(TCEString("does not have operation ") + op->name());
239  }
240  resIter++;
241  }
242  return resourceSet;
243 }

References __func__, abortWithError, MachineConnectivityCheck::addAnnotatedFUs(), TTAProgram::ProgramAnnotation::ANN_ALLOWED_UNIT_SRC, TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_SRC, TTAProgram::ProgramAnnotation::ANN_REJECTED_UNIT_SRC, assert, OutputFUResource::canAssign(), AssocTools::containsKey(), debugLogRM, FUBroker::findFUOfPO(), MoveNode::guardOperation(), TTAMachine::FunctionUnit::hasOperation(), TTAProgram::TerminalFUPort::hintOperation(), SchedulingResourceSet::insert(), ResourceBroker::instructionIndex(), isApplicable(), TTAProgram::Terminal::isFUPort(), MoveNode::isSourceOperation(), MoveNode::move(), TTAMachine::Component::name(), Operation::name(), TTAMachine::FunctionUnit::operation(), ProgramOperation::operation(), TTAProgram::TerminalFUPort::operationIndex(), ProgramOperation::outputIndexFromGuardOfMove(), TTAMachine::HWOperation::port(), TTAProgram::TerminalFUPort::port(), ResourceBroker::resMap_, ResourceBroker::resourceOf(), TTAProgram::Move::source(), MoveNode::sourceOperation(), and MoveNode::toString().

Here is the call graph for this function:

◆ assign()

void OutputFUBroker::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 Output of 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 261 of file OutputFUBroker.cc.

262  {
263  // TODO: this breaks execpipeline
264 // cycle = instructionIndex(cycle);
265  if (!isApplicable(node)) {
266  string msg = "Broker not capable of assigning resources to node!";
267  throw WrongSubclass(__FILE__, __LINE__, __func__, msg);
268  }
269 
270  if (!hasResource(res)) {
271  string msg = "Broker does not contain given resource.";
272  throw InvalidData(__FILE__, __LINE__, __func__, msg);
273  }
274  OutputFUResource& fuRes = static_cast<OutputFUResource&>(res);
275  Move& move = const_cast<MoveNode&>(node).move();
276 
277  int opIndex = -1;
278  const Operation* op = nullptr;
279  TerminalFUPort* src = dynamic_cast<TerminalFUPort*>(&move.source());
280  if (src != nullptr &&
281  dynamic_cast<const SpecialRegisterPort*>(&src->port()) != NULL) {
282  const ControlUnit* gcu =
283  dynamic_cast<const ControlUnit*>(&machinePartOf(res));
284  if (gcu != NULL) {
285  // output of GCU is ra read
286  TerminalFUPort* newSrc =
287  new TerminalFUPort(*gcu->returnAddressPort());
288  move.setSource(newSrc);
289  Socket* outputSocket = newSrc->port().outputSocket();
290 
291  if (outputSocket == NULL) {
292  throw InvalidData(
293  __FILE__, __LINE__, __func__, "GCU is missing RA port - "
294  "socket connection!");
295  }
296  assignedResources_.insert(
297  std::pair<const MoveNode*, SchedulingResource*>(
298  &node, &fuRes));
299  return;
300  } else {
302  "GCU required but tried to assign something else!");
303  }
304  }
305 
306  if (node.isSourceOperation()) {
307 
308  opIndex = src->operationIndex();
309  op = &src->hintOperation();
310  const FunctionUnit& unit =
311  static_cast<const FunctionUnit&>(machinePartOf(res));
312  HWOperation* hwOp = unit.operation(op->name());
313  TerminalFUPort* newSrc = new TerminalFUPort(*hwOp, opIndex);
314  move.setSource(newSrc);
315  fuRes.assign(cycle, node);
316  assignedResources_.insert(
317  std::pair<const MoveNode*, SchedulingResource*>(
318  &node, &fuRes));
319  } else {
320  assert(node.isGuardOperation());
321  ProgramOperation& po = node.guardOperation();
322  opIndex = po.outputIndexOfMove(node);
323  op = &po.operation();
324 
325  fuRes.assign(cycle, node);
326  assignedResources_.insert(
327  std::pair<const MoveNode*, SchedulingResource*>(
328  &node, &fuRes));
329  }
330 }

References __func__, abortWithError, assert, OutputFUResource::assign(), ResourceBroker::assignedResources_, MoveNode::guardOperation(), ResourceBroker::hasResource(), TTAProgram::TerminalFUPort::hintOperation(), isApplicable(), MoveNode::isGuardOperation(), MoveNode::isSourceOperation(), ResourceBroker::machinePartOf(), Operation::name(), TTAMachine::FunctionUnit::operation(), ProgramOperation::operation(), TTAProgram::TerminalFUPort::operationIndex(), ProgramOperation::outputIndexOfMove(), TTAMachine::Port::outputSocket(), TTAProgram::TerminalFUPort::port(), TTAMachine::ControlUnit::returnAddressPort(), TTAProgram::Move::setSource(), and TTAProgram::Move::source().

Here is the call graph for this function:

◆ buildResources()

void OutputFUBroker::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 489 of file OutputFUBroker.cc.

489  {
490 
491  std::map<const TTAMachine::FunctionUnit*,int> nopWeights;
492 
494  for (int i = 0; i < navi.count(); i++) {
495  FunctionUnit* fu = navi.item(i);
496  OutputFUResource* fuResource = new OutputFUResource(
497  fu->name(), fu->operationCount(), nopWeights[fu]);
498  ResourceBroker::addResource(*fu, fuResource);
499  }
500  ControlUnit* gcu = target.controlUnit();
501  OutputFUResource* fuResource = new OutputFUResource(
502  gcu->name(), gcu->operationCount(),0);
503  ResourceBroker::addResource(*gcu, fuResource);
504 }

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

Here is the call graph for this function:

◆ earliestCycle()

int OutputFUBroker::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 387 of file OutputFUBroker.cc.

392  {
393  abortWithError("Not implemented.");
394  return -1;
395 }

References abortWithError.

◆ isAlreadyAssigned()

bool OutputFUBroker::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).

Implements ResourceBroker.

Definition at line 432 of file OutputFUBroker.cc.

433  {
434  cycle = instructionIndex(cycle);
435  Terminal& src = const_cast<MoveNode&>(node).move().source();
436  if (src.isFUPort()) {
437  const FunctionUnit& fu = src.functionUnit();
438  if (hasResourceOf(fu)) {
440  return true;
441  }
442  }
443  }
444  if (node.isGuardOperation()) {
445  const FunctionUnit* fu = node.guardOperation().fuFromOutMove(node);
446  if (fu && hasResourceOf(*fu)) {
448  return true;
449  }
450  }
451  }
452  return false;
453 }

References ResourceBroker::assignedResources_, MapTools::containsKey(), ProgramOperation::fuFromOutMove(), TTAProgram::Terminal::functionUnit(), MoveNode::guardOperation(), ResourceBroker::hasResourceOf(), ResourceBroker::instructionIndex(), TTAProgram::Terminal::isFUPort(), and MoveNode::isGuardOperation().

Here is the call graph for this function:

◆ isApplicable()

bool OutputFUBroker::isApplicable ( const MoveNode node,
const TTAMachine::Bus b = 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 464 of file OutputFUBroker.cc.

465  {
466  if (!node.isMove()) {
467  return false;
468  }
469  Move& move = const_cast<MoveNode&>(node).move();
470  if (move.source().isFUPort() ||
471  (!move.isUnconditional() &&
472  dynamic_cast<const TTAMachine::PortGuard*>(&move.guard().guard()))) {
473  return true;
474  } else {
475  return false;
476  }
477 }

References TTAProgram::MoveGuard::guard(), TTAProgram::Move::guard(), TTAProgram::Terminal::isFUPort(), MoveNode::isMove(), TTAProgram::Move::isUnconditional(), and TTAProgram::Move::source().

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

Here is the call graph for this function:

◆ latestCycle()

int OutputFUBroker::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 409 of file OutputFUBroker.cc.

413  {
414  abortWithError("Not implemented.");
415  return -1;
416 }

References abortWithError.

◆ setupResourceLinks()

void OutputFUBroker::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 515 of file OutputFUBroker.cc.

515  {
516 
517  setResourceMapper(mapper);
518 
519  for (ResourceMap::iterator resIter = resMap_.begin();
520  resIter != resMap_.end(); resIter++) {
521 
522  const FunctionUnit* fu =
523  dynamic_cast<const FunctionUnit*>((*resIter).first);
524 
525  SchedulingResource* fuResource = (*resIter).second;
526  for (int i = 0; i < fu->portCount(); i++) {
527  Port* port = fu->port(i);
528  if (port->outputSocket() != NULL) {
529  try {
530  SchedulingResource& depRes =
531  mapper.resourceOf(*port->outputSocket());
532  fuResource->addToDependentGroup(0, depRes);
533  } catch (const KeyNotFound& e) {
534  std::string msg = "OutputFUBroker: finding ";
535  msg += " resource for Socket ";
536  msg += " failed with error: ";
537  msg += e.errorMessageStack();
538  throw KeyNotFound(
539  __FILE__, __LINE__, __func__, msg);
540  }
541  }
542  }
543 
544  int fuCount = mapper.resourceCount(*fu);
545  for (int i = 0; i < fuCount; i++) {
546  SchedulingResource* depRes = &mapper.resourceOf(*fu, i);
547  if (depRes->isExecutionPipelineResource()){
548  fuResource->addToDependentGroup(1, *depRes);
549  break;
550  }
551  }
552  }
553  // todo: dependent execution pipeline to support trigger-on-result
554 }

References __func__, SchedulingResource::addToDependentGroup(), Exception::errorMessageStack(), SchedulingResource::isExecutionPipelineResource(), TTAMachine::Port::outputSocket(), 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 OutputFUBroker::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 343 of file OutputFUBroker.cc.

343  {
344  if (!isApplicable(node)) {
345  return;
346  }
348 
349  TTAProgram::Move& move = node.move();
350  const TerminalFUPort* src = dynamic_cast<const TerminalFUPort*>(&move.source());
351  if (src) {
352  const TerminalFUPort* src = dynamic_cast<const TerminalFUPort*>(&move.source());
353  assert(src);
355  const ControlUnit* gcu =
356  dynamic_cast<const ControlUnit*>(&machinePartOf(res));
357 
358  // not ra read? unassign from fu
359  if (gcu == NULL) {
360  OutputFUResource* fuRes = dynamic_cast<OutputFUResource*>(&res);
361  fuRes->unassign(node.cycle(), node);
362  }
363  } else {
364  if (node.isGuardOperation()) {
365  ProgramOperation& gop = node.guardOperation();
366  SchedulingResource& res = *resourceOf(*gop.fuFromOutMove(node));
367  res.unassign(node.cycle(), node);
368  }
369  }
370  // removed from assigned resources also if ra read
371  assignedResources_.erase(&node);
372  }
373 }

References assert, ResourceBroker::assignedResources_, MapTools::containsKey(), MoveNode::cycle(), ProgramOperation::fuFromOutMove(), TTAProgram::TerminalFUPort::functionUnit(), MoveNode::guardOperation(), isApplicable(), MoveNode::isGuardOperation(), ResourceBroker::machinePartOf(), MoveNode::move(), ResourceBroker::resourceOf(), TTAProgram::Move::source(), SchedulingResource::unassign(), and OutputFUResource::unassign().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
ProgramOperation::operation
const Operation & operation() const
Definition: ProgramOperation.cc:590
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
ProgramOperation::outputIndexFromGuardOfMove
int outputIndexFromGuardOfMove(const MoveNode &node) const
Definition: ProgramOperation.cc:256
TTAProgram::ProgramAnnotation::ANN_REJECTED_UNIT_SRC
@ ANN_REJECTED_UNIT_SRC
Src. unit rejected.
Definition: ProgramAnnotation.hh:118
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAProgram::TerminalFUPort::functionUnit
virtual const TTAMachine::FunctionUnit & functionUnit() const
Definition: TerminalFUPort.cc:202
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
TTAMachine::HWOperation
Definition: HWOperation.hh:52
ResourceBroker::resMap_
ResourceMap resMap_
Definition: ResourceBroker.hh:165
SchedulingResource::unassign
virtual void unassign(const int cycle, MoveNode &node)=0
AssocTools::containsKey
static bool containsKey(const ContainerType &aContainer, const KeyType &aKey)
FUBroker::FUBroker
FUBroker(std::string name, unsigned int initiationInterval=0)
Definition: FUBroker.hh:51
TTAProgram::Move::isUnconditional
bool isUnconditional() const
Definition: Move.cc:154
ProgramOperation::fuFromOutMove
const TTAMachine::FunctionUnit * fuFromOutMove(const MoveNode &outputNode) const
Definition: ProgramOperation.cc:844
ResourceBroker::hasResource
bool hasResource(const SchedulingResource &r) const
Definition: ResourceBroker.cc:214
ProgramOperation
Definition: ProgramOperation.hh:70
MoveNode
Definition: MoveNode.hh:65
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
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
debugLogRM
#define debugLogRM(__X)
Definition: ResourceManager.hh:123
SchedulingResourceSet
Definition: SchedulingResource.hh:161
MoveNode::sourceOperation
ProgramOperation & sourceOperation() const
Definition: MoveNode.cc:453
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
TTAProgram::TerminalFUPort::hintOperation
virtual Operation & hintOperation() const
Definition: TerminalFUPort.cc:262
MoveNode::isMove
bool isMove() const
ResourceBroker::setResourceMapper
void setResourceMapper(const ResourceMapper &mapper)
Definition: ResourceBroker.cc:224
TTAProgram::ProgramAnnotation::ANN_ALLOWED_UNIT_SRC
@ ANN_ALLOWED_UNIT_SRC
Candidate units can be passed for resource manager for choosing the source/destination unit of the mo...
Definition: ProgramAnnotation.hh:112
MoveNode::isGuardOperation
bool isGuardOperation() const
Definition: MoveNode.cc:181
MachineConnectivityCheck::addAnnotatedFUs
static void addAnnotatedFUs(std::set< TCEString > &candidateFUs, const TTAProgram::Move &m, TTAProgram::ProgramAnnotation::Id id)
Definition: MachineConnectivityCheck.cc:1856
TTAProgram::ProgramAnnotation::ANN_CONN_CANDIDATE_UNIT_SRC
@ ANN_CONN_CANDIDATE_UNIT_SRC
Src. unit candidate.
Definition: ProgramAnnotation.hh:115
FUBroker::findFUOfPO
std::pair< bool, const TTAMachine::FunctionUnit * > findFUOfPO(ProgramOperation &po, const TTAMachine::FunctionUnit *resFU) const
Definition: FUBroker.cc:77
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
OutputFUResource
Definition: OutputFUResource.hh:53
TTAMachine::Port
Definition: Port.hh:54
TTAProgram::Move::guard
MoveGuard & guard() const
Definition: Move.cc:345
__func__
#define __func__
Definition: Application.hh:67
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
OutputFUResource::unassign
virtual void unassign(const int cycle, MoveNode &node) override
Definition: OutputFUResource.cc:103
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
MoveNode::isSourceOperation
bool isSourceOperation() const
Definition: MoveNode.cc:168
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
TTAMachine::FunctionUnit::hasOperation
virtual bool hasOperation(const std::string &name) const
Definition: FunctionUnit.cc:330
ModuleRunTimeError
Definition: Exception.hh:1043
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
OutputFUResource::assign
virtual void assign(const int cycle, MoveNode &node) override
Definition: OutputFUResource.cc:78
OutputFUResource::canAssign
virtual bool canAssign(const int cycle, const MoveNode &node) const override
Definition: OutputFUResource.cc:64
MoveNode::move
TTAProgram::Move & move()
MapTools::containsKey
static bool containsKey(const MapType &aMap, const KeyType &aKey)
ResourceMapper::resourceCount
int resourceCount(const TTAMachine::MachinePart &mp) const
Definition: ResourceMapper.cc:76
TCEString
Definition: TCEString.hh:53
OutputFUBroker::isApplicable
virtual bool isApplicable(const MoveNode &node, const TTAMachine::Bus *b=0) const override
Definition: OutputFUBroker.cc:464
ResourceBroker::instructionIndex
unsigned int instructionIndex(unsigned int) const
Definition: ResourceBroker.cc:249
TTAMachine::Port::outputSocket
virtual Socket * outputSocket() const
Definition: Port.cc:281
TTAProgram::Terminal
Definition: Terminal.hh:60
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
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::PortGuard
Definition: Guard.hh:99
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363
TTAProgram::MoveGuard::guard
const TTAMachine::Guard & guard() const
Definition: MoveGuard.cc:86
TTAMachine::ControlUnit::returnAddressPort
SpecialRegisterPort * returnAddressPort() const
Definition: ControlUnit.cc:307
SchedulingResourceSet::insert
void insert(SchedulingResource &resource)
Definition: SchedulingResource.cc:236
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
ProgramOperation::outputIndexOfMove
int outputIndexOfMove(const MoveNode &mn) const
Definition: ProgramOperation.cc:886
TTAProgram::Move::setSource
void setSource(Terminal *src)
Definition: Move.cc:312
MoveNode::guardOperation
ProgramOperation & guardOperation() const
Definition: MoveNode.cc:479