OpenASIP  2.0
Public Types | Public Member Functions | Protected Attributes | List of all members
OperationBehavior Class Referenceabstract

#include <OperationBehavior.hh>

Inheritance diagram for OperationBehavior:
Inheritance graph
Collaboration diagram for OperationBehavior:
Collaboration graph

Public Types

typedef std::vector< SimValueInputOperandVector
 Input operand type for areValid() More...
 

Public Member Functions

virtual bool simulateTrigger (SimValue **io, OperationContext &context) const =0
 
virtual bool areValid (const InputOperandVector &inputs, const OperationContext &context) const
 
virtual void createState (OperationContext &context) const
 
virtual void deleteState (OperationContext &context) const
 
virtual const char * stateName () const
 
virtual bool canBeSimulated () const
 
virtual void writeOutput (const char *text) const
 
 OperationBehavior ()
 
 OperationBehavior (const Operation &parent)
 
virtual ~OperationBehavior ()
 

Protected Attributes

const Operationparent_
 

Detailed Description

Interface to access the behavior model of TTA operations.

This abstract class that is inherited by the custom operation behavior classes. Instances of user defined OperationBehavior derived classes are loaded run-time from dynamic library modules (plugins).

Definition at line 53 of file OperationBehavior.hh.

Member Typedef Documentation

◆ InputOperandVector

Input operand type for areValid()

Definition at line 57 of file OperationBehavior.hh.

Constructor & Destructor Documentation

◆ OperationBehavior() [1/2]

OperationBehavior::OperationBehavior ( )

Constructor with NULL parent.

Definition at line 52 of file OperationBehavior.cc.

54 }

◆ OperationBehavior() [2/2]

OperationBehavior::OperationBehavior ( const Operation parent)

Constructor with parent.

Definition at line 59 of file OperationBehavior.cc.

60  : parent_(parent) {
61 }

◆ ~OperationBehavior()

OperationBehavior::~OperationBehavior ( )
virtual

Destructor.

Definition at line 66 of file OperationBehavior.cc.

66  {
67 }

Member Function Documentation

◆ areValid()

bool OperationBehavior::areValid ( const InputOperandVector inputs,
const OperationContext context 
) const
virtual

The default implementation of input operand validation.

This always return true. This is meant to be overridden in derived classes when necessary.

Reimplemented in OperationDAGBehavior.

Definition at line 96 of file OperationBehavior.cc.

98  {
99 
100  return true;
101 }

Referenced by Operation::areValid().

◆ canBeSimulated()

bool OperationBehavior::canBeSimulated ( ) const
virtual

If behavior can be simulated.

Returns
true If simulation of behavior is possible.

Reimplemented in OperationDAGBehavior, and OperationBehaviorProxy.

Definition at line 162 of file OperationBehavior.cc.

162  {
163  return true;
164 }

Referenced by OperationPimpl::canBeSimulated().

◆ createState()

void OperationBehavior::createState ( OperationContext context) const
virtual

Creates the instance of operation state for this operation and adds it to its operation context.

By default this function does nothing (assumes that the operation has no state). If the operation context already contains the required operation state instance, nothing is done.

Parameters
contextThe operation context to add the state to.

Reimplemented in OperationDAGBehavior, and OperationBehaviorProxy.

Definition at line 127 of file OperationBehavior.cc.

127  {
128 }

Referenced by SimulateDialog::createState(), OperationPimpl::createState(), and OsalInterpreter::operation().

◆ deleteState()

void OperationBehavior::deleteState ( OperationContext context) const
virtual

Deletes the instance of operation state for this operation from its operation context.

By default this function does nothing (assumes that the operation has no state). If the operation context does not contain the required operation state instance, nothing is done.

Parameters
contextThe operation context to delete the state from.

Reimplemented in OperationDAGBehavior, and OperationBehaviorProxy.

Definition at line 141 of file OperationBehavior.cc.

141  {
142 }

Referenced by OperationPimpl::deleteState(), CmdReset::execute(), SimulateDialog::onReset(), and SimulateDialog::~SimulateDialog().

◆ simulateTrigger()

bool OperationBehavior::simulateTrigger ( SimValue **  io,
OperationContext context 
) const
pure virtual

Simulates the process of starting the execution of an operation.

Clients should invoke isTriggerLocking() before any attempt to call simulateTrigger() in current clock cycle. By default, an operation invocations are successful.

Parameters
ioThe input operands and the results of the operation.
contextThe operation context affecting the operation results.
Returns
bool True if all values could be computed, false otherwise.
Exceptions
ExceptionDepends on the implementation.

Implemented in OperationDAGBehavior, OperationBehaviorProxy, and NullOperationBehavior.

Definition at line 83 of file OperationBehavior.cc.

85  {
86  return true;
87 }

Referenced by OperationPimpl::simulateTrigger().

◆ stateName()

const char * OperationBehavior::stateName ( ) const
virtual

Returns the name of the state of this operation behavior.

By default returns an empty string which denotes that there is no state.

Returns
The state name for this operation behavior.

Reimplemented in OperationDAGBehavior.

Definition at line 152 of file OperationBehavior.cc.

152  {
153  return "";
154 }

◆ writeOutput()

void OperationBehavior::writeOutput ( const char *  text) const
virtual

Writes text to the output stream specified

Parameters
texttext to be written to the output stream

Definition at line 110 of file OperationBehavior.cc.

111  {
113 }

References OperationGlobals::outputStream().

Here is the call graph for this function:

Member Data Documentation

◆ parent_

const Operation& OperationBehavior::parent_
protected

Definition at line 80 of file OperationBehavior.hh.


The documentation for this class was generated from the following files:
NullOperation::instance
static NullOperation & instance()
OperationGlobals::outputStream
static std::ostream & outputStream()
Definition: OperationGlobals.cc:49
OperationBehavior::parent_
const Operation & parent_
Definition: OperationBehavior.hh:80