OpenASIP  2.0
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
IUResource Class Reference

#include <IUResource.hh>

Inheritance diagram for IUResource:
Inheritance graph
Collaboration diagram for IUResource:
Collaboration graph

Classes

struct  ResourceRecordType
 

Public Member Functions

virtual ~IUResource ()
 
 IUResource (const TTAMachine::Machine &mach, const std::string &name, const int registers, const int width, const int latency, const bool signExtension, unsigned int initiationInterval=0)
 
virtual bool isInUse (const int cycle) const override
 
virtual bool isAvailable (const int cycle, int immRegIndex) const
 
virtual bool isAvailable (const int cycle) const override
 
virtual bool canAssign (const int, const MoveNode &) const override
 
virtual bool canAssign (const int defCycle, const int useCycle, const MoveNode &node, int immRegIndex) const
 
virtual void assign (const int cycle, MoveNode &node) override
 
virtual void assign (const int defCycle, const int useCycle, MoveNode &node, int &index)
 
virtual void unassign (const int cycle, MoveNode &node) override
 
virtual bool isIUResource () const override
 
int registerCount () const
 
std::shared_ptr< TTAProgram::TerminalImmediateimmediateValue (const MoveNode &node) const
 
int immediateWriteCycle (const MoveNode &node) const
 
int width () const
 
void clearOldResources ()
 
void clear () override
 
- Public Member Functions inherited from SchedulingResource
virtual ~SchedulingResource ()
 
 SchedulingResource (const std::string &name, const unsigned int ii=0)
 
virtual int relatedResourceGroupCount () const
 
virtual int dependentResourceGroupCount () const
 
int relatedResourceCount (const int group) const
 
int dependentResourceCount (const int group) const
 
virtual void addToRelatedGroup (const int group, SchedulingResource &resource)
 
virtual void addToDependentGroup (const int group, SchedulingResource &resource)
 
virtual SchedulingResourcerelatedResource (const int group, const int index) const
 
virtual SchedulingResourcedependentResource (const int group, const int index) const
 
virtual bool hasRelatedResource (const SchedulingResource &sResource) const
 
virtual bool hasDependentResource (const SchedulingResource &sResource) const
 
virtual const std::string & name () const
 
virtual int useCount () const
 
virtual void increaseUseCount ()
 
virtual void decreaseUseCount ()
 
virtual bool isInputPSocketResource () const
 
virtual bool isOutputPSocketResource () const
 
virtual bool isShortImmPSocketResource () const
 
virtual bool isInputFUResource () const
 
virtual bool isOutputFUResource () const
 
virtual bool isExecutionPipelineResource () const
 
virtual bool isBusResource () const
 
virtual bool isSegmentResource () const
 
virtual bool isITemplateResource () const
 
int instructionIndex (int cycle) const
 
void setInitiationInterval (unsigned int ii)
 
int initiationInterval () const
 
virtual bool operator< (const SchedulingResource &other) const
 
virtual void setMaxCycle (unsigned int)
 

Protected Member Functions

virtual bool validateDependentGroups () override
 
virtual bool validateRelatedGroups () override
 
void setRegisterCount (const int registers)
 

Private Types

typedef std::vector< ResourceRecordType * > ResourceRecordVectorType
 

Private Member Functions

bool canAssignUse (int useCycle) const
 
 IUResource (const IUResource &)
 
IUResourceoperator= (const IUResource &)
 
int findAvailable (const int defCycle, const int useCycle, int immRegIndex) const
 

Private Attributes

std::vector< ResourceRecordVectorTyperesourceRecord_
 
int registerCount_
 
int width_
 
int latency_
 
bool signExtension_
 
const TTAMachine::Machinemachine_
 

Additional Inherited Members

- Protected Attributes inherited from SchedulingResource
int initiationInterval_
 

Detailed Description

An interface for scheduling resources of Resource Model The derived class IUResource

Definition at line 56 of file IUResource.hh.

Member Typedef Documentation

◆ ResourceRecordVectorType

Definition at line 115 of file IUResource.hh.

Constructor & Destructor Documentation

