OpenASIP  2.0
ResourceElement.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 ResourceElement.hh
26  *
27  * Declaration of ResourceElement class.
28  *
29  * @author Mikael Lepistö 2003 (tmlepist-no.spam-cs.tut.fi)
30  *
31  * @note rating: yellow
32  */
33 
34 #ifndef TTA_RESOURCE_ELEMENT_HH
35 #define TTA_RESOURCE_ELEMENT_HH
36 
37 #include "TPEFBaseType.hh"
38 #include "SectionElement.hh"
39 #include "SafePointer.hh"
40 #include "Chunk.hh"
41 
42 namespace TPEF {
43 
44 /**
45  * Resource table element.
46  */
48 public:
49 
50  /// Resource types
51  enum ResourceType {
52  MRT_NULL = 0x00, ///< Illegal undefined machine resource.
53  MRT_BUS = 0x01, ///< Transport bus.
54  MRT_UNIT = 0x02, ///< Function unit.
55  MRT_RF = 0x03, ///< Register file.
56  MRT_OP = 0x04, ///< Operation operand or function unit register.
57  MRT_IMM = 0x05, ///< Immediate unit.
58  MRT_SR = 0x06, ///< Special register.
59  MRT_PORT = 0x07 ///< Function unit port.
60  };
61 
62  /// Resource Id numbers that are reserved for some particular use.
64  UNIVERSAL_BUS = 0x00, ///< Universal bus.
65  UNIVERSAL_FU = 0x00, ///< Universal function unit.
66  ILLEGAL_RF = 0x00, ///< Illegal register file.
67  INT_RF = 0x80, ///< Universal integer register file.
68  BOOL_RF = 0x81, ///< Universal boolean register file.
69  FP_RF = 0x82, ///< Universal floating point register file.
70  UNIVERSAL_RF_MASK = 0x80, ///< Bit to check if registerfile is real or
71  ///< universal.
72  INLINE_IMM = 0x00 ///< Inline immediate unit id.
73  };
74 
75  /// Reserved string of return address special register
76  static const std::string RETURN_ADDRESS_NAME;
77 
79  virtual ~ResourceElement();
80 
81  HalfWord id() const;
82  void setId(HalfWord aId);
83 
84  ResourceType type() const;
85  void setType(ResourceType aType);
86 
87  Word info() const;
88  void setInfo(Word aInfo);
89 
90  Chunk* name() const;
92  void setName(Chunk* aName);
93 
94 private:
95  /// Unique id number that is used to refer resource.
96  HalfWord id_;
97  /// Type.
99  /// Name.
101  /// Additional info.
102  Word info_;
103 };
104 }
105 
106 #include "ResourceElement.icc"
107 
108 #endif
TPEF::ResourceElement::MRT_OP
@ MRT_OP
Operation operand or function unit register.
Definition: ResourceElement.hh:56
TPEF::ResourceElement::MRT_BUS
@ MRT_BUS
Transport bus.
Definition: ResourceElement.hh:53
TPEF::ResourceElement::UNIVERSAL_RF_MASK
@ UNIVERSAL_RF_MASK
Bit to check if registerfile is real or universal.
Definition: ResourceElement.hh:70
TPEF::ResourceElement::id
HalfWord id() const
TPEF::ResourceElement::BOOL_RF
@ BOOL_RF
Universal boolean register file.
Definition: ResourceElement.hh:68
TPEF::ResourceElement::type
ResourceType type() const
TPEF::ResourceElement::MRT_SR
@ MRT_SR
Special register.
Definition: ResourceElement.hh:58
TPEF::ResourceElement
Definition: ResourceElement.hh:47
SafePointer.hh
TPEF::ResourceElement::ReservedResourceIDs
ReservedResourceIDs
Resource Id numbers that are reserved for some particular use.
Definition: ResourceElement.hh:63
TPEF::ResourceElement::setType
void setType(ResourceType aType)
TPEF::ResourceElement::name
Chunk * name() const
TPEF::ResourceElement::name_
const ReferenceManager::SafePointer * name_
Name.
Definition: ResourceElement.hh:100
TPEF::ResourceElement::ILLEGAL_RF
@ ILLEGAL_RF
Illegal register file.
Definition: ResourceElement.hh:66
TPEF::ReferenceManager::SafePointer
Definition: SafePointer.hh:188
TPEF::ResourceElement::MRT_IMM
@ MRT_IMM
Immediate unit.
Definition: ResourceElement.hh:57
TPEF::ResourceElement::INLINE_IMM
@ INLINE_IMM
Inline immediate unit id.
Definition: ResourceElement.hh:72
TPEF::ResourceElement::MRT_NULL
@ MRT_NULL
Illegal undefined machine resource.
Definition: ResourceElement.hh:52
TPEF::ResourceElement::MRT_PORT
@ MRT_PORT
Function unit port.
Definition: ResourceElement.hh:59
TPEF::SectionElement
Definition: SectionElement.hh:44
TPEF::ResourceElement::info
Word info() const
TPEF::ResourceElement::ResourceElement
ResourceElement()
Definition: ResourceElement.cc:46
TPEF::ResourceElement::setInfo
void setInfo(Word aInfo)
TPEF::ResourceElement::id_
HalfWord id_
Unique id number that is used to refer resource.
Definition: ResourceElement.hh:96
TPEF::ResourceElement::ResourceType
ResourceType
Resource types.
Definition: ResourceElement.hh:51
TPEF::ResourceElement::MRT_RF
@ MRT_RF
Register file.
Definition: ResourceElement.hh:55
TPEF::ResourceElement::type_
ResourceType type_
Type.
Definition: ResourceElement.hh:98
TPEF::ResourceElement::~ResourceElement
virtual ~ResourceElement()
Definition: ResourceElement.cc:54
SectionElement.hh
Chunk.hh
TPEF::ResourceElement::MRT_UNIT
@ MRT_UNIT
Function unit.
Definition: ResourceElement.hh:54
TPEF::ResourceElement::setId
void setId(HalfWord aId)
TPEFBaseType.hh
TPEF::ResourceElement::UNIVERSAL_BUS
@ UNIVERSAL_BUS
Universal bus.
Definition: ResourceElement.hh:64
TPEF::ResourceElement::FP_RF
@ FP_RF
Universal floating point register file.
Definition: ResourceElement.hh:69
TPEF::ResourceElement::INT_RF
@ INT_RF
Universal integer register file.
Definition: ResourceElement.hh:67
TPEF::ResourceElement::RETURN_ADDRESS_NAME
static const std::string RETURN_ADDRESS_NAME
Reserved string of return address special register.
Definition: ResourceElement.hh:76
TPEF::ResourceElement::setName
void setName(ReferenceManager::SafePointer *aName)
TPEF::Chunk
Definition: Chunk.hh:45
TPEF::ResourceElement::info_
Word info_
Additional info.
Definition: ResourceElement.hh:102
ResourceElement.icc
TPEF
Definition: Assembler.hh:43
TPEF::ResourceElement::UNIVERSAL_FU
@ UNIVERSAL_FU
Universal function unit.
Definition: ResourceElement.hh:65