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

#include <DCMFUResourceConflictDetector.hh>

Inheritance diagram for DCMFUResourceConflictDetector:
Inheritance graph
Collaboration diagram for DCMFUResourceConflictDetector:
Collaboration graph

Public Member Functions

 DCMFUResourceConflictDetector (const TTAMachine::FunctionUnit &fu)
 
virtual ~DCMFUResourceConflictDetector ()
 
virtual bool issueOperation (OperationID id)
 
virtual bool advanceCycle ()
 
virtual void reset ()
 
bool issueOperationInline (OperationID id)
 
bool advanceCycleInline ()
 
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

FUCollisionMatrixIndex collisionMatrices_
 The reservation tables of operations. More...
 
CollisionMatrix globalCollisionMatrix_
 The global collision matrix. More...
 
const TTAMachine::FunctionUnitfu_
 The modeled FU. 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

A Dynamic Collision Matrix (DCM) implementation of an FU resource conflict detector.

Definition at line 55 of file DCMFUResourceConflictDetector.hh.

Constructor & Destructor Documentation

◆ DCMFUResourceConflictDetector()

DCMFUResourceConflictDetector::DCMFUResourceConflictDetector ( 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 DCMFUResourceConflictDetector.cc.

49  : collisionMatrices_(fu),
52  collisionMatrices_.at(0).rowCount(), false),
53  fu_(fu) {}

◆ ~DCMFUResourceConflictDetector()

DCMFUResourceConflictDetector::~DCMFUResourceConflictDetector ( )
virtual

Destructor.

Definition at line 59 of file DCMFUResourceConflictDetector.cc.

59  {
60 }

Member Function Documentation

◆ advanceCycle()

bool DCMFUResourceConflictDetector::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 79 of file DCMFUResourceConflictDetector.cc.

79  {
80  return advanceCycleInline();
81 }

References advanceCycleInline().

Here is the call graph for this function:

◆ advanceCycleInline()

bool DCMFUResourceConflictDetector::advanceCycleInline ( )

Referenced by advanceCycle().

◆ issueOperation()

bool DCMFUResourceConflictDetector::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 69 of file DCMFUResourceConflictDetector.cc.

69  {
70  return issueOperationInline(id);
71 }

References issueOperationInline().

Here is the call graph for this function:

◆ issueOperationInline()

bool DCMFUResourceConflictDetector::issueOperationInline ( OperationID  id)

Referenced by issueOperation().

◆ operationID()

DCMFUResourceConflictDetector::OperationID DCMFUResourceConflictDetector::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 93 of file DCMFUResourceConflictDetector.cc.

94  {
95 
96  // find the index of the operation in the FU, it corresponds to the
97  // operation ID
98  for (int i = 0; i < fu_.operationCount(); ++i) {
99  if (StringTools::ciEqual(fu_.operation(i)->name(), operationName)) {
100  return i;
101  }
102  }
103  throw KeyNotFound(__FILE__, __LINE__, __func__, "Operation not found.");
104 }

References __func__, StringTools::ciEqual(), fu_, TTAMachine::HWOperation::name(), TTAMachine::FunctionUnit::operation(), and TTAMachine::FunctionUnit::operationCount().

Here is the call graph for this function:

◆ reset()

void DCMFUResourceConflictDetector::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 112 of file DCMFUResourceConflictDetector.cc.

112  {
114 }

References globalCollisionMatrix_, and BitMatrix::setAllToZero().

Here is the call graph for this function:

Member Data Documentation

◆ collisionMatrices_

FUCollisionMatrixIndex DCMFUResourceConflictDetector::collisionMatrices_
private

The reservation tables of operations.

Definition at line 72 of file DCMFUResourceConflictDetector.hh.

◆ fu_

const TTAMachine::FunctionUnit& DCMFUResourceConflictDetector::fu_
private

The modeled FU.

Definition at line 76 of file DCMFUResourceConflictDetector.hh.

Referenced by operationID().

◆ globalCollisionMatrix_

CollisionMatrix DCMFUResourceConflictDetector::globalCollisionMatrix_
private

The global collision matrix.

Definition at line 74 of file DCMFUResourceConflictDetector.hh.

Referenced by reset().


The documentation for this class was generated from the following files:
DCMFUResourceConflictDetector::globalCollisionMatrix_
CollisionMatrix globalCollisionMatrix_
The global collision matrix.
Definition: DCMFUResourceConflictDetector.hh:74
BitMatrix::setAllToZero
void setAllToZero()
Definition: BitMatrix.cc:93
BitMatrix::rowCount
int rowCount() const
DCMFUResourceConflictDetector::collisionMatrices_
FUCollisionMatrixIndex collisionMatrices_
The reservation tables of operations.
Definition: DCMFUResourceConflictDetector.hh:72
TTAMachine::HWOperation::name
const std::string & name() const
Definition: HWOperation.cc:141
DCMFUResourceConflictDetector::issueOperationInline
bool issueOperationInline(OperationID id)
DCMFUResourceConflictDetector::advanceCycleInline
bool advanceCycleInline()
__func__
#define __func__
Definition: Application.hh:67
FUCollisionMatrixIndex::at
CollisionMatrix & at(int index)
Definition: FUCollisionMatrixIndex.cc:89
TTAMachine::FunctionUnit::operationCount
virtual int operationCount() const
Definition: FunctionUnit.cc:419
StringTools::ciEqual
static bool ciEqual(const std::string &a, const std::string &b)
Definition: StringTools.cc:240
DCMFUResourceConflictDetector::fu_
const TTAMachine::FunctionUnit & fu_
The modeled FU.
Definition: DCMFUResourceConflictDetector.hh:76
BitMatrix::columnCount
int columnCount() const
KeyNotFound
Definition: Exception.hh:285
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363