◆ ~IUResource()

IUResource::~IUResource ( )
virtual

Empty destructor

Definition at line 74 of file IUResource.cc.

74  {
75  for (int i = 0; i < registerCount(); i++) {
77  }
78 }

References SequenceTools::deleteAllItems(), registerCount(), and resourceRecord_.

Here is the call graph for this function:

◆ IUResource() [1/2]

IUResource::IUResource ( const TTAMachine::Machine mach,
const std::string &  name,
const int  registers,
const int  width,
const int  latency,
const bool  signExtension,
unsigned int  initiationInterval = 0 
)

Constructor defining resource name, register count and register width

Parameters
nameName of resource
registersNumber of registers in IU
widthBit width of registers in immediate unit
latencyLatency of Immediate unit, defaults to 1 in TCE
signExtensionIndicates if IU is using Zero or Sign extend

Definition at line 54 of file IUResource.cc.

63  registerCount_(registers), width_(width),
64  latency_(latency) , signExtension_(signExtension), machine_(mach) {
65  for (int i = 0; i < registerCount(); i++) {
67  resourceRecord_.push_back(vt);
68  }
69 }

References registerCount(), and resourceRecord_.

Here is the call graph for this function:

◆ IUResource() [2/2]

IUResource::IUResource ( const IUResource )
private

Member Function Documentation

◆ assign() [1/2]

void IUResource::assign ( const int  cycle,
MoveNode mn 
)
overridevirtual

Implementation of abstract method from base class. IUResource requires different api (definition and use cycle) This method is not to be used!

Implements SchedulingResource.

Definition at line 175 of file IUResource.cc.

175  {
176 
178  int index = mn.move().source().index();
179  ResourceRecordType* rc =
180  new ResourceRecordType(
181  -1,cycle,nullptr);
182 
183  resourceRecord_.at(index).push_back(rc);
184  return;
185  std::string msg = "IUResource: called assign with \'cycle\'";
186  msg += " and \'node\'. Use assign with \'defCycle\',";
187  msg += " \'useCycle\', \'node\' and \'index\' reference!";
188  abortWithError(msg);
189 }

References abortWithError, assert, TTAProgram::Terminal::index(), TTAProgram::Terminal::isImmediateRegister(), MoveNode::move(), resourceRecord_, and TTAProgram::Move::source().

Referenced by IUBroker::assign().

Here is the call graph for this function:

◆ assign() [2/2]

void IUResource::assign ( const int  defCycle,
const int  useCycle,
MoveNode node,
int &  index 
)
virtual

Assign resource to given node for given cycle

Parameters
defCycleCycle in which the value of immediate register will be written using instruction template
useCycleCycle in which the value of immediate register will be read by MoveNode
nodeMoveNode that reads the immediate register
indexWill be used to return index of register assigned

Definition at line 201 of file IUResource.cc.

202  {
203 
204  if (defCycle > useCycle) {
205  std::string msg =
206  "Long immediate definition cycle later than use cycle: ";
207  msg += Conversion::toString(defCycle);
208  msg += " > ";
209  msg += Conversion::toString(useCycle);
210  msg += "!";
211  throw ModuleRunTimeError(__FILE__, __LINE__, __func__, msg);
212  }
213  if ((useCycle - defCycle) < latency_) {
214  std::string msg = "Definition and use too close(";
215  msg += Conversion::toString(useCycle - defCycle) + "). ";
216  msg += name() + " has latency of " + Conversion::toString(latency_);
217  throw ModuleRunTimeError(__FILE__, __LINE__, __func__, msg);
218  }
219  int i = findAvailable(defCycle, useCycle, index);
220  if (i != -1) {
221  index = i;
222  ResourceRecordType* rc =
223  new ResourceRecordType(
224  defCycle,useCycle,static_cast<TTAProgram::TerminalImmediate*>(
225  node.move().source().copy()));
226  resourceRecord_.at(i).push_back(rc);
227  return;
228  }
229  std::string msg = "Assignment for immediate impossible!";
230  throw KeyNotFound(__FILE__, __LINE__, __func__, msg);
231 }

