OpenASIP 2.2
Loading...
Searching...
No Matches
ImmediateControlField.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2014 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 ImmediateControlField.hh
26 *
27 * Declaration of ImmediateControlField class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @author Pekka Jääskeläinen 2014
31 * @note rating: red
32 */
33
34#ifndef TTA_IMMEDIATE_CONTROL_FIELD_HH
35#define TTA_IMMEDIATE_CONTROL_FIELD_HH
36
37#include <string>
38#include <map>
39
40#include "InstructionField.hh"
41#include "Exception.hh"
42#include "Serializable.hh"
43
44class BinaryEncoding;
45class MoveSlot;
46
47/**
48 * ImmediateControlField is a specialised InstructionField and represents the
49 * field of the TTA instruction that contains the long immediate control tag.
50 *
51 * This tag defines the template of the instruction. A TTA instruction
52 * template specifies which move slots are used to program data
53 * transports and which are used to encode immediate bits. An
54 * ImmediateControlField object can never exist alone. It is always
55 * registered to a BinaryEncoding object.
56 */
58public:
61 virtual ~ImmediateControlField();
62
63 BinaryEncoding* parent() const;
64
65 int templateCount() const;
66 std::string instructionTemplate(int index) const;
67
68 bool hasTemplateEncoding(const std::string& name) const;
69 unsigned int templateEncoding(const std::string& name) const;
70
71 void addTemplateEncoding(const std::string& name, unsigned int encoding);
72 void removeTemplateEncoding(const std::string& name);
73
74 // virtual methods derived from InstructionField
75 virtual int width() const;
76 virtual int childFieldCount() const;
77 virtual InstructionField& childField(int) const;
78
79 // methods inherited from Serializable interface
80 virtual void loadState(const ObjectState* state);
81 virtual ObjectState* saveState() const;
82
83 /// ObjectState name for immediate control field.
84 static const std::string OSNAME_IMM_CONTROL_FIELD;
85 /// ObjectState name for a template mapping.
86 static const std::string OSNAME_TEMPLATE_MAP;
87 /// ObjectState attribute key for the name of the instruction template.
88 static const std::string OSKEY_TEMPLATE_NAME;
89 /// ObjectState attribute key for the encoding of the instruction
90 /// template.
91 static const std::string OSKEY_ENCODING;
92
93private:
94 /// A map type for binary encodings.
95 typedef std::map<std::string, unsigned int> EncodingMap;
96
98
99 /// Binary encodings for instruction templates.
101};
102
103#endif
static const std::string OSKEY_TEMPLATE_NAME
ObjectState attribute key for the name of the instruction template.
std::map< std::string, unsigned int > EncodingMap
A map type for binary encodings.
static const std::string OSNAME_TEMPLATE_MAP
ObjectState name for a template mapping.
unsigned int templateEncoding(const std::string &name) const
static const std::string OSNAME_IMM_CONTROL_FIELD
ObjectState name for immediate control field.
bool hasTemplateEncoding(const std::string &name) const
void removeTemplateEncoding(const std::string &name)
virtual int childFieldCount() const
std::string instructionTemplate(int index) const
virtual InstructionField & childField(int) const
BinaryEncoding * parent() const
static const std::string OSKEY_ENCODING
ObjectState attribute key for the encoding of the instruction template.
virtual void loadState(const ObjectState *state)
void addTemplateEncoding(const std::string &name, unsigned int encoding)
virtual ObjectState * saveState() const
EncodingMap templates_
Binary encodings for instruction templates.