OpenASIP  2.0
OperationExecutor.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2010 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 OperationExecutor.cc
26  *
27  * Definition of OperationExecutor class.
28  *
29  * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30  * @author Pekka Jääskeläinen 2005,2010 (pjaaskel-no.spam-cs.tut.fi)
31  * @note rating: red
32  */
33 
34 #include <string>
35 
36 #include "OperationExecutor.hh"
37 #include "Operation.hh"
38 #include "FUState.hh"
39 #include "PortState.hh"
40 
41 using std::string;
42 
43 /**
44  * Constructor.
45  *
46  * @param parent Parent FUState.
47  */
49  hasPendingOperations_(false), parent_(&parent) {
50 }
51 
52 /**
53  * Destructor.
54  */
56 }
57 
58 /**
59  * Adds binding of operand to a port.
60  *
61  * @param io Operand index.
62  * @param port Port to be bind.
63  * @exception IllegalRegistration If parent of the port is not the same as the
64  * parent of the executor.
65  */
66 void
68  if (io > static_cast<int>(bindings_.size()) - 1) {
69  bindings_.resize(io, NULL);
70  }
71 
72  if (&port.parent() != parent_) {
73  string msg = "Parent of the port and executors differs";
74  throw IllegalRegistration(__FILE__, __LINE__, __func__, msg);
75  }
76 
77  if (bindings_[io - 1] != NULL) {
78  string msg = "Operand with given index has been already bound"
79  " to a port";
80  throw IllegalRegistration(__FILE__, __LINE__, __func__, msg);
81  }
82 
83  bindings_[io - 1] = &port;
84 }
85 
86 void
88  return;
89 }
OperationExecutor::addBinding
void addBinding(int io, PortState &port)
Definition: OperationExecutor.cc:67
OperationExecutor::parent_
FUState * parent_
Parent of the executor.
Definition: OperationExecutor.hh:79
OperationExecutor::OperationExecutor
OperationExecutor()
Definition: OperationExecutor.hh:51
OperationExecutor::reset
virtual void reset()
Definition: OperationExecutor.cc:87
FUState.hh
PortState::parent
virtual FUState & parent() const
Definition: PortState.cc:80
OperationExecutor::~OperationExecutor
virtual ~OperationExecutor()
Definition: OperationExecutor.cc:55
FUState
Definition: FUState.hh:58
OperationExecutor.hh
OperationExecutor::bindings_
std::vector< PortState * > bindings_
PortStates that are bound to a certain input or output operand.
Definition: OperationExecutor.hh:70
__func__
#define __func__
Definition: Application.hh:67
Operation.hh
PortState
Definition: PortState.hh:51
IllegalRegistration
Definition: Exception.hh:532
false
find Finds info of the inner loops in the false
Definition: InnerLoopFinder.cc:81
PortState.hh