References __func__, TTAProgram::Terminal::copy(), findAvailable(), latency_, MoveNode::move(), SchedulingResource::name(), resourceRecord_, TTAProgram::Move::source(), and Conversion::toString().

Here is the call graph for this function:

◆ canAssign() [1/2]

bool IUResource::canAssign ( const int  defCycle,
const int  useCycle,
const MoveNode node,
int  immRegIndex 
) const
virtual

Return true if resource can be assigned for given resource in given cycle

Parameters
defCycledefinition cycle
useCycleuse of register cycle
nodeMoveNode to test
Returns
true if node can be assigned to cycle

Definition at line 321 of file IUResource.cc.

325  {
326 
327  if (defCycle > useCycle) {
328  return false;
329  }
330  if ((useCycle - defCycle) < latency_) {
331  return false;
332  }
333 
334  MoveNode& mNode = const_cast<MoveNode&>(node);
335  if (!mNode.move().source().isImmediate()) {
336  return false;
337  }
338 
340  static_cast<TTAProgram::TerminalImmediate*>(&mNode.move().source());
341  if (findAvailable(defCycle, useCycle, immRegIndex) != -1) {
343  signExtension_, *iTerm, machine_);
344  if (reqWidth > width_) {
345  return false;
346  }
347 
348  for (int i = 0; i < relatedResourceGroupCount(); i++) {
349  for (int j = 0, count = relatedResourceCount(i); j < count; j++) {
350  SchedulingResource& relRes = relatedResource(i,j);
351  // related res is counted as modcycles.
352  if (relRes.isOutputPSocketResource()) {
353  if (!relRes.isInUse(instructionIndex(useCycle))) {
354  return true;
355  }
356  }
357  }
358  }
359  }
360  return false;
361 }

References findAvailable(), SchedulingResource::instructionIndex(), TTAProgram::Terminal::isImmediate(), SchedulingResource::isInUse(), SchedulingResource::isOutputPSocketResource(), latency_, machine_, MoveNode::move(), SchedulingResource::relatedResource(), SchedulingResource::relatedResourceCount(), SchedulingResource::relatedResourceGroupCount(), MachineConnectivityCheck::requiredImmediateWidth(), signExtension_, TTAProgram::Move::source(), and width_.

Here is the call graph for this function:

◆ canAssign() [2/2]

bool IUResource::canAssign ( const int  cycle,
const MoveNode mn 
) const
overridevirtual

Implementation of abstract method from base class. IUResource requires different api (definition and use cycle) This method is not to be used!

Implements SchedulingResource.

Definition at line 282 of file IUResource.cc.

282  {
283  if (mn.isMove()) {
284  return canAssignUse(cycle);
285  }
286  std::string msg = "IUResource: called canAssign with \'cycle\'";
287  msg += " and \'node\'. Use canAssign with \'defCycle\',";
288  msg += " \'useCycle\' and \'node\'!";
289  abortWithError(msg);
290  return false;
291 }

References abortWithError, canAssignUse(), and MoveNode::isMove().

Referenced by IUBroker::allAvailableResources(), and IUBroker::assign().

Here is the call graph for this function:

◆ canAssignUse()

bool IUResource::canAssignUse ( int  useCycle) const
private

Checks that a immediate value can be read in the given cycle

Definition at line 297 of file IUResource.cc.

297  {
298  for (int i = 0; i < relatedResourceGroupCount(); i++) {
299  for (int j = 0, count = relatedResourceCount(i); j < count; j++) {
300  SchedulingResource& relRes = relatedResource(i,j);
301  // related res is counted as modcycles.
302  if (relRes.isOutputPSocketResource()) {
303  if (!relRes.isInUse(instructionIndex(useCycle))) {
304  return true;
305  }
306  }
307  }
308  }
309  return false;
310 }

References SchedulingResource::instructionIndex(), SchedulingResource::isInUse(), SchedulingResource::isOutputPSocketResource(), SchedulingResource::relatedResource(), SchedulingResource::relatedResourceCount(), and SchedulingResource::relatedResourceGroupCount().

Referenced by canAssign().

