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

#include <ConflictDetectingOperationExecutor.hh>

Inheritance diagram for ConflictDetectingOperationExecutor:
Inheritance graph
Collaboration diagram for ConflictDetectingOperationExecutor:
Collaboration graph

Public Member Functions

 ConflictDetectingOperationExecutor (FUResourceConflictDetector &detector, FUResourceConflictDetector::OperationID operationID, FUState &parent, TTAMachine::HWOperation &hwOp, bool throwWhenConflict)
 
virtual ~ConflictDetectingOperationExecutor ()
 
virtual void startOperation (Operation &op)
 
virtual void advanceClock ()
 
virtual OperationExecutorcopy ()
 
- Public Member Functions inherited from MultiLatencyOperationExecutor
 MultiLatencyOperationExecutor (FUState &parent, TTAMachine::HWOperation &hwOp)
 
 MultiLatencyOperationExecutor ()
 
virtual ~MultiLatencyOperationExecutor ()
 
virtual void setContext (OperationContext &context)
 
virtual void reset ()
 
virtual void setOperationSimulator (DetailedOperationSimulator &sim)
 
- Public Member Functions inherited from OperationExecutor
 OperationExecutor ()
 
 OperationExecutor (FUState &parent)
 
virtual ~OperationExecutor ()
 
FUStateparent () const
 
void setParent (FUState &parent)
 
void addBinding (int io, PortState &port)
 
PortStatebinding (int io) const
 
bool hasPendingOperations () const
 

Private Member Functions

ConflictDetectingOperationExecutoroperator= (const ConflictDetectingOperationExecutor &)
 Assignment not allowed. More...
 

Private Attributes

FUResourceConflictDetectordetector_
 The conflict detector used to test whether starting operation is legal. More...
 
const FUResourceConflictDetector::OperationID operationID_
 The conflict detector ID of the operation executed with this executor. More...
 
const bool throwWhenConflict_
 True in case an exception should be thrown in case of a resource conflict. More...
 
ClockCycleCount conflictCounter_
 Counter for detected conflicts. More...
 

Additional Inherited Members

- Protected Attributes inherited from OperationExecutor
std::vector< PortState * > bindings_
 PortStates that are bound to a certain input or output operand. More...
 
bool hasPendingOperations_
 This is set to true if the OperationExecutor is not in 'idle' mode. More...
 

Detailed Description

OperationExecutor that checks for FU resource conflicts.

This kind of OperationExecutor is created for each operation in the simulated FU. This is purely for optimization purposes: as we need to check the resource conflicts using a per operation ID, it's faster to use a constant ID for requesting the conflict detection data instead of first fetching the constant from a map for the executed operation.

Definition at line 49 of file ConflictDetectingOperationExecutor.hh.

Constructor & Destructor Documentation

◆ ConflictDetectingOperationExecutor()

ConflictDetectingOperationExecutor::ConflictDetectingOperationExecutor ( FUResourceConflictDetector detector,
FUResourceConflictDetector::OperationID  operationID,
FUState parent,
TTAMachine::HWOperation hwOp,
bool  throwWhenConflict 
)

Constructor.

Parameters
detectorThe conflict detector.
operationIDThe conflict detector ID of the operation executed by this operation executor.
parentParent of the OperationExecutor.
throwWhenConflictIn case an exception should be thrown in case of a resource conflict (otherwise the conflicts are only counted).

Definition at line 53 of file ConflictDetectingOperationExecutor.cc.

58  :
60  operationID_(operationID), throwWhenConflict_(throwWhenConflict),
61  conflictCounter_(0) {
62 }

Referenced by copy().

◆ ~ConflictDetectingOperationExecutor()

ConflictDetectingOperationExecutor::~ConflictDetectingOperationExecutor ( )
virtual

Destructor.

Definition at line 67 of file ConflictDetectingOperationExecutor.cc.

67  {
68 #if 0
69  if (conflictCounter_ > 0)
70  std::cout << " (" << conflictCounter_ << " conflicts) ";
71 #endif
72 }

References conflictCounter_.

Member Function Documentation

◆ advanceClock()

void ConflictDetectingOperationExecutor::advanceClock ( )
virtual

Advances clock by one cycle.

Updates the resource conflict model.

Reimplemented from MultiLatencyOperationExecutor.

Definition at line 109 of file ConflictDetectingOperationExecutor.cc.

109  {
110 
112  // we need to receive the advanceClock() on every clock advance to update
113  // the resource conflict model
114  hasPendingOperations_ = true;
115 }

References MultiLatencyOperationExecutor::advanceClock(), and OperationExecutor::hasPendingOperations_.

Here is the call graph for this function:

◆ copy()

OperationExecutor * ConflictDetectingOperationExecutor::copy ( )
virtual

