OpenASIP  2.0
TerminalFUPort.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2011 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 TerminalFUPort.hh
26  *
27  * Declaration of TerminalFUPort class.
28  *
29  * @author Ari Metsähalme 2005
30  * @author Pekka Jääskeläinen 2008,2011
31  * @note rating: red
32  */
33 
34 #ifndef TTA_TERMINAL_FU_PORT_HH
35 #define TTA_TERMINAL_FU_PORT_HH
36 
37 #include "Exception.hh"
38 #include "Terminal.hh"
39 #include "ProgramOperation.hh"
40 
41 namespace TTAMachine {
42  class HWOperation;
43  class BaseFUPort;
44  class FUPort;
45 }
46 
47 namespace TTAProgram {
48 
49 /**
50  * Represents an input or output port of a function unit and (when
51  * applicable) the operation code written into it.
52  *
53  * Notice that, in principle, operation codes can be written into FU output
54  * ports.
55  */
56 class TerminalFUPort : public Terminal {
57 public:
59  const TTAMachine::FUPort& opcodeSettingPort,
60  const TTAMachine::HWOperation& opcode);
61 
64  virtual ~TerminalFUPort();
65 
66  virtual bool isOpcodeSetting() const;
67 
68  virtual bool isTriggering() const;
69 
70  virtual bool isFUPort() const;
71  virtual bool isRA() const;
72 
73  virtual const TTAMachine::FunctionUnit& functionUnit() const;
74  virtual Operation& operation() const;
75  virtual Operation& hintOperation() const;
76  // sets the "hint operation" for moves which are not opcode setting
77  // but are known to be part of an operation execution
78  virtual void setOperation(const TTAMachine::HWOperation& hwOp);
79  void setHintOperation(const char* name);
80 
81  virtual int operationIndex() const;
82  virtual void setOperationIndex(int index) { opIndex_ = index; }
83  virtual const TTAMachine::Port& port() const;
84  virtual Terminal* copy() const;
85  virtual bool equals(const Terminal& other) const;
86 
87  virtual const TTAMachine::HWOperation* hwOperation() const;
88 
89  /// these methods are used to group terminals belonging to a single
90  /// program operation invocation
91  bool hasProgramOperation() const {
92  return po_ != NULL && po_.get() != NULL;
93  }
95  po_ = po;
96  }
98  return po_;
99  }
100 
101  virtual TCEString toString() const;
102 
103 
104 private:
105  // copy constructor used internally by copy();
106  TerminalFUPort(const TerminalFUPort& tfup);
107 
108  /// Assignment not allowed.
110  int findNewOperationIndex() const;
111 
112  /// Port of the unit.
114  /// Operation code transported to the port.
116  /// The OSAL operation.
118  /// Operation index.
119  int opIndex_;
120  /// The ProgramOperation this terminal belongs to, if applicable.
121  /// The instance is shared by all the TerminalFUs belonging to
122  /// the operation.
124 };
125 
126 }
127 
128 #endif
TTAProgram::TerminalFUPort::opcode_
Operation * opcode_
The OSAL operation.
Definition: TerminalFUPort.hh:117
TTAProgram
Definition: Estimator.hh:65
TTAProgram::TerminalFUPort::setOperationIndex
virtual void setOperationIndex(int index)
Definition: TerminalFUPort.hh:82
TTAProgram::TerminalFUPort::setProgramOperation
void setProgramOperation(ProgramOperationPtr po)
Definition: TerminalFUPort.hh:94
TTAProgram::TerminalFUPort::functionUnit
virtual const TTAMachine::FunctionUnit & functionUnit() const
Definition: TerminalFUPort.cc:202
TTAProgram::Terminal::index
virtual int index() const
Definition: Terminal.cc:274
TTAMachine::HWOperation
Definition: HWOperation.hh:52
Exception.hh
TTAProgram::TerminalFUPort::TerminalFUPort
TerminalFUPort(const TTAMachine::FUPort &opcodeSettingPort, const TTAMachine::HWOperation &opcode)
Definition: TerminalFUPort.cc:72
TTAProgram::TerminalFUPort::isTriggering
virtual bool isTriggering() const
Definition: TerminalFUPort.cc:191
TTAProgram::TerminalFUPort::copy
virtual Terminal * copy() const
Definition: TerminalFUPort.cc:305
TTAProgram::TerminalFUPort::port_
const TTAMachine::BaseFUPort & port_
Port of the unit.
Definition: TerminalFUPort.hh:113
TTAProgram::TerminalFUPort::toString
virtual TCEString toString() const
Definition: TerminalFUPort.cc:384
TTAMachine::BaseFUPort
Definition: BaseFUPort.hh:44
TTAProgram::TerminalFUPort::operation_
const TTAMachine::HWOperation * operation_
Operation code transported to the port.
Definition: TerminalFUPort.hh:115
TTAProgram::TerminalFUPort::equals
virtual bool equals(const Terminal &other) const
Definition: TerminalFUPort.cc:316
TTAProgram::TerminalFUPort::operation
virtual Operation & operation() const
Definition: TerminalFUPort.cc:213
TTAProgram::TerminalFUPort::isRA
virtual bool isRA() const
Definition: TerminalFUPort.cc:168
Terminal.hh
TTAProgram::TerminalFUPort::setHintOperation
void setHintOperation(const char *name)
Definition: TerminalFUPort.cc:270
ProgramOperationPtr
std::shared_ptr< ProgramOperation > ProgramOperationPtr
Definition: MoveNode.hh:52
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAProgram::TerminalFUPort::isFUPort
virtual bool isFUPort() const
Definition: TerminalFUPort.cc:158
TTAProgram::TerminalFUPort::hintOperation
virtual Operation & hintOperation() const
Definition: TerminalFUPort.cc:262
TTAMachine::FUPort
Definition: FUPort.hh:46
TTAProgram::TerminalFUPort::operationIndex
virtual int operationIndex() const
Definition: TerminalFUPort.cc:238
TTAProgram::TerminalFUPort::opIndex_
int opIndex_
Operation index.
Definition: TerminalFUPort.hh:119
TTAMachine::Port
Definition: Port.hh:54
TTAProgram::TerminalFUPort::operator=
TerminalFUPort & operator=(const TerminalFUPort &)
Assignment not allowed.
TTAProgram::TerminalFUPort::port
virtual const TTAMachine::Port & port() const
Definition: TerminalFUPort.cc:291
TTAProgram::TerminalFUPort::~TerminalFUPort
virtual ~TerminalFUPort()
Definition: TerminalFUPort.cc:148
TTAProgram::TerminalFUPort::isOpcodeSetting
virtual bool isOpcodeSetting() const
Definition: TerminalFUPort.cc:180
TTAProgram::TerminalFUPort::setOperation
virtual void setOperation(const TTAMachine::HWOperation &hwOp)
Definition: TerminalFUPort.cc:278
Operation
Definition: Operation.hh:59
TTAProgram::TerminalFUPort
Definition: TerminalFUPort.hh:56
ProgramOperation.hh
TTAProgram::TerminalFUPort::hasProgramOperation
bool hasProgramOperation() const
these methods are used to group terminals belonging to a single program operation invocation
Definition: TerminalFUPort.hh:91
TTAProgram::TerminalFUPort::po_
ProgramOperationPtr po_
The ProgramOperation this terminal belongs to, if applicable. The instance is shared by all the Termi...
Definition: TerminalFUPort.hh:123
TTAProgram::TerminalFUPort::programOperation
ProgramOperationPtr programOperation() const
Definition: TerminalFUPort.hh:97
TCEString
Definition: TCEString.hh:53
TTAProgram::TerminalFUPort::hwOperation
virtual const TTAMachine::HWOperation * hwOperation() const
Definition: TerminalFUPort.cc:379
TTAProgram::Terminal
Definition: Terminal.hh:60
TTAMachine
Definition: Assembler.hh:48
TTAProgram::TerminalFUPort::findNewOperationIndex
int findNewOperationIndex() const
Definition: TerminalFUPort.cc:366