OpenASIP  2.0
SimpleOperationExecutor.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 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 SimpleOperationExecutor.hh
26  *
27  * Declaration of SimpleOperationExecutor class.
28  *
29  * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30  * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
31  * @note rating: red
32  */
33 
34 #ifndef TTA_SIMPLE_OPERATION_EXECUTOR_HH
35 #define TTA_SIMPLE_OPERATION_EXECUTOR_HH
36 
37 #include <string>
38 
39 #include "OperationExecutor.hh"
40 #include "SequenceTools.hh"
41 #include "SimValue.hh"
42 
43 class OperationContext;
44 
45 /**
46  * Simple implementation of OperationExecutor.
47  */
49 public:
51  int latency,
52  FUState& parent);
53  virtual ~SimpleOperationExecutor();
54 
55  virtual int latency() const;
56  virtual void startOperation(Operation& op);
57 
58  virtual void advanceClock();
59  virtual OperationExecutor* copy();
60  virtual void setContext(OperationContext& context);
61 
62 private:
63  /// Assignment not allowed.
65 
66  /**
67  * Models one cell of the ring buffer of operations.
68  */
69  struct BufferCell {
70  /**
71  * Constructor.
72  */
74  operation_(NULL), ready_(false), boundOperation_(NULL) {}
75  /// Inputs and outputs for the operation.
77  /// Original inputs and outputs of the operation.
78  /// @note the limitation on max io ports to
79  /// avoid dynamic allocation of the array.
81  /// Operation to be executed, set to NULL when results have been
82  /// moved to output ports.
84  /// Flag telling whether results are ready or not.
85  bool ready_;
86  /// Tells the operation for which the bindings are initialized in
87  /// this "pipeline cell", NULL in case bindings have not been
88  /// initialized.
90  };
91 
92  /// Ring buffer type for the pipeline slots.
93  typedef std::vector<BufferCell> Buffer;
94  /// Position of the ring buffer where to put the next triggered operation.
95  int nextSlot_;
96  /// Ring buffer for the pipeline slots.
98  /// Operation context.
100  /// Count of pending operations in the pipeline.
101  std::size_t pendingOperations_;
102 };
103 
104 #endif
SimpleOperationExecutor::latency
virtual int latency() const
Definition: SimpleOperationExecutor.cc:79
SimpleOperationExecutor::BufferCell::io_
SimValue * io_[EXECUTOR_MAX_OPERAND_COUNT]
Inputs and outputs for the operation.
Definition: SimpleOperationExecutor.hh:76
SimpleOperationExecutor::operator=
SimpleOperationExecutor & operator=(const SimpleOperationExecutor &)
Assignment not allowed.
SimpleOperationExecutor::buffer_
Buffer buffer_
Ring buffer for the pipeline slots.
Definition: SimpleOperationExecutor.hh:97
SimpleOperationExecutor::BufferCell
Definition: SimpleOperationExecutor.hh:69
SimpleOperationExecutor::advanceClock
virtual void advanceClock()
Definition: SimpleOperationExecutor.cc:138
OperationContext
Definition: OperationContext.hh:56
SimpleOperationExecutor::copy
virtual OperationExecutor * copy()
Definition: SimpleOperationExecutor.cc:169
EXECUTOR_MAX_OPERAND_COUNT
#define EXECUTOR_MAX_OPERAND_COUNT
Maximum count of operation operands supported by the executors. This is used to allocate some static ...
Definition: OperationExecutor.hh:84
SequenceTools.hh
SimpleOperationExecutor::BufferCell::ioOrig_
SimValue ioOrig_[EXECUTOR_MAX_OPERAND_COUNT]
Original inputs and outputs of the operation.
Definition: SimpleOperationExecutor.hh:80
SimValue
Definition: SimValue.hh:96
SimpleOperationExecutor::BufferCell::BufferCell
BufferCell()
Definition: SimpleOperationExecutor.hh:73
FUState
Definition: FUState.hh:58
SimpleOperationExecutor::SimpleOperationExecutor
SimpleOperationExecutor(int latency, FUState &parent)
Definition: SimpleOperationExecutor.cc:54
SimpleOperationExecutor::setContext
virtual void setContext(OperationContext &context)
Definition: SimpleOperationExecutor.cc:179
SimpleOperationExecutor::BufferCell::operation_
Operation * operation_
Operation to be executed, set to NULL when results have been moved to output ports.
Definition: SimpleOperationExecutor.hh:83
OperationExecutor.hh
SimpleOperationExecutor::context_
OperationContext * context_
Operation context.
Definition: SimpleOperationExecutor.hh:99
SimpleOperationExecutor::startOperation
virtual void startOperation(Operation &op)
Definition: SimpleOperationExecutor.cc:94
OperationExecutor
Definition: OperationExecutor.hh:49
Operation
Definition: Operation.hh:59
SimpleOperationExecutor::nextSlot_
int nextSlot_
Position of the ring buffer where to put the next triggered operation.
Definition: SimpleOperationExecutor.hh:95
SimpleOperationExecutor::~SimpleOperationExecutor
virtual ~SimpleOperationExecutor()
Definition: SimpleOperationExecutor.cc:70
OperationExecutor::parent
FUState & parent() const
SimpleOperationExecutor::pendingOperations_
std::size_t pendingOperations_
Count of pending operations in the pipeline.
Definition: SimpleOperationExecutor.hh:101
SimpleOperationExecutor::BufferCell::boundOperation_
Operation * boundOperation_
Tells the operation for which the bindings are initialized in this "pipeline cell",...
Definition: SimpleOperationExecutor.hh:89
false
find Finds info of the inner loops in the false
Definition: InnerLoopFinder.cc:81
SimValue.hh
SimpleOperationExecutor::BufferCell::ready_
bool ready_
Flag telling whether results are ready or not.
Definition: SimpleOperationExecutor.hh:85
SimpleOperationExecutor::Buffer
std::vector< BufferCell > Buffer
Ring buffer type for the pipeline slots.
Definition: SimpleOperationExecutor.hh:93
SimpleOperationExecutor
Definition: SimpleOperationExecutor.hh:48