OpenASIP  2.0
UniversalFunctionUnit.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 UniversalFunctionUnit.hh
26  *
27  * Declaration of UniversalFunctionUnit class.
28  *
29  * @author Lasse Laasonen 2004 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: yellow
31  */
32 
33 #ifndef TTA_UNIVERSAL_FUNCTION_UNIT_HH
34 #define TTA_UNIVERSAL_FUNCTION_UNIT_HH
35 
36 #include "FunctionUnit.hh"
37 
38 class Operation;
39 class OperationPool;
40 class SmartHWOperation;
41 
42 namespace TTAMachine {
43  class HWOperation;
44 }
45 /**
46  * UniversalFunctionUnit class represents a function unit which has
47  * all the operations of an operation pool. The operations are added
48  * on demand, not at construction.
49  */
51 public:
52  UniversalFunctionUnit(const std::string& name, OperationPool& opPool);
53  virtual ~UniversalFunctionUnit();
54 
55  virtual bool hasOperation(const std::string& name) const;
56  virtual TTAMachine::HWOperation* operation(const std::string& name) const;
57  virtual void addPipelineElement(TTAMachine::PipelineElement& element);
58  virtual void loadState(const ObjectState* state);
59 
60  int portCountWithWidth(int width) const;
61  TTAMachine::FUPort& portWithWidth(int index, int width) const;
62 
63  static bool is32BitOperation(const std::string& opName);
64 
65  /// Name of the 32 bit wide opcode setting port.
66  static const std::string OC_SETTING_PORT_32;
67  /// Name of the 64 bit wide opcode setting port.
68  static const std::string OC_SETTING_PORT_64;
69 
70 private:
72  void ensureInputPorts(int width, int count);
73  void ensureOutputPorts(int width, int count);
74 
75  /// Operation pool from which the operations are searched.
77  /// Table of names of 32 bit operations
78  static const std::string OPERATIONS_OF_32_BITS[];
79 
80 
81 };
82 
83 #endif
UniversalFunctionUnit::ensureInputPorts
void ensureInputPorts(int width, int count)
Definition: UniversalFunctionUnit.cc:271
UniversalFunctionUnit::operation
virtual TTAMachine::HWOperation * operation(const std::string &name) const
Definition: UniversalFunctionUnit.cc:102
UniversalFunctionUnit::OC_SETTING_PORT_32
static const std::string OC_SETTING_PORT_32
Name of the 32 bit wide opcode setting port.
Definition: UniversalFunctionUnit.hh:66
UniversalFunctionUnit::is32BitOperation
static bool is32BitOperation(const std::string &opName)
Definition: UniversalFunctionUnit.cc:358
UniversalFunctionUnit::portCountWithWidth
int portCountWithWidth(int width) const
Definition: UniversalFunctionUnit.cc:164
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
UniversalFunctionUnit::ensureOutputPorts
void ensureOutputPorts(int width, int count)
Definition: UniversalFunctionUnit.cc:322
TTAMachine::HWOperation
Definition: HWOperation.hh:52
UniversalFunctionUnit::portWithWidth
TTAMachine::FUPort & portWithWidth(int index, int width) const
Definition: UniversalFunctionUnit.cc:190
ObjectState
Definition: ObjectState.hh:59
UniversalFunctionUnit
Definition: UniversalFunctionUnit.hh:50
UniversalFunctionUnit::OC_SETTING_PORT_64
static const std::string OC_SETTING_PORT_64
Name of the 64 bit wide opcode setting port.
Definition: UniversalFunctionUnit.hh:68
SmartHWOperation
Definition: SmartHWOperation.hh:47
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::FUPort
Definition: FUPort.hh:46
UniversalFunctionUnit::OPERATIONS_OF_32_BITS
static const std::string OPERATIONS_OF_32_BITS[]
Table of names of 32 bit operations.
Definition: UniversalFunctionUnit.hh:78
Operation
Definition: Operation.hh:59
UniversalFunctionUnit::hasOperation
virtual bool hasOperation(const std::string &name) const
Definition: UniversalFunctionUnit.cc:85
UniversalFunctionUnit::addPipelineElement
virtual void addPipelineElement(TTAMachine::PipelineElement &element)
Definition: UniversalFunctionUnit.cc:131
TTAMachine::PipelineElement
Definition: PipelineElement.hh:46
UniversalFunctionUnit::opPool_
OperationPool & opPool_
Operation pool from which the operations are searched.
Definition: UniversalFunctionUnit.hh:76
UniversalFunctionUnit::loadState
virtual void loadState(const ObjectState *state)
Definition: UniversalFunctionUnit.cc:147
UniversalFunctionUnit::UniversalFunctionUnit
UniversalFunctionUnit(const std::string &name, OperationPool &opPool)
Definition: UniversalFunctionUnit.cc:64
UniversalFunctionUnit::~UniversalFunctionUnit
virtual ~UniversalFunctionUnit()
Definition: UniversalFunctionUnit.cc:71
OperationPool
Definition: OperationPool.hh:52
TTAMachine
Definition: Assembler.hh:48
FunctionUnit.hh
UniversalFunctionUnit::addSupportedOperation
SmartHWOperation & addSupportedOperation(const Operation &operation)
Definition: UniversalFunctionUnit.cc:228