OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
ResourceVectorFUResourceConflictDetector Class Reference

#include <ResourceVectorFUResourceConflictDetector.hh>

Inheritance diagram for ResourceVectorFUResourceConflictDetector:
Inheritance graph
Collaboration diagram for ResourceVectorFUResourceConflictDetector:
Collaboration graph

Public Member Functions

 ResourceVectorFUResourceConflictDetector (const TTAMachine::FunctionUnit &fu)
 
virtual ~ResourceVectorFUResourceConflictDetector ()
 
virtual bool issueOperation (OperationID id)
 
virtual bool advanceCycle ()
 
virtual void reset ()
 
virtual OperationID operationID (const TCEString &operationName) const
 
- Public Member Functions inherited from FUResourceConflictDetector
 FUResourceConflictDetector ()
 
virtual ~FUResourceConflictDetector ()
 
virtual void endClock ()
 
virtual void advanceClock ()
 
virtual bool isIdle ()
 
- Public Member Functions inherited from ClockedState
 ClockedState ()
 
virtual ~ClockedState ()
 

Private Attributes

TTAMachine::ResourceVectorSet vectors_
 The resource vectors of operations. More...
 
TTAMachine::ResourceVector compositeVector_
 The composite resource vector. More...
 

Additional Inherited Members

- Public Types inherited from FUResourceConflictDetector
typedef int OperationID
 Type for identifying operations in the conflict detector interface. More...
 
- Protected Attributes inherited from FUResourceConflictDetector
OperationIDIndexoperationIndices_
 Map for finding indices for operations quickly. More...
 

Detailed Description

An FSA implementation of a FU resource conflict detector.

Definition at line 54 of file ResourceVectorFUResourceConflictDetector.hh.

Constructor & Destructor Documentation

◆ ResourceVectorFUResourceConflictDetector()

ResourceVectorFUResourceConflictDetector::ResourceVectorFUResourceConflictDetector ( const TTAMachine::FunctionUnit fu)

Constructor.

Parameters
fuThe function unit to detect conflicts for.
Exceptions
InvalidDataIf the model could not be built from the given FU.

Definition at line 47 of file ResourceVectorFUResourceConflictDetector.cc.

48  : vectors_(fu) {}

◆ ~ResourceVectorFUResourceConflictDetector()

ResourceVectorFUResourceConflictDetector::~ResourceVectorFUResourceConflictDetector ( )
virtual

Destructor.

Definition at line 54 of file ResourceVectorFUResourceConflictDetector.cc.

54  {
55 }

Member Function Documentation

◆ advanceCycle()

bool ResourceVectorFUResourceConflictDetector::advanceCycle ( )
virtual

Simulates a cycle advance and reports a conflict if detected.

Returns
False in case a conflict is detected, otherwise true.

Reimplemented from FUResourceConflictDetector.

Definition at line 80 of file ResourceVectorFUResourceConflictDetector.cc.

80  {
81 
83  return true;
84 }

References compositeVector_, and TTAMachine::ResourceVector::shiftLeft().

Here is the call graph for this function:

◆ issueOperation()

bool ResourceVectorFUResourceConflictDetector::issueOperation ( OperationID  id)
virtual

Issues an operation and reports a conflict if detected.

Parameters
idThe id of the operation to issue.
Returns
False in case a conflict is detected, otherwise true.

Reimplemented from FUResourceConflictDetector.

Definition at line 64 of file ResourceVectorFUResourceConflictDetector.cc.

64  {
65 
66  const TTAMachine::ResourceVector& operationVector =
68  if (compositeVector_.conflictsWith(operationVector, 1))
69  return false;
70  compositeVector_.mergeWith(operationVector, 1);
71  return true;
72 }

References compositeVector_, TTAMachine::ResourceVector::conflictsWith(), TTAMachine::ResourceVector::mergeWith(), TTAMachine::ResourceVectorSet::resourceVector(), and vectors_.

Here is the call graph for this function:

◆ operationID()

ResourceVectorFUResourceConflictDetector::OperationID ResourceVectorFUResourceConflictDetector::operationID ( const TCEString operationName) const
virtual

Returns an operation id for the given operation.

Operation IDs are used in the interface for optimizing the access. This method converts OSAL Operations to operation IDs.

Parameters
operationThe OSAL Operation to find ID for.
Returns
The operation ID.

Reimplemented from FUResourceConflictDetector.

Definition at line 96 of file ResourceVectorFUResourceConflictDetector.cc.

97  {
98 
99  return vectors_.operationIndex(StringTools::stringToUpper(operationName));
100 }

References TTAMachine::ResourceVectorSet::operationIndex(), StringTools::stringToUpper(), and vectors_.

Here is the call graph for this function:

◆ reset()

void ResourceVectorFUResourceConflictDetector::reset ( )
virtual

Sets the state of the detector to its initial state.

This means that the FU state is assumed to be what it is in powerup.

Reimplemented from FUResourceConflictDetector.

Definition at line 108 of file ResourceVectorFUResourceConflictDetector.cc.

108  {
110 }

References TTAMachine::ResourceVector::clear(), and compositeVector_.

Here is the call graph for this function:

Member Data Documentation

◆ compositeVector_

TTAMachine::ResourceVector ResourceVectorFUResourceConflictDetector::compositeVector_
private

The composite resource vector.

Definition at line 73 of file ResourceVectorFUResourceConflictDetector.hh.

Referenced by advanceCycle(), issueOperation(), and reset().

◆ vectors_

TTAMachine::ResourceVectorSet ResourceVectorFUResourceConflictDetector::vectors_
private

The resource vectors of operations.

Definition at line 71 of file ResourceVectorFUResourceConflictDetector.hh.

Referenced by issueOperation(), and operationID().


The documentation for this class was generated from the following files:
TTAMachine::ResourceVector::clear
virtual void clear()
Definition: ResourceVector.cc:220
TTAMachine::ResourceVector
Definition: ResourceVector.hh:53
StringTools::stringToUpper
static std::string stringToUpper(const std::string &source)
Definition: StringTools.cc:143
TTAMachine::ResourceVectorSet::operationIndex
std::size_t operationIndex(const std::string &operationName) const
Definition: ResourceVectorSet.cc:160
TTAMachine::ResourceVectorSet::resourceVector
const ResourceVector & resourceVector(const std::string &operationName) const
Definition: ResourceVectorSet.cc:91
TTAMachine::ResourceVector::mergeWith
virtual void mergeWith(const ResourceVector &other, unsigned cycle)
Definition: ResourceVector.cc:194
ResourceVectorFUResourceConflictDetector::compositeVector_
TTAMachine::ResourceVector compositeVector_
The composite resource vector.
Definition: ResourceVectorFUResourceConflictDetector.hh:73
TTAMachine::ResourceVector::conflictsWith
virtual bool conflictsWith(const ResourceVector &other, unsigned cycle) const
Definition: ResourceVector.cc:154
TTAMachine::ResourceVector::shiftLeft
virtual void shiftLeft()
Definition: ResourceVector.cc:209
ResourceVectorFUResourceConflictDetector::vectors_
TTAMachine::ResourceVectorSet vectors_
The resource vectors of operations.
Definition: ResourceVectorFUResourceConflictDetector.hh:71