OpenASIP 2.2
Loading...
Searching...
No Matches
InstructionField.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 InstructionField.hh
26 *
27 * Declaration of InstructionField class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_INSTRUCTION_FIELD_HH
34#define TTA_INSTRUCTION_FIELD_HH
35
36#include "Exception.hh"
37#include "Serializable.hh"
38
39/**
40 * InstructionField is an abstract base class that represents the properties
41 * common to all types of bit fields of the TTA instruction word.
42 */
44public:
45 virtual ~InstructionField();
46
47 InstructionField* parent() const;
48
49 /**
50 * Returns the number of (immediate) child fields within the instruction
51 * field.
52 */
53 virtual int childFieldCount() const = 0;
54
55 virtual InstructionField& childField(int position) const;
56
57 /**
58 * Returns the bit width of the field.
59 */
60 virtual int width() const = 0;
61
62 int bitPosition() const;
63 int relativePosition() const;
64 virtual void setRelativePosition(int position);
65 void setExtraBits(int bits);
66 int extraBits() const;
67
68 // methods inherited from Serializable interface
69 virtual void loadState(const ObjectState* state);
70 virtual ObjectState* saveState() const;
71
72 /// ObjectState name for instruction field.
73 static const std::string OSNAME_INSTRUCTION_FIELD;
74 /// ObjectState attribute key for the number of extra bits.
75 static const std::string OSKEY_EXTRA_BITS;
76 /// ObjectState attribute key for the relative position of the field.
77 static const std::string OSKEY_POSITION;
78
79protected:
82
84 static void reorderSubfields(ObjectState* state);
85
86private:
87 /// Indicates the relative position of the field.
89 /// The number of extra bits.
91 /// The parent instruction field.
93};
94
95#endif
void setExtraBits(int bits)
InstructionField * parent() const
int relativePos_
Indicates the relative position of the field.
int extraBits_
The number of extra bits.
InstructionField * parent_
The parent instruction field.
virtual void loadState(const ObjectState *state)
static const std::string OSKEY_POSITION
ObjectState attribute key for the relative position of the field.
virtual int width() const =0
void setParent(InstructionField *parent)
static const std::string OSNAME_INSTRUCTION_FIELD
ObjectState name for instruction field.
virtual int childFieldCount() const =0
static void reorderSubfields(ObjectState *state)
virtual ~InstructionField()
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
virtual void setRelativePosition(int position)
virtual ObjectState * saveState() const
virtual InstructionField & childField(int position) const
int relativePosition() const