OpenASIP 2.2
Loading...
Searching...
No Matches
IndexBound.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2013 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 IndexBound.cc
26 *
27 * Implementation of IndexBound class.
28 *
29 * @author Otto Esko 2013 (otto.esko-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#include "IndexBound.hh"
34
35/**
36 * Constructor for moveslot bound indices
37 */
38IndexBound::IndexBound(unsigned int startIndex, unsigned int endIndex):
39 slotStartIndex_(startIndex), slotEndIndex_(endIndex), usesLimm_(false),
40 limmWidth_(0), limmValueLeftBitIndex_(0), limmValueRightBitIndex_(0) {
41}
42
43/**
44 * Constructor for moveslot bounds and limm slot bound indices
45 */
47 unsigned int startIndex,
48 unsigned int endIndex,
49 int limmWidth,
50 int limmLeftIndex,
51 int limmRightIndex):
52 slotStartIndex_(startIndex), slotEndIndex_(endIndex), usesLimm_(true),
53 limmWidth_(limmWidth), limmValueLeftBitIndex_(limmLeftIndex),
54 limmValueRightBitIndex_(limmRightIndex) {
55}
56
57/**
58 * The destructor.
59 */
62
63
64/**
65 * Move slot start index
66 *
67 * @return Starting bit index of the move slot
68 */
69unsigned int
71
72 return slotStartIndex_;
73}
74
75/**
76 * Move slot end index
77 *
78 * @return End bit index of the move slot
79 */
80unsigned int
82
83 return slotEndIndex_;
84}
85
86/**
87 * Increment start bit index.
88 *
89 * Useful for converting the move slot index to absolute position inside
90 * the instruction bit stream.
91 *
92 * @param increment Value to be added to the start index
93 */
94void
95IndexBound::incrStartIndex(unsigned int increment) {
96
97 slotStartIndex_ += increment;
98}
99
100/**
101 * Increment end bit index.
102 *
103 * Useful for converting the move slot index to absolute position inside
104 * the instruction bit stream
105 *
106 * @param increment Value to be added to the end index
107 */
108void
109IndexBound::incrEndIndex(unsigned int increment) {
110
111 slotEndIndex_ += increment;
112}
113
114/**
115 * Is long immediate encoding utilized in this move slot
116 *
117 * @return Is long immediate utilized in this move slot
118 */
119bool
121
122 return usesLimm_;
123}
124
125/**
126 * Query the width of the limm slot
127 *
128 * @return Width of the limm slot. 0 if limm is not used
129 */
130int
132
133 return limmWidth_;
134}
135
136/**
137 * Query the leftmost (MSB) index of the long immediate value in this slot
138 *
139 * This tells the leftmost bit of the long immediate *value* this
140 * slot is going to encode, not the position of the limm slot inside
141 * the instruction. Notice that the indexing starts from zero.
142 *
143 * @return Leftmost bit of the LIMM value this slot is encoding
144 */
145int
150
151/**
152 * Query the rightmost (LSB) index of the long immediate value in this slot
153 *
154 * This tells the rightmost bit of the long immediate *value* this
155 * slot is going to encode, not the position of the limm slot inside
156 * the instruction. Notice that the indexing starts from zero.
157 *
158 * @return Rightmost bit of the LIMM value this slot is encoding
159 */
160int
find Finds info of the inner loops in the false
unsigned int slotEndIndex() const
Definition IndexBound.cc:81
unsigned int slotStartIndex() const
Definition IndexBound.cc:70
int limmWidth() const
int limmWidth_
Width of the long immediate chunk in this moveslot.
Definition IndexBound.hh:80
bool isLimmEncoded() const
void incrStartIndex(unsigned int increment)
Definition IndexBound.cc:95
int limmValueRightBitIndex_
Index of the right most bit (LSB) of the value to be encoded in this slot.
Definition IndexBound.hh:86
unsigned int slotStartIndex_
Start index of the moveslot in instruction.
Definition IndexBound.hh:74
int limmRightIndex() const
int limmValueLeftBitIndex_
Index of the left most bit (MSB) of the value to be encoded in this slot.
Definition IndexBound.hh:83
int limmLeftIndex() const
bool usesLimm_
Is address encoded in long immediate.
Definition IndexBound.hh:78
unsigned int slotEndIndex_
End index of the moveslot in instruction.
Definition IndexBound.hh:76
void incrEndIndex(unsigned int increment)