Here is the call graph for this function:

◆ clear()

void IUResource::clear ( )
overridevirtual

Clears bookkeeping of the scheduling resource.

After this call the state of the resource should be identical to a newly-created and initialized resource.

Reimplemented from SchedulingResource.

Definition at line 587 of file IUResource.cc.

587  {
589  for (int i = 0; i < registerCount(); i++) {
591  }
592 }

References SchedulingResource::clear(), SequenceTools::deleteAllItems(), registerCount(), and resourceRecord_.

Here is the call graph for this function:

◆ clearOldResources()

void IUResource::clearOldResources ( )

Definition at line 560 of file IUResource.cc.

560  {
561  for (int i = 0; i < registerCount(); i++) {
562  for (int j = 0;
563  j < static_cast<int>(resourceRecord_.at(i).size()); j++) {
564  ResourceRecordType* rec = resourceRecord_.at(i).at(j);
565  rec->immediateValue_ = NULL;
566  }
567  }
568 }

References IUResource::ResourceRecordType::immediateValue_, registerCount(), and resourceRecord_.

Referenced by IUBroker::clearOldResources().

Here is the call graph for this function:

◆ findAvailable()

int IUResource::findAvailable ( const int  defCycle,
const int  useCycle,
int  immRegIndex 
) const
private

Internal helper method, find available register for given pair of definition and use cycles.

Definition at line 491 of file IUResource.cc.

492  {
493  int modDef = instructionIndex(defCycle + latency_);
494  int modUse = instructionIndex(useCycle);
495  for (int i = 0; i < registerCount(); i++) {
496  if (immRegIndex != -1 && i != immRegIndex) continue;
497  bool marker = false;
498  const ResourceRecordVectorType& resVec = resourceRecord_.at(i);
499  int size = resVec.size();
500  for (int j = 0; j < size; j++) {
501  int otherDef = resVec[j]->definition_;
502  int modOtherDef = instructionIndex(otherDef + latency_);
503  int otherUse = resVec[j]->use_;
504  int modOtherUse = instructionIndex(otherUse);
505 
506  // no overlap in old.
507  if (modOtherUse >= modOtherDef) {
508  // ordinary comparison, use between old def and use?
509  if (modUse >= modOtherDef && modUse <= modOtherUse) {
510  marker = true;
511  break;
512  }
513 
514  if (modDef >= modOtherDef && modDef <= modOtherUse) {
515  marker = true;
516  break;
517  }
518 
519  } else {
520  // before use before use, or after def of other
521  if (modUse >= modOtherDef || modUse <= modOtherUse) {
522  marker = true;
523  break;
524  }
525 
526  if (modDef >= modOtherDef || modDef <= modOtherUse) {
527  marker = true;
528  break;
529  }
530  }
531 
532  // other def between these. case when other completely
533  // iside this range. can be detected be either other
534  // use or other def. checks above handle cases where
535  // tries to def, def, use, use
536 
537  if (modDef <= modUse) {
538  // no overlap in this. ordinary check.
539  if (modOtherDef >= modDef && modOtherDef <= modUse) {
540  marker = true;
541  break;
542  }
543  } else {
544  // we have overlap.
545 
546  if (modOtherDef >= modDef || modOtherDef <= modUse) {
547  marker = true;
548  break;
549  }
550  }
551  }
552  if (marker == false) {
553  return i;
554  }
555  }
556  return -1;
557 }

References SchedulingResource::instructionIndex(), latency_, registerCount(), and resourceRecord_.

Referenced by assign(), and canAssign().

Here is the call graph for this function:

◆ immediateValue()

std::shared_ptr< TTAProgram::TerminalImmediate > IUResource::immediateValue ( const MoveNode node) const

Returns a constant that should be written to immediate register used by MoveNode in cycle

Parameters
cycleCycle in which immediate register is read
nodeMoveNode which is reading the register
Returns
Long immediate constant that is expected to be in register

Definition at line 407 of file IUResource.cc.

