OpenASIP
2.0
|
#include <FSAFUResourceConflictDetector.hh>
Public Member Functions | |
FSAFUResourceConflictDetector (const TTAMachine::FunctionUnit &fu) | |
virtual | ~FSAFUResourceConflictDetector () |
virtual bool | issueOperation (OperationID id) |
virtual bool | advanceCycle () |
virtual bool | isIdle () |
bool | issueOperationInline (OperationID id) |
bool | issueOperationLazyInline (OperationID id) |
bool | advanceCycleInline () |
bool | advanceCycleLazyInline () |
virtual void | reset () |
void | initializeAllStates () |
const char * | operationName (OperationID id) const |
virtual OperationID | operationID (const TCEString &operationName) const |
virtual void | writeToDotFile (const TCEString &fileName) const |
Public Member Functions inherited from FUResourceConflictDetector | |
FUResourceConflictDetector () | |
virtual | ~FUResourceConflictDetector () |
virtual void | endClock () |
virtual void | advanceClock () |
Public Member Functions inherited from ClockedState | |
ClockedState () | |
virtual | ~ClockedState () |
Private Attributes | |
FSAFUResourceConflictDetectorPimpl * | pimpl_ |
Private implementation in a separate source file. 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 | |
OperationIDIndex * | operationIndices_ |
Map for finding indices for operations quickly. More... | |
An FSA implementation of a FU resource conflict detector.
Definition at line 49 of file FSAFUResourceConflictDetector.hh.
FSAFUResourceConflictDetector::FSAFUResourceConflictDetector | ( | const TTAMachine::FunctionUnit & | fu | ) |
Constructor.
Initializes the FSA to a lazy mode in which the states are built when they are needed the first time. In order to initialize all states, call initializeAllStates().
fu | The function unit to detect conflicts for. |
InvalidData | If the model could not be built from the given FU. |
Definition at line 52 of file FSAFUResourceConflictDetector.cc.
References issueOperation(), FSAFUResourceConflictDetectorPimpl::NOP, and pimpl_.
|
virtual |
|
virtual |
Simulates a cycle advance and reports a conflict if detected.
Reimplemented from FUResourceConflictDetector.
Definition at line 120 of file FSAFUResourceConflictDetector.cc.
References advanceCycleLazyInline().
|
inline |
Simulates a cycle advance and reports a conflict if detected.
Inlineable optimized version for compiled simulation and benchmarking.
Definition at line 230 of file FSAFUResourceConflictDetector.cc.
References FSAFUResourceConflictDetectorPimpl::currentState_, FSAFUResourceConflictDetectorPimpl::nextState_, FSAFUResourceConflictDetectorPimpl::NOP, and pimpl_.
|
inline |
Simulates a cycle advance and reports a conflict if detected.
Inlineable optimized version for compiled simulation and benchmarking.
Definition at line 253 of file FSAFUResourceConflictDetector.cc.
References FSAFUResourceConflictDetectorPimpl::currentState_, FSAFUResourceConflictDetectorPimpl::fsa_, FSAFUResourceConflictDetectorPimpl::nextState_, FSAFUResourceConflictDetectorPimpl::NOP, pimpl_, FUFiniteStateAutomaton::resolveState(), FiniteStateAutomaton::transitions_, and FiniteStateAutomaton::UNKNOWN_STATE.
Referenced by advanceCycle().
void FSAFUResourceConflictDetector::initializeAllStates | ( | ) |
Initializes all states in the state machine.
By default, only the initial state is constructed and rest when visited the first time.
Definition at line 74 of file FSAFUResourceConflictDetector.cc.
References FUFiniteStateAutomaton::buildStateMachine(), FSAFUResourceConflictDetectorPimpl::fsa_, and pimpl_.
|
virtual |
The FSA FU model is considered to be idle when the FSA is at start state and there are no new operations issued at that state.
Reimplemented from FUResourceConflictDetector.
Definition at line 157 of file FSAFUResourceConflictDetector.cc.
References FSAFUResourceConflictDetectorPimpl::currentState_, FSAFUResourceConflictDetectorPimpl::fsa_, FSAFUResourceConflictDetectorPimpl::nextState_, pimpl_, and FiniteStateAutomaton::startState().
|
virtual |
Issues an operation and reports a conflict if detected.
id | The id of the operation to issue. |
Reimplemented from FUResourceConflictDetector.
Definition at line 99 of file FSAFUResourceConflictDetector.cc.
References issueOperationLazyInline().
Referenced by FSAFUResourceConflictDetector(), and reset().
bool FSAFUResourceConflictDetector::issueOperationInline | ( | OperationID | id | ) |
Issues an operation and reports a conflict if detected.
Inlineable optimized version for compiled simulation and benchmarking. All states are assumed initialized. For lazily initialized FSA, use issueOperationLazyInline(). This version has about balanced runtime for conflict and no-conflict cases for sensible benchmarking with random operation sequences.
id | The id of the operation to issue. |
Definition at line 184 of file FSAFUResourceConflictDetector.cc.
References FSAFUResourceConflictDetectorPimpl::currentState_, FSAFUResourceConflictDetectorPimpl::fsa_, FiniteStateAutomaton::ILLEGAL_STATE, FSAFUResourceConflictDetectorPimpl::nextState_, pimpl_, and FiniteStateAutomaton::transitions_.
bool FSAFUResourceConflictDetector::issueOperationLazyInline | ( | OperationID | id | ) |
Issues an operation and reports a conflict if detected.
Inlineable optimized version for compiled simulation and benchmarking. For lazily initialized FSA. Checks if a state is missing and constructs it if needed.
id | The id of the operation to issue. |
Definition at line 205 of file FSAFUResourceConflictDetector.cc.
References FSAFUResourceConflictDetectorPimpl::currentState_, FSAFUResourceConflictDetectorPimpl::fsa_, FiniteStateAutomaton::ILLEGAL_STATE, FSAFUResourceConflictDetectorPimpl::nextState_, pimpl_, FUFiniteStateAutomaton::resolveState(), FiniteStateAutomaton::transitions_, and FiniteStateAutomaton::UNKNOWN_STATE.
Referenced by issueOperation().
|
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.
operation | The OSAL Operation to find ID for. |
Reimplemented from FUResourceConflictDetector.
Definition at line 134 of file FSAFUResourceConflictDetector.cc.
References FSAFUResourceConflictDetectorPimpl::fsa_, operationName(), pimpl_, StringTools::stringToUpper(), and FiniteStateAutomaton::transitionIndex().
const char * FSAFUResourceConflictDetector::operationName | ( | OperationID | id | ) | const |
Returns the name of the operation associated to the given transition id.
id | The transition id. |
Definition at line 110 of file FSAFUResourceConflictDetector.cc.
References FSAFUResourceConflictDetectorPimpl::fsa_, pimpl_, and FiniteStateAutomaton::transitionName().
Referenced by operationID().
|
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 147 of file FSAFUResourceConflictDetector.cc.
References FSAFUResourceConflictDetectorPimpl::currentState_, FSAFUResourceConflictDetectorPimpl::fsa_, issueOperation(), FSAFUResourceConflictDetectorPimpl::NOP, pimpl_, and FiniteStateAutomaton::startState().
|
virtual |
Writes the state machine to a Graphviz dot file.
fileName | The file name. |
Definition at line 84 of file FSAFUResourceConflictDetector.cc.
References FSAFUResourceConflictDetectorPimpl::fsa_, pimpl_, and FiniteStateAutomaton::toDotString().
|
private |
Private implementation in a separate source file.
Definition at line 77 of file FSAFUResourceConflictDetector.hh.
Referenced by advanceCycleInline(), advanceCycleLazyInline(), FSAFUResourceConflictDetector(), initializeAllStates(), isIdle(), issueOperationInline(), issueOperationLazyInline(), operationID(), operationName(), reset(), writeToDotFile(), and ~FSAFUResourceConflictDetector().