OpenASIP
2.0
|
#include <OperationDAGBehavior.hh>
Classes | |
struct | SimulationStep |
Public Member Functions | |
OperationDAGBehavior (OperationDAG &dag, int operandCount, const Operation &parent=NullOperation::instance()) | |
virtual | ~OperationDAGBehavior () |
virtual bool | simulateTrigger (SimValue **io, OperationContext &context) const override |
virtual bool | areValid (const InputOperandVector &inputs, const OperationContext &context) const override |
virtual bool | lateResult (SimValue **io, OperationContext &context) const |
virtual void | createState (OperationContext &context) const override |
virtual void | deleteState (OperationContext &context) const override |
virtual const char * | stateName () const override |
virtual bool | canBeSimulated () const override |
![]() | |
virtual void | writeOutput (const char *text) const |
OperationBehavior () | |
OperationBehavior (const Operation &parent) | |
virtual | ~OperationBehavior () |
Private Attributes | |
OperationDAG & | dag_ |
int | operandCount_ |
Number of operands of this operation. More... | |
SimValue * | ios_ |
Table of parameters for simulate trigger. More... | |
std::vector< SimulationStep > | simulationSteps_ |
std::vector< SimValue * > | cleanUpTable_ |
Contain list of pointers to delete in destructor. More... | |
bool | cycleFound_ |
For checking if there is cyclic dependency in DAG. More... | |
Additional Inherited Members | |
![]() | |
typedef std::vector< SimValue > | InputOperandVector |
Input operand type for areValid() More... | |
![]() | |
const Operation & | parent_ |
Implementation of OperationBehavior which uses OperationDAG for execution of operation.
Definition at line 54 of file OperationDAGBehavior.hh.
OperationDAGBehavior::OperationDAGBehavior | ( | OperationDAG & | dag, |
int | operandCount, | ||
const Operation & | parent = NullOperation::instance() |
||
) |
Initilized class to be easier to simulate.
Basically goes through DAG and schedules operation nodes to calculation levels.
Definition at line 53 of file OperationDAGBehavior.cc.
References assert, cleanUpTable_, dag_, OperationDAGEdge::dstOperand(), BoostGraph< GraphNode, GraphEdge >::headNode(), BoostGraph< GraphNode, GraphEdge >::inDegree(), BoostGraph< GraphNode, GraphEdge >::inEdge(), ios_, BoostGraph< GraphNode, GraphEdge >::node(), BoostGraph< GraphNode, GraphEdge >::nodeCount(), Operation::numberOfInputs(), Operation::numberOfOutputs(), OperationDAGBehavior::SimulationStep::op, operandCount_, TerminalNode::operandIndex(), BoostGraph< GraphNode, GraphEdge >::outDegree(), BoostGraph< GraphNode, GraphEdge >::outEdge(), OperationDAGBehavior::SimulationStep::params, OperationNode::referencedOperation(), simulationSteps_, OperationDAGEdge::srcOperand(), BoostGraph< GraphNode, GraphEdge >::tailNode(), and ConstantNode::value().
|
virtual |
Destructor.
Definition at line 208 of file OperationDAGBehavior.cc.
References cleanUpTable_, ios_, and simulationSteps_.
|
overridevirtual |
Checks that the input operands for the OperationDag are valid.
Reimplemented from OperationBehavior.
Definition at line 257 of file OperationDAGBehavior.cc.
References assert, OperationContext::branchDelayCycles(), SimValue::deepCopy(), ios_, OperationContext::programCounter(), OperationContext::returnAddress(), and simulationSteps_.
|
overridevirtual |
If behavior can be simulated.
Check that every node can be simulated and recognize cyclic depency.
Reimplemented from OperationBehavior.
Definition at line 372 of file OperationDAGBehavior.cc.
References Operation::canBeSimulated(), cycleFound_, dag_, OperationDAG::isNull(), BoostGraph< GraphNode, GraphEdge >::node(), BoostGraph< GraphNode, GraphEdge >::nodeCount(), and OperationNode::referencedOperation().
|
overridevirtual |
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.
context | The operation context to add the state to. |
Reimplemented from OperationBehavior.
Definition at line 334 of file OperationDAGBehavior.cc.
|
overridevirtual |
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.
context | The operation context to delete the state from. |
Reimplemented from OperationBehavior.
Definition at line 348 of file OperationDAGBehavior.cc.
|
virtual |
Checks whether any of the pending results of an operation initiated in earlier cycle is ready.
io | The results of the operation. |
context | The operation context affecting the operation results. |
Definition at line 317 of file OperationDAGBehavior.cc.
|
overridevirtual |
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.
io | The input operands and the results of the operation. |
context | The operation context affecting the operation results. |
Exception | Depends on the implementation. |
Implements OperationBehavior.
Definition at line 234 of file OperationDAGBehavior.cc.
References SimValue::deepCopy(), ios_, operandCount_, and simulationSteps_.
|
overridevirtual |
Returns the name of the state of this operation behavior.
By default returns an empty string which denotes that there is no state.
Reimplemented from OperationBehavior.
Definition at line 359 of file OperationDAGBehavior.cc.
|
private |
Contain list of pointers to delete in destructor.
Definition at line 96 of file OperationDAGBehavior.hh.
Referenced by OperationDAGBehavior(), and ~OperationDAGBehavior().
|
mutableprivate |
For checking if there is cyclic dependency in DAG.
Definition at line 99 of file OperationDAGBehavior.hh.
Referenced by canBeSimulated().
|
private |
Definition at line 84 of file OperationDAGBehavior.hh.
Referenced by canBeSimulated(), and OperationDAGBehavior().
|
private |
Table of parameters for simulate trigger.
Definition at line 90 of file OperationDAGBehavior.hh.
Referenced by areValid(), OperationDAGBehavior(), simulateTrigger(), and ~OperationDAGBehavior().
|
private |
Number of operands of this operation.
Definition at line 87 of file OperationDAGBehavior.hh.
Referenced by OperationDAGBehavior(), and simulateTrigger().
|
private |
Definition at line 93 of file OperationDAGBehavior.hh.
Referenced by areValid(), OperationDAGBehavior(), simulateTrigger(), and ~OperationDAGBehavior().