407  {
408  MoveNode& testNode = const_cast<MoveNode&>(node);
409  if (!testNode.move().source().isImmediateRegister()) {
410  std::string msg = "Immediate register was not assigned!";
411  throw KeyNotFound(__FILE__, __LINE__, __func__, msg);
412  }
413  int regIndex = testNode.move().source().index();
414  for (int j = 0;
415  j < static_cast<int>(resourceRecord_.at(regIndex).size());
416  j++) {
417  if (node.cycle() == resourceRecord_.at(regIndex).at(j)->use_) {
418  // Test if cycle equal to use of value
419  // for register, if it is we return original terminal
420  return resourceRecord_.at(regIndex).at(j)->immediateValue_;
421  }
422  }
423  std::string msg = "Immediate register was not recorded in resource!";
424  throw KeyNotFound(__FILE__, __LINE__, __func__, msg);
425 }

References __func__, MoveNode::cycle(), TTAProgram::Terminal::index(), TTAProgram::Terminal::isImmediateRegister(), MoveNode::move(), resourceRecord_, and TTAProgram::Move::source().

Referenced by IUBroker::immediateValue(), and IUBroker::isAlreadyAssigned().

Here is the call graph for this function:

◆ immediateWriteCycle()

int IUResource::immediateWriteCycle ( const MoveNode node) const

Returns a cycle in which immediate register used by MoveNode is written

Parameters
nodeMoveNode which is reading the register
Returns
cycle in which register is written, or -1 if not found.

Definition at line 433 of file IUResource.cc.

433  {
434 
435  MoveNode& testNode = const_cast<MoveNode&>(node);
436  if (!testNode.move().source().isImmediateRegister()) {
437  return -1;
438  //std::string msg = "Immediate register was not assigned!";
439  //throw KeyNotFound(__FILE__, __LINE__, __func__, msg);
440  }
441  int regIndex = testNode.move().source().index();
442  for (int j = 0;
443  j < static_cast<int>(resourceRecord_.at(regIndex).size());
444  j++) {
445  if (node.cycle() == resourceRecord_.at(regIndex).at(j)->use_) {
446  // Test if cycle equal to use of value
447  // for register, if it is we return definition cycle
448  return resourceRecord_.at(regIndex).at(j)->definition_;
449  }
450  }
451  return -1;
452  //std::string msg = "Immediate register was not recorded in resource!";
453  //throw KeyNotFound(__FILE__, __LINE__, __func__, msg);
454 }

References MoveNode::cycle(), TTAProgram::Terminal::index(), TTAProgram::Terminal::isImmediateRegister(), MoveNode::move(), resourceRecord_, and TTAProgram::Move::source().

Referenced by IUBroker::immediateWriteCycle().

Here is the call graph for this function:

◆ isAvailable() [1/2]

bool IUResource::isAvailable ( const int  cycle) const
overridevirtual

Test if resource IUResource is available

Parameters
cycleCycle which to test
Returns
False if all registers in IU are used in cycle

Implements SchedulingResource.

Definition at line 120 of file IUResource.cc.

120  {
121  return isAvailable(cycle, -1);
122 }

References isAvailable().

Here is the call graph for this function:

◆ isAvailable() [2/2]

bool IUResource::isAvailable ( const int  cycle,
int  immRegIndex 
) const
virtual

Test if resource IUResource is available

Parameters
cycleCycle which to test
registerto test. If -1, any reg ok.
Returns
False if all registers in IU are used in cycle

Definition at line 131 of file IUResource.cc.

131  {
132  int modCycle = instructionIndex(cycle);
133  for (int i = 0; i < registerCount(); i++) {
134  if (immRegIndex != -1 && i != immRegIndex) continue;
135  bool marker = false;
136  for (int j = 0 ;
137  j < static_cast<int>(resourceRecord_.at(i).size());
138  j++) {
139  int otherDef = resourceRecord_.at(i).at(j)->definition_;
140  int modOtherDef = instructionIndex(otherDef + latency_);
141  int otherUse = resourceRecord_.at(i).at(j)->use_;
142  int modOtherUse = instructionIndex(otherUse);
143 
144  // no overlap in old.
145  if (modOtherUse >= modOtherDef) {
146  // ordinary comparison, use between old def and use?
147  if (modCycle > modOtherDef && modCycle < modOtherUse) {
148  marker = true;
149  break;
150  }
151  } else {
152  // before use before use, or after def of other
153  if (modCycle >= modOtherDef || modCycle <= modOtherUse) {
154  marker = true;
155  break;
156  }
157  }
158  }
159  // None of the intervals for registers overlapped cycle, register
160  // is available for use -> unit is available too
161  if (marker == false) {
162  return true;
163  }
164  }
165  return false;
166 }

