OpenASIP  2.0
OperationDAGBehavior.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2020 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file OperationDAGBehavior.hh
26  *
27  * Declaration of OperationDAGBehavior class.
28  *
29  * @author Mikael Lepistö 2007 (mikael.lepisto-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 
34 #ifndef TTA_OPERATION_DAG_BEHAVIOR_HH
35 #define TTA_OPERATION_DAG_BEHAVIOR_HH
36 
37 #include <vector>
38 #include <string>
39 #include <iostream>
40 
41 #include "Exception.hh"
42 #include "OperationBehavior.hh"
43 #include "OperationContext.hh"
44 #include "Operation.hh"
45 
46 class SimValue;
47 class OperationContext;
48 class OperationDAG;
49 
50 /**
51  * Implementation of OperationBehavior which uses OperationDAG for execution
52  * of operation.
53  */
55 public:
57  OperationDAG& dag,
58  int operandCount,
59  const Operation& parent = NullOperation::instance());
60  virtual ~OperationDAGBehavior();
61 
62  virtual bool simulateTrigger(
63  SimValue** io, OperationContext& context) const override;
64  virtual bool areValid(
65  const InputOperandVector& inputs,
66  const OperationContext& context) const override;
67 
68  virtual bool lateResult(
69  SimValue** io, OperationContext& context) const;
70 
71  virtual void createState(OperationContext& context) const override;
72  virtual void deleteState(OperationContext& context) const override;
73 
74  virtual const char* stateName() const override;
75 
76  virtual bool canBeSimulated() const override;
77 
78 private:
79  struct SimulationStep {
82  };
83 
85 
86  /// Number of operands of this operation.
88 
89  /// Table of parameters for simulate trigger.
91 
92  // Script for simulation
93  std::vector<SimulationStep> simulationSteps_;
94 
95  /// Contain list of pointers to delete in destructor
96  std::vector<SimValue*> cleanUpTable_;
97 
98  /// For checking if there is cyclic dependency in DAG.
99  mutable bool cycleFound_;
100 };
101 
102 #endif
OperationDAGBehavior
Definition: OperationDAGBehavior.hh:54
OperationDAGBehavior::areValid
virtual bool areValid(const InputOperandVector &inputs, const OperationContext &context) const override
Definition: OperationDAGBehavior.cc:257
Exception.hh
OperationContext
Definition: OperationContext.hh:56
OperationDAGBehavior::SimulationStep::params
SimValue ** params
Definition: OperationDAGBehavior.hh:81
OperationDAGBehavior::canBeSimulated
virtual bool canBeSimulated() const override
Definition: OperationDAGBehavior.cc:372
OperationDAGBehavior::stateName
virtual const char * stateName() const override
Definition: OperationDAGBehavior.cc:359
NullOperation::instance
static NullOperation & instance()
SimValue
Definition: SimValue.hh:96
OperationDAGBehavior::ios_
SimValue * ios_
Table of parameters for simulate trigger.
Definition: OperationDAGBehavior.hh:90
OperationDAGBehavior::cycleFound_
bool cycleFound_
For checking if there is cyclic dependency in DAG.
Definition: OperationDAGBehavior.hh:99
OperationDAG
Definition: OperationDAG.hh:43
OperationDAGBehavior::simulationSteps_
std::vector< SimulationStep > simulationSteps_
Definition: OperationDAGBehavior.hh:93
Operation.hh
OperationDAGBehavior::cleanUpTable_
std::vector< SimValue * > cleanUpTable_
Contain list of pointers to delete in destructor.
Definition: OperationDAGBehavior.hh:96
OperationDAGBehavior::lateResult
virtual bool lateResult(SimValue **io, OperationContext &context) const
Definition: OperationDAGBehavior.cc:317
Operation
Definition: Operation.hh:59
OperationDAGBehavior::createState
virtual void createState(OperationContext &context) const override
Definition: OperationDAGBehavior.cc:334
OperationDAGBehavior::~OperationDAGBehavior
virtual ~OperationDAGBehavior()
Definition: OperationDAGBehavior.cc:208
OperationBehavior::InputOperandVector
std::vector< SimValue > InputOperandVector
Input operand type for areValid()
Definition: OperationBehavior.hh:57
OperationDAGBehavior::simulateTrigger
virtual bool simulateTrigger(SimValue **io, OperationContext &context) const override
Definition: OperationDAGBehavior.cc:234
OperationBehavior.hh
OperationBehavior
Definition: OperationBehavior.hh:53
OperationDAGBehavior::SimulationStep
Definition: OperationDAGBehavior.hh:79
OperationDAGBehavior::deleteState
virtual void deleteState(OperationContext &context) const override
Definition: OperationDAGBehavior.cc:348
OperationDAGBehavior::SimulationStep::op
Operation * op
Definition: OperationDAGBehavior.hh:80
OperationDAGBehavior::dag_
OperationDAG & dag_
Definition: OperationDAGBehavior.hh:84
OperationContext.hh
OperationDAGBehavior::OperationDAGBehavior
OperationDAGBehavior(OperationDAG &dag, int operandCount, const Operation &parent=NullOperation::instance())
Definition: OperationDAGBehavior.cc:53
OperationDAGBehavior::operandCount_
int operandCount_
Number of operands of this operation.
Definition: OperationDAGBehavior.hh:87