OpenASIP 2.2
Loading...
Searching...
No Matches
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
40class ObjectState;
41class Operand;
42
43namespace TTAMachine {
44
45class FunctionUnit;
46class ExecutionPipeline;
47class FUPort;
48
49/**
50 * Represents an operation of the function unit.
51 */
52class HWOperation : public SubComponent {
53public:
54 HWOperation(const std::string& name, FunctionUnit& parent);
55 HWOperation(const ObjectState* state, FunctionUnit& parent);
57
58 const std::string& name() const;
59 virtual void setName(const std::string& name);
60
61 FunctionUnit* parentUnit() 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
92private:
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
std::string name_
Name of the operation.
ExecutionPipeline * pipeline_
Pipeline of the operation.
ExecutionPipeline * pipeline() const
virtual void bindPort(int operand, const FUPort &port)
static const std::string OSKEY_NAME
ObjectState attribute key for name of the operation.
virtual void loadState(const ObjectState *state)
virtual void unbindPort(const FUPort &port)
virtual FUPort * port(int operand) const
virtual void setName(const std::string &name)
static const std::string OSKEY_PORT
ObjectState attribute key for port name.
int io(const FUPort &port) const
int slack(int input) const
virtual ObjectState * saveState() const
static const std::string OSKEY_OPERAND
ObjectState attribute key for operand index.
OperandBindingMap operandBinding_
Maps operands of operation to particular ports of the parent unit.
std::map< int, const FUPort * > OperandBindingMap
Map for mapping operand indexes to FUPorts.
const std::string & name() const
bool isBound(const FUPort &port) const
static const std::string OSNAME_OPERAND_BINDING
ObjectState name for an operand binding.
FunctionUnit * parentUnit() const
static const std::string OSNAME_OPERATION
ObjectState name for HWOperation.
FunctionUnit * parent_
The parent unit.