References SchedulingResource::instructionIndex(), latency_, registerCount(), and resourceRecord_.

Referenced by isAvailable().

Here is the call graph for this function:

◆ isInUse()

bool IUResource::isInUse ( const int  cycle) const
overridevirtual

Test if resource IUResource is used in given cycle

Parameters
cycleCycle which to test
Returns
True if any (at least one) register of IU is already used in cycle

Implements SchedulingResource.

Definition at line 86 of file IUResource.cc.

86  {
87  int modCycle = instructionIndex(cycle);
88  for (int i = 0; i < registerCount(); i++) {
89  for (int j = 0;
90  j < static_cast<int>(resourceRecord_.at(i).size());
91  j++) {
92  int otherDef = resourceRecord_.at(i).at(j)->definition_;
93  int modOtherDef = instructionIndex(otherDef + latency_);
94  int otherUse = resourceRecord_.at(i).at(j)->use_;
95  int modOtherUse = instructionIndex(otherUse);
96 
97  // no overlap in old.
98  if (modOtherUse >= modOtherDef) {
99  // ordinary comparison, use between old def and use?
100  if (modCycle >= modOtherDef && modCycle < modOtherUse) {
101  return true;
102  }
103  } else {
104  // before use before use, or after def of other
105  if (modCycle >= modOtherDef || modCycle <= modOtherUse) {
106  return true;
107  }
108  }
109  }
110  }
111  return false;
112 }

References SchedulingResource::instructionIndex(), latency_, registerCount(), and resourceRecord_.

Here is the call graph for this function:

◆ isIUResource()

bool IUResource::isIUResource ( ) const
overridevirtual

Allways return true

Returns
true

Reimplemented from SchedulingResource.

Definition at line 368 of file IUResource.cc.

368  {
369  return true;
370 }

◆ operator=()

IUResource& IUResource::operator= ( const IUResource )
private

◆ registerCount()

int IUResource::registerCount ( ) const

Get number of registers in IU

Returns
Number of registers in IU

Definition at line 395 of file IUResource.cc.

395  {
396  return registerCount_;
397 }

References registerCount_.

Referenced by clear(), clearOldResources(), findAvailable(), isAvailable(), isInUse(), IUResource(), setRegisterCount(), and ~IUResource().

◆ setRegisterCount()

void IUResource::setRegisterCount ( const int  registers)
protected

Set the number of registers available in IU

Parameters
registersNumber of registers in this particular IU

Definition at line 377 of file IUResource.cc.

377  {
378  // We shell not provide API for decreasing size of existing IU
379  if (registers < registerCount()) {
380  throw InvalidData(__FILE__, __LINE__, __func__,
381  "Can not decrease number of registers in IMM unit!");
382  }
383  for (int i = registerCount_; i < registers; i++) {
385  resourceRecord_.push_back(vt);
386  }
387  registerCount_ = registers;
388 }

References __func__, registerCount(), registerCount_, and resourceRecord_.

Here is the call graph for this function:

◆ unassign()

void IUResource::unassign ( const int  cycle,
MoveNode node 
)
overridevirtual

Unassign resource from given node for given cycle

Parameters
cycleCycle in which immediate is read which we want unassign.
nodeMoveNode to remove assignment from

Implements SchedulingResource.

Definition at line 240 of file IUResource.cc.

