OpenASIP
2.0
|
#include <OperationBehaviorProxy.hh>
Public Member Functions | |
OperationBehaviorProxy (Operation &targetOperation, OperationBehaviorLoader &loader, bool alwaysReloadBehavior=false) | |
virtual | ~OperationBehaviorProxy () |
virtual bool | simulateTrigger (SimValue **io, OperationContext &context) const |
virtual bool | canBeSimulated () const |
virtual void | createState (OperationContext &context) const |
virtual void | deleteState (OperationContext &context) const |
virtual void | setAlwaysReloadBehavior (bool f) |
void | uninitializeBehavior () const |
Public Member Functions inherited from OperationBehavior | |
virtual bool | areValid (const InputOperandVector &inputs, const OperationContext &context) const |
virtual const char * | stateName () const |
virtual void | writeOutput (const char *text) const |
OperationBehavior () | |
OperationBehavior (const Operation &parent) | |
virtual | ~OperationBehavior () |
Private Member Functions | |
OperationBehaviorProxy (const OperationBehaviorProxy &) | |
Copying not allowed. More... | |
OperationBehaviorProxy & | operator= (const OperationBehaviorProxy &) |
Assignment not allowed. More... | |
void | initializeBehavior () const |
Private Attributes | |
Operation * | target_ |
Operation that owns this proxy;. More... | |
OperationBehaviorLoader * | loader_ |
Used to load behavior model for operation. More... | |
bool | initialized_ |
Flag indicating whether proxy is initialized or not. More... | |
std::set< OperationDAGBehavior * > | cleanUs_ |
Clean up list for created OperationDAGBehaviors. More... | |
bool | alwaysReloadBehavior_ |
If this is true, the behavior is always (re)loaded from the dynamic library or the DAG instead of loading it once and reusing in the future calls. More... | |
bool | alreadyCreatingState_ |
Helpers variable to catch infinite recursive function call due to missing or undefined operation behavior. More... | |
Additional Inherited Members | |
Public Types inherited from OperationBehavior | |
typedef std::vector< SimValue > | InputOperandVector |
Input operand type for areValid() More... | |
Protected Attributes inherited from OperationBehavior | |
const Operation & | parent_ |
This class is used to create a behavior model of an operation.
A first time operation calls simulateTrigger() proxy creates the appropriate operation behavior model for the operation. Proxy replaces itself in the operation with the newly created behavior model. That new model then executes all simulation functions.
Definition at line 58 of file OperationBehaviorProxy.hh.
OperationBehaviorProxy::OperationBehaviorProxy | ( | Operation & | targetOperation, |
OperationBehaviorLoader & | loader, | ||
bool | alwaysReloadBehavior = false |
||
) |
Constructor.
Registers the operation for which this proxy represents the behavior model. Registers the operation behavior loader that is used to find the appropriate behavior model of the operation.
targetOperation | Target operation for proxy. |
loader | Operation behavior loader for the proxy. |
Definition at line 56 of file OperationBehaviorProxy.cc.
|
virtual |
|
private |
Copying not allowed.
|
virtual |
Imports operation behavior model for the operation that owns this proxy and then delegates the work to that imported model.
After initializing the operation with imported operation behavior model proxy has done its job.
Reimplemented from OperationBehavior.
Definition at line 162 of file OperationBehaviorProxy.cc.
References alwaysReloadBehavior_, Operation::behavior(), Operation::canBeSimulated(), initializeBehavior(), target_, and uninitializeBehavior().
|
virtual |
Imports operation behavior model for the operation that owns this proxy and then delegates the work to that imported model.
After initializing the operation with imported operation behavior model proxy has done its job.
context | The operation context to add the state in. |
Reimplemented from OperationBehavior.
Definition at line 111 of file OperationBehaviorProxy.cc.
References __func__, alreadyCreatingState_, alwaysReloadBehavior_, Operation::createState(), initializeBehavior(), Operation::name(), target_, and uninitializeBehavior().
|
virtual |
Imports operation behavior model for the operation that owns this proxy and then delegates the work to that imported model.
After initializing the operation with imported operation behavior model proxy has done its job.
context | The operation context to delete the state from. |
Reimplemented from OperationBehavior.
Definition at line 145 of file OperationBehaviorProxy.cc.
References alwaysReloadBehavior_, Operation::deleteState(), initializeBehavior(), target_, and uninitializeBehavior().
|
private |
Initializes the operation that owns this proxy with an operation behavior model.
Proxy replaces itself with the imported operation behavior model. After that proxy methods are never called.
This method is executed only once. After that, this function does nothing. This function may abort the program, if error condition occurs while operation behavior model is imported.
DynamicLibraryException | Leaked from importBehavior in case behavior file was invalid. |
Definition at line 195 of file OperationBehaviorProxy.cc.
References cleanUs_, Operation::dag(), Operation::dagCount(), OperationBehaviorLoader::importBehavior(), initialized_, loader_, Operation::numberOfInputs(), Operation::numberOfOutputs(), Operation::setBehavior(), and target_.
Referenced by canBeSimulated(), createState(), deleteState(), and simulateTrigger().
|
private |
Assignment not allowed.
|
inlinevirtual |
Definition at line 76 of file OperationBehaviorProxy.hh.
References alwaysReloadBehavior_.
Referenced by SimulateDialog::~SimulateDialog().
|
virtual |
Imports operation behavior model for the operation that owns this proxy and then delegates the work to that imported model.
After initializing the operation with imported operation behavior model proxy has done its job.
io | The input and output operands. |
context | The operation context. |
IllegalOperationBehavior | If trigger command lacks return statement. |
Implements OperationBehavior.
Definition at line 91 of file OperationBehaviorProxy.cc.
References alwaysReloadBehavior_, initializeBehavior(), Operation::simulateTrigger(), target_, and uninitializeBehavior().
void OperationBehaviorProxy::uninitializeBehavior | ( | ) | const |
Uninitializes the behavior description from the operation so it will be reloaded again when a behavior method is called the next time.
Definition at line 244 of file OperationBehaviorProxy.cc.
References cleanUs_, OperationBehaviorLoader::freeBehavior(), initialized_, loader_, Operation::setBehavior(), and target_.
Referenced by canBeSimulated(), createState(), deleteState(), simulateTrigger(), and SimulateDialog::~SimulateDialog().
|
mutableprivate |
Helpers variable to catch infinite recursive function call due to missing or undefined operation behavior.
Definition at line 101 of file OperationBehaviorProxy.hh.
Referenced by createState().
|
private |
If this is true, the behavior is always (re)loaded from the dynamic library or the DAG instead of loading it once and reusing in the future calls.
Definition at line 98 of file OperationBehaviorProxy.hh.
Referenced by canBeSimulated(), createState(), deleteState(), setAlwaysReloadBehavior(), and simulateTrigger().
|
mutableprivate |
Clean up list for created OperationDAGBehaviors.
Definition at line 94 of file OperationBehaviorProxy.hh.
Referenced by initializeBehavior(), uninitializeBehavior(), and ~OperationBehaviorProxy().
|
mutableprivate |
Flag indicating whether proxy is initialized or not.
Definition at line 92 of file OperationBehaviorProxy.hh.
Referenced by initializeBehavior(), and uninitializeBehavior().
|
private |
Used to load behavior model for operation.
Definition at line 90 of file OperationBehaviorProxy.hh.
Referenced by initializeBehavior(), and uninitializeBehavior().
|
private |
Operation that owns this proxy;.
Definition at line 88 of file OperationBehaviorProxy.hh.
Referenced by canBeSimulated(), createState(), deleteState(), initializeBehavior(), simulateTrigger(), and uninitializeBehavior().