OpenASIP  2.0
LImmDstRegisterField.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 LImmDstRegisterField.hh
26  *
27  * Declaration of LImmDstRegisterField class.
28  *
29  * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_LIMM_DST_REGISTER_FIELD_HH
34 #define TTA_LIMM_DST_REGISTER_FIELD_HH
35 
36 #include <string>
37 #include <map>
38 
39 #include "InstructionField.hh"
40 
41 class BinaryEncoding;
42 
43 /**
44  * Represets the instruction field that contains the register index
45  * where a long immediate is going to be written.
46  */
48 public:
51  virtual ~LImmDstRegisterField();
52 
53  BinaryEncoding* parent() const;
54 
55  void addDestination(
56  const std::string& instructionTemplate,
57  const std::string& immediateUnit);
58 
59  int instructionTemplateCount() const;
60  std::string instructionTemplate(int index) const;
62  const std::string& instructionTemplate) const;
63  std::string immediateUnit(const std::string& instructionTemplate) const;
64 
65  virtual int width() const;
66  virtual int childFieldCount() const;
67  virtual ObjectState* saveState() const;
68 
69  /// ObjectState name for long immediate destination register field.
70  static const std::string OSNAME_LIMM_DST_REGISTER_FIELD;
71  /// ObjectState attribute key for the width of the field.
72  static const std::string OSKEY_WIDTH;
73  /// ObjectState name for a immediate unit destination.
74  static const std::string OSNAME_IU_DESTINATION;
75  /// ObjectState attribute key for the name of the instruction template.
76  static const std::string OSKEY_ITEMP;
77  /// ObjectState attribute key for the name of the immediate unit.
78  static const std::string OSKEY_DST_IU;
79 
80 private:
81  /// Map type for strings.
82  typedef std::map<std::string, std::string> StringMap;
83 
84  void loadState(const ObjectState* state);
85 
86  /// Width of the field.
87  int width_;
88  /// Maps instruction templates to immediate units
90 };
91 
92 #endif
LImmDstRegisterField::loadState
void loadState(const ObjectState *state)
Definition: LImmDstRegisterField.cc:260
BinaryEncoding
Definition: BinaryEncoding.hh:61
LImmDstRegisterField::StringMap
std::map< std::string, std::string > StringMap
Map type for strings.
Definition: LImmDstRegisterField.hh:82
LImmDstRegisterField::destinationMap_
StringMap destinationMap_
Maps instruction templates to immediate units.
Definition: LImmDstRegisterField.hh:89
InstructionField.hh
LImmDstRegisterField::instructionTemplateCount
int instructionTemplateCount() const
Definition: LImmDstRegisterField.cc:148
ObjectState
Definition: ObjectState.hh:59
LImmDstRegisterField::saveState
virtual ObjectState * saveState() const
Definition: LImmDstRegisterField.cc:235
InstructionField
Definition: InstructionField.hh:43
LImmDstRegisterField::OSKEY_DST_IU
static const std::string OSKEY_DST_IU
ObjectState attribute key for the name of the immediate unit.
Definition: LImmDstRegisterField.hh:78
LImmDstRegisterField::instructionTemplate
std::string instructionTemplate(int index) const
Definition: LImmDstRegisterField.cc:162
LImmDstRegisterField::LImmDstRegisterField
LImmDstRegisterField(int width, BinaryEncoding &parent)
Definition: LImmDstRegisterField.cc:59
LImmDstRegisterField::width_
int width_
Width of the field.
Definition: LImmDstRegisterField.hh:87
LImmDstRegisterField::immediateUnit
std::string immediateUnit(const std::string &instructionTemplate) const
Definition: LImmDstRegisterField.cc:197
LImmDstRegisterField::OSKEY_WIDTH
static const std::string OSKEY_WIDTH
ObjectState attribute key for the width of the field.
Definition: LImmDstRegisterField.hh:72
LImmDstRegisterField::width
virtual int width() const
Definition: LImmDstRegisterField.cc:213
LImmDstRegisterField::OSNAME_IU_DESTINATION
static const std::string OSNAME_IU_DESTINATION
ObjectState name for a immediate unit destination.
Definition: LImmDstRegisterField.hh:74
LImmDstRegisterField::OSNAME_LIMM_DST_REGISTER_FIELD
static const std::string OSNAME_LIMM_DST_REGISTER_FIELD
ObjectState name for long immediate destination register field.
Definition: LImmDstRegisterField.hh:70
LImmDstRegisterField::usedByInstructionTemplate
bool usedByInstructionTemplate(const std::string &instructionTemplate) const
Definition: LImmDstRegisterField.cc:181
LImmDstRegisterField::~LImmDstRegisterField
virtual ~LImmDstRegisterField()
Definition: LImmDstRegisterField.cc:93
LImmDstRegisterField::childFieldCount
virtual int childFieldCount() const
Definition: LImmDstRegisterField.cc:224
LImmDstRegisterField::addDestination
void addDestination(const std::string &instructionTemplate, const std::string &immediateUnit)
Definition: LImmDstRegisterField.cc:129
LImmDstRegisterField::OSKEY_ITEMP
static const std::string OSKEY_ITEMP
ObjectState attribute key for the name of the instruction template.
Definition: LImmDstRegisterField.hh:76
LImmDstRegisterField
Definition: LImmDstRegisterField.hh:47
LImmDstRegisterField::parent
BinaryEncoding * parent() const
Definition: LImmDstRegisterField.cc:106