OpenASIP 2.2
Loading...
Searching...
No Matches
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
41class BinaryEncoding;
42
43/**
44 * Represets the instruction field that contains the register index
45 * where a long immediate is going to be written.
46 */
48public:
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
80private:
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
BinaryEncoding * parent() const
std::string instructionTemplate(int index) const
void loadState(const ObjectState *state)
bool usedByInstructionTemplate(const std::string &instructionTemplate) const
StringMap destinationMap_
Maps instruction templates to immediate units.
int width_
Width of the field.
virtual int width() const
static const std::string OSKEY_ITEMP
ObjectState attribute key for the name of the instruction template.
static const std::string OSKEY_DST_IU
ObjectState attribute key for the name of the immediate unit.
static const std::string OSNAME_LIMM_DST_REGISTER_FIELD
ObjectState name for long immediate destination register field.
virtual ObjectState * saveState() const
std::map< std::string, std::string > StringMap
Map type for strings.
virtual int childFieldCount() const
static const std::string OSKEY_WIDTH
ObjectState attribute key for the width of the field.
static const std::string OSNAME_IU_DESTINATION
ObjectState name for a immediate unit destination.
void addDestination(const std::string &instructionTemplate, const std::string &immediateUnit)
std::string immediateUnit(const std::string &instructionTemplate) const