Copies OperationExecutor.

Returns
The copied OperationExecutor.

Reimplemented from MultiLatencyOperationExecutor.

Definition at line 123 of file ConflictDetectingOperationExecutor.cc.

123  {
124  return new ConflictDetectingOperationExecutor(*this);
125 }

References ConflictDetectingOperationExecutor().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.

◆ startOperation()

void ConflictDetectingOperationExecutor::startOperation ( Operation op)
virtual

Starts new operation.

Checks for resource conflicts before actually simulating the operation using the parent class implementation.

Parameters
opOperation to be triggered.

Reimplemented from MultiLatencyOperationExecutor.

Definition at line 83 of file ConflictDetectingOperationExecutor.cc.

83  {
84 
89  __FILE__, __LINE__, __func__,
90  (boost::format(
91  "Resource conflict detected: operation %s.")
92  % op.name()).str());
93  return;
94  }
95 
97 
98  // we need to receive the advanceClock() on every clock advance to update
99  // the resource conflict model
100  hasPendingOperations_ = true;
101 }

References __func__, conflictCounter_, detector_, OperationExecutor::hasPendingOperations_, FUResourceConflictDetector::issueOperation(), Operation::name(), operationID_, MultiLatencyOperationExecutor::startOperation(), and throwWhenConflict_.

Here is the call graph for this function:

Member Data Documentation

◆ conflictCounter_

ClockCycleCount ConflictDetectingOperationExecutor::conflictCounter_
private

Counter for detected conflicts.

Definition at line 79 of file ConflictDetectingOperationExecutor.hh.

Referenced by startOperation(), and ~ConflictDetectingOperationExecutor().

◆ detector_

FUResourceConflictDetector& ConflictDetectingOperationExecutor::detector_
private

The conflict detector used to test whether starting operation is legal.

Definition at line 72 of file ConflictDetectingOperationExecutor.hh.

Referenced by startOperation().

◆ operationID_

const FUResourceConflictDetector::OperationID ConflictDetectingOperationExecutor::operationID_
private

The conflict detector ID of the operation executed with this executor.

Definition at line 74 of file ConflictDetectingOperationExecutor.hh.

Referenced by startOperation().

◆ throwWhenConflict_

const bool ConflictDetectingOperationExecutor::throwWhenConflict_
private

True in case an exception should be thrown in case of a resource conflict.

Definition at line 77 of file ConflictDetectingOperationExecutor.hh.

Referenced by startOperation().


The documentation for this class was generated from the following files:
ConflictDetectingOperationExecutor::detector_
FUResourceConflictDetector & detector_
The conflict detector used to test whether starting operation is legal.
Definition: ConflictDetectingOperationExecutor.hh:72
SimulationExecutionError
Definition: Exception.hh:951
Operation::name
virtual TCEString name() const
Definition: Operation.cc:93
OperationExecutor::hasPendingOperations_
bool hasPendingOperations_
This is set to true if the OperationExecutor is not in 'idle' mode.
Definition: OperationExecutor.hh:73
MultiLatencyOperationExecutor::advanceClock
virtual void advanceClock()
Definition: MultiLatencyOperationExecutor.cc:168
ConflictDetectingOperationExecutor::operationID_
const FUResourceConflictDetector::OperationID operationID_
The conflict detector ID of the operation executed with this executor.
Definition: ConflictDetectingOperationExecutor.hh:74
MultiLatencyOperationExecutor::startOperation
virtual void startOperation(Operation &op)
Definition: MultiLatencyOperationExecutor.cc:118
__func__
#define __func__
Definition: Application.hh:67
MultiLatencyOperationExecutor::MultiLatencyOperationExecutor
MultiLatencyOperationExecutor()
Definition: MultiLatencyOperationExecutor.hh:65
ConflictDetectingOperationExecutor::ConflictDetectingOperationExecutor
ConflictDetectingOperationExecutor(FUResourceConflictDetector &detector, FUResourceConflictDetector::OperationID operationID, FUState &parent, TTAMachine::HWOperation &hwOp, bool throwWhenConflict)
Definition: ConflictDetectingOperationExecutor.cc:53
OperationExecutor::parent
FUState & parent() const
FUResourceConflictDetector::issueOperation
virtual bool issueOperation(OperationID id)
Definition: FUResourceConflictDetector.cc:64
ConflictDetectingOperationExecutor::conflictCounter_
ClockCycleCount conflictCounter_
Counter for detected conflicts.
Definition: ConflictDetectingOperationExecutor.hh:79
ConflictDetectingOperationExecutor::throwWhenConflict_
const bool throwWhenConflict_
True in case an exception should be thrown in case of a resource conflict.
Definition: ConflictDetectingOperationExecutor.hh:77