240  {
241 
242  if (!node.move().source().isImmediateRegister()) {
243  std::string msg = "Trying to unassign move that is not immediate\
244  register read!";
245  throw KeyNotFound(__FILE__, __LINE__, __func__, msg);
246  }
247  // Find which register in given IU is assigned to node
248  int regIndex = node.move().source().index();
249  if (resourceRecord_.at(regIndex).size() == 0) {
250  std::string msg = "The register is not assigned!";
251  throw KeyNotFound(__FILE__, __LINE__, __func__, msg);
252  }
253  std::vector<ResourceRecordType*>::iterator itr =
254  resourceRecord_.at(regIndex).begin();
255  // From given IU register delete record about
256  // assignment to node and restore node source
257  while (itr != resourceRecord_.at(regIndex).end()) {
258  if (node.cycle() == (*itr)->use_) {
259  std::shared_ptr<TTAProgram::TerminalImmediate> originalTerminal =
260  ((*itr)->immediateValue_);
261  if (originalTerminal) {
262  TTAProgram::Terminal* toSet = originalTerminal->copy();
263  node.move().setSource(toSet);
264  }
265  delete *itr;
266  resourceRecord_.at(regIndex).erase(itr);
267 
268  return;
269  }
270  itr++;
271  }
272  std::string msg = "Register is not assigned for given cycle!";
273  throw KeyNotFound(__FILE__, __LINE__, __func__, msg);
274 }

References __func__, TTAProgram::TerminalImmediate::copy(), MoveNode::cycle(), TTAProgram::Terminal::index(), TTAProgram::Terminal::isImmediateRegister(), MoveNode::move(), resourceRecord_, TTAProgram::Move::setSource(), and TTAProgram::Move::source().

Referenced by IUBroker::unassign().

Here is the call graph for this function:

◆ validateDependentGroups()

bool IUResource::validateDependentGroups ( )
overrideprotectedvirtual

Tests if all referred resources in dependent groups are of proper types

Returns
true If all resources in dependent groups are Immediate Registers

Reimplemented from SchedulingResource.

Definition at line 462 of file IUResource.cc.

462  {
463  return true;
464 }

◆ validateRelatedGroups()

bool IUResource::validateRelatedGroups ( )
overrideprotectedvirtual

Tests if all referred resources in related groups are of proper types

Returns
true If all resources in related groups are Instruction Templates or P-Sockets

Reimplemented from SchedulingResource.

Definition at line 473 of file IUResource.cc.

473  {
474  for (int i = 0; i < relatedResourceGroupCount(); i++) {
475  for (int j = 0, count = relatedResourceCount(i); j < count; j++) {
479  return false;
480  }
481  }
482  }
483  return true;
484 }

References SchedulingResource::isInputPSocketResource(), SchedulingResource::isITemplateResource(), SchedulingResource::isOutputPSocketResource(), SchedulingResource::relatedResource(), SchedulingResource::relatedResourceCount(), and SchedulingResource::relatedResourceGroupCount().

Here is the call graph for this function:

◆ width()

int IUResource::width ( ) const

Returns a width of registers in Immediate Unit.

Returns
Width of registers in Immediate Unit.

Definition at line 576 of file IUResource.cc.

576  {
577  return width_;
578 }

References width_.

Referenced by IUBroker::less_width::operator()().

Member Data Documentation

◆ latency_

int IUResource::latency_
private

Definition at line 129 of file IUResource.hh.

Referenced by assign(), canAssign(), findAvailable(), isAvailable(), and isInUse().

◆ machine_

const TTAMachine::Machine& IUResource::machine_
private

Definition at line 133 of file IUResource.hh.

Referenced by canAssign().

◆ registerCount_

int IUResource::registerCount_
private

Definition at line 125 of file IUResource.hh.

Referenced by registerCount(), and setRegisterCount().

◆ resourceRecord_

std::vector<ResourceRecordVectorType> IUResource::resourceRecord_
private

◆ signExtension_

bool IUResource::signExtension_
private

Definition at line 131 of file IUResource.hh.

Referenced by canAssign().

◆ width_

int IUResource::width_
private

Definition at line 127 of file IUResource.hh.

Referenced by canAssign(), and width().


