OpenASIP  2.0
HWOperation.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 HWOperation.hh
26  *
27  * Declaration of HWOperation class.
28  *
29  * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30  */
31 
32 #ifndef TTA_HW_OPERATION_HH
33 #define TTA_HW_OPERATION_HH
34 
35 #include <string>
36 #include <map>
37 
38 #include "MachinePart.hh"
39 
40 class ObjectState;
41 class Operand;
42 
43 namespace TTAMachine {
44 
45 class FunctionUnit;
46 class ExecutionPipeline;
47 class FUPort;
48 
49 /**
50  * Represents an operation of the function unit.
51  */
52 class HWOperation : public SubComponent {
53 public:
54  HWOperation(const std::string& name, FunctionUnit& parent);
55  HWOperation(const ObjectState* state, FunctionUnit& parent);
56  ~HWOperation();
57 
58  const std::string& name() const;
59  virtual void setName(const std::string& name);
60 
61  FunctionUnit* parentUnit() const;
62  ExecutionPipeline* pipeline() const;
63 
64  int latency() const;
65  int latency(int output) const;
66  int slack(int input) const;
67 
68  virtual void bindPort(int operand, const FUPort& port);
69  virtual void unbindPort(const FUPort& port);
70  int operandCount() const;
71  virtual FUPort* port(int operand) const;
72  bool isBound(const FUPort& port) const;
73  bool isBound(int operand) const;
74  int io(const FUPort& port) const;
75  int numberOfInputs() const;
76  int numberOfOutputs() const;
77 
78  virtual ObjectState* saveState() const;
79  virtual void loadState(const ObjectState* state);
80 
81  /// ObjectState name for HWOperation.
82  static const std::string OSNAME_OPERATION;
83  /// ObjectState attribute key for name of the operation.
84  static const std::string OSKEY_NAME;
85  /// ObjectState name for an operand binding.
86  static const std::string OSNAME_OPERAND_BINDING;
87  /// ObjectState attribute key for operand index.
88  static const std::string OSKEY_OPERAND;
89  /// ObjectState attribute key for port name.
90  static const std::string OSKEY_PORT;
91 
92 private:
93  /// Map for mapping operand indexes to FUPorts.
94  typedef std::map<int, const FUPort*> OperandBindingMap;
95 
96  /// Name of the operation.
97  std::string name_;
98  /// Pipeline of the operation.
100  /// The parent unit.
102  /// Maps operands of operation to particular ports of the parent unit.
104 
105 };
106 }
107 
108 #endif
Operand
Definition: Operand.hh:52
TTAMachine::HWOperation::OSKEY_OPERAND
static const std::string OSKEY_OPERAND
ObjectState attribute key for operand index.
Definition: HWOperation.hh:88
TTAMachine::HWOperation::OSNAME_OPERATION
static const std::string OSNAME_OPERATION
ObjectState name for HWOperation.
Definition: HWOperation.hh:82
TTAMachine::HWOperation::loadState
virtual void loadState(const ObjectState *state)
Definition: HWOperation.cc:454
TTAMachine::SubComponent
Definition: MachinePart.hh:168
TTAMachine::HWOperation
Definition: HWOperation.hh:52
TTAMachine::HWOperation::OSKEY_NAME
static const std::string OSKEY_NAME
ObjectState attribute key for name of the operation.
Definition: HWOperation.hh:84
TTAMachine::HWOperation::bindPort
virtual void bindPort(int operand, const FUPort &port)
Definition: HWOperation.cc:269
TTAMachine::HWOperation::saveState
virtual ObjectState * saveState() const
Definition: HWOperation.cc:424
ObjectState
Definition: ObjectState.hh:59
MachinePart.hh
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::HWOperation::OperandBindingMap
std::map< int, const FUPort * > OperandBindingMap
Map for mapping operand indexes to FUPorts.
Definition: HWOperation.hh:94
TTAMachine::HWOperation::port
virtual FUPort * port(int operand) const
Definition: HWOperation.cc:320
TTAMachine::FUPort
Definition: FUPort.hh:46
TTAMachine::HWOperation::OSKEY_PORT
static const std::string OSKEY_PORT
ObjectState attribute key for port name.
Definition: HWOperation.hh:90
TTAMachine::HWOperation::io
int io(const FUPort &port) const
Definition: HWOperation.cc:364
TTAMachine::HWOperation::name
const std::string & name() const
Definition: HWOperation.cc:141
TTAMachine::HWOperation::name_
std::string name_
Name of the operation.
Definition: HWOperation.hh:97
TTAMachine::HWOperation::unbindPort
virtual void unbindPort(const FUPort &port)
Definition: HWOperation.cc:296
TTAMachine::HWOperation::isBound
bool isBound(const FUPort &port) const
Definition: HWOperation.cc:338
TTAMachine::HWOperation::~HWOperation
~HWOperation()
Definition: HWOperation.cc:127
TTAMachine::HWOperation::numberOfInputs
int numberOfInputs() const
Definition: HWOperation.cc:384
TTAMachine::HWOperation::slack
int slack(int input) const
Definition: HWOperation.cc:248
TTAMachine::HWOperation::OSNAME_OPERAND_BINDING
static const std::string OSNAME_OPERAND_BINDING
ObjectState name for an operand binding.
Definition: HWOperation.hh:86
TTAMachine::HWOperation::pipeline_
ExecutionPipeline * pipeline_
Pipeline of the operation.
Definition: HWOperation.hh:99
TTAMachine::HWOperation::operandCount
int operandCount() const
Definition: HWOperation.cc:306
TTAMachine::HWOperation::parentUnit
FunctionUnit * parentUnit() const
Definition: HWOperation.cc:190
TTAMachine::HWOperation::HWOperation
HWOperation(const std::string &name, FunctionUnit &parent)
Definition: HWOperation.cc:67
TTAMachine::HWOperation::parent_
FunctionUnit * parent_
The parent unit.
Definition: HWOperation.hh:101
TTAMachine::HWOperation::pipeline
ExecutionPipeline * pipeline() const
Definition: HWOperation.cc:201
TTAMachine::ExecutionPipeline
Definition: ExecutionPipeline.hh:55
TTAMachine::HWOperation::numberOfOutputs
int numberOfOutputs() const
Definition: HWOperation.cc:404
TTAMachine::HWOperation::latency
int latency() const
Definition: HWOperation.cc:216
TTAMachine
Definition: Assembler.hh:48
TTAMachine::HWOperation::operandBinding_
OperandBindingMap operandBinding_
Maps operands of operation to particular ports of the parent unit.
Definition: HWOperation.hh:103
TTAMachine::HWOperation::setName
virtual void setName(const std::string &name)
Definition: HWOperation.cc:155