The documentation for this class was generated from the following files:
SchedulingResource::clear
virtual void clear()
Definition: SchedulingResource.cc:397
MachineConnectivityCheck::requiredImmediateWidth
static int requiredImmediateWidth(bool signExtension, const TTAProgram::TerminalImmediate &source, const TTAMachine::Machine &mach)
Definition: MachineConnectivityCheck.cc:1247
SchedulingResource::SchedulingResource
SchedulingResource(const std::string &name, const unsigned int ii=0)
Definition: SchedulingResource.cc:51
IUResource::signExtension_
bool signExtension_
Definition: IUResource.hh:131
TTAProgram::Terminal::index
virtual int index() const
Definition: Terminal.cc:274
IUResource::canAssignUse
bool canAssignUse(int useCycle) const
Definition: IUResource.cc:297
IUResource::registerCount_
int registerCount_
Definition: IUResource.hh:125
SchedulingResource::isITemplateResource
virtual bool isITemplateResource() const
MoveNode
Definition: MoveNode.hh:65
SchedulingResource::isInputPSocketResource
virtual bool isInputPSocketResource() const
Conversion::toString
static std::string toString(const T &source)
assert
#define assert(condition)
Definition: Application.hh:86
TTAProgram::Terminal::isImmediateRegister
virtual bool isImmediateRegister() const
Definition: Terminal.cc:97
MoveNode::isMove
bool isMove() const
SequenceTools::deleteAllItems
static void deleteAllItems(SequenceType &aSequence)
SchedulingResource::relatedResource
virtual SchedulingResource & relatedResource(const int group, const int index) const
Definition: SchedulingResource.cc:120
IUResource::resourceRecord_
std::vector< ResourceRecordVectorType > resourceRecord_
Definition: IUResource.hh:123
IUResource::width
int width() const
Definition: IUResource.cc:576
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
IUResource::latency_
int latency_
Definition: IUResource.hh:129
MoveNode::cycle
int cycle() const
Definition: MoveNode.cc:421
InvalidData
Definition: Exception.hh:149
SchedulingResource
Definition: SchedulingResource.hh:52
IUResource::ResourceRecordVectorType
std::vector< ResourceRecordType * > ResourceRecordVectorType
Definition: IUResource.hh:115
__func__
#define __func__
Definition: Application.hh:67
TTAProgram::TerminalImmediate::copy
virtual Terminal * copy() const
Definition: TerminalImmediate.cc:85
IUResource::findAvailable
int findAvailable(const int defCycle, const int useCycle, int immRegIndex) const
Definition: IUResource.cc:491
IUResource::width_
int width_
Definition: IUResource.hh:127
SchedulingResource::isOutputPSocketResource
virtual bool isOutputPSocketResource() const
SchedulingResource::instructionIndex
int instructionIndex(int cycle) const
SchedulingResource::isInUse
virtual bool isInUse(const int cycle) const =0
ModuleRunTimeError
Definition: Exception.hh:1043
SchedulingResource::initiationInterval
int initiationInterval() const
Definition: SchedulingResource.cc:385
SchedulingResource::relatedResourceCount
int relatedResourceCount(const int group) const
TTAProgram::TerminalImmediate
Definition: TerminalImmediate.hh:44
MoveNode::move
TTAProgram::Move & move()
IUResource::machine_
const TTAMachine::Machine & machine_
Definition: IUResource.hh:133
TTAProgram::Terminal::copy
virtual Terminal * copy() const =0
TTAProgram::Terminal
Definition: Terminal.hh:60
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
KeyNotFound
Definition: Exception.hh:285
SchedulingResource::name
virtual const std::string & name() const
SchedulingResource::relatedResourceGroupCount
virtual int relatedResourceGroupCount() const
Definition: SchedulingResource.cc:61
IUResource::registerCount
int registerCount() const
Definition: IUResource.cc:395
TTAProgram::Terminal::isImmediate
virtual bool isImmediate() const
Definition: Terminal.cc:63
IUResource::isAvailable
virtual bool isAvailable(const int cycle, int immRegIndex) const
Definition: IUResource.cc:131
TTAProgram::Move::setSource
void setSource(Terminal *src)
Definition: Move.cc:312