OpenASIP 2.2
Loading...
Searching...
No Matches
NullRegisterFile.cc
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 NullRegisterFile.cc
26 *
27 * Implementation of NullRegisterFile class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: yellow
31 */
32
33#include "NullRegisterFile.hh"
34
35namespace TTAMachine {
36
37NullRegisterFile NullRegisterFile::instance_;
38
39/**
40 * The constructor.
41 */
45
46
47/**
48 * The destructor.
49 */
52
53
54/**
55 * Returns the only instance of NullRegisterFile.
56 */
61
62
63/**
64 * Aborts the program with error message.
65 *
66 * @return Never returns.
67 */
70 abortWithError("machine()");
71 return NULL;
72}
73
74
75/**
76 * Aborts the program with error message.
77 *
78 * @exception IllegalRegistration Never thrown.
79 */
80void
82 abortWithError("ensureRegistration()");
83}
84
85/**
86 * Aborts the program with error message.
87 *
88 * @return Never returns.
89 */
90bool
92 abortWithError("isRegistered()");
93 return false;
94}
95
96
97/**
98 * Aborts the program with error message.
99 *
100 * @return Never returns.
101 */
102bool
103NullRegisterFile::hasPort(const std::string&) const {
104 abortWithError("hasPort()");
105 return false;
106}
107
108
109/**
110 * Aborts the program with error message.
111 *
112 * @return Never returns.
113 */
114int
116 abortWithError("portCount()");
117 return 0;
118}
119
120
121/**
122 * Aborts the program with error message.
123 *
124 * @exception ComponentAlreadyExists Never thrown.
125 */
126void
130
131/**
132 * Aborts the program with error message.
133 */
134void
136 abortWithError("unsetMachine()");
137}
138
139
140/**
141 * Aborts the program with error message.
142 *
143 * @return Never returns.
144 */
145int
147 abortWithError("numberOfRegisters()");
148 return 0;
149}
150
151
152/**
153 * Aborts the program with error message.
154 *
155 * @return Never returns.
156 */
157int
159 abortWithError("width()");
160 return 0;
161}
162
163
164/**
165 * Aborts the program with error message.
166 *
167 * @exception OutOfRange Never thrown.
168 */
169void
171 abortWithError("setNumberOfRegisters()");
172}
173
174/**
175 * Aborts the program with error message.
176 *
177 * @exception OutOfRange Never thrown.
178 */
179void
181 abortWithError("setWidth()");
182}
183
184/**
185 * Aborts the program with error message.
186 *
187 * @return Never returns.
188 */
189int
191 abortWithError("maxReads()");
192 return 0;
193}
194
195
196/**
197 * Aborts the program with error message.
198 *
199 * @return Never returns.
200 */
201int
203 abortWithError("maxWrites()");
204 return 0;
205}
206
207
208/**
209 * Aborts the program with error message.
210 *
211 * @return Never returns.
212 */
215 abortWithError("type()");
217}
218
219
220/**
221 * Aborts the program with error message.
222 *
223 * @return Never returns.
224 */
225bool
227 abortWithError("isNormal()");
228 return false;
229}
230
231
232/**
233 * Aborts the program with error message.
234 *
235 * @return Never returns.
236 */
237bool
239 abortWithError("isVolatile()");
240 return false;
241}
242
243
244/**
245 * Aborts the program with error message.
246 *
247 * @return Never returns.
248 */
249bool
251 abortWithError("isReserved()");
252 return false;
253}
254
255
256/**
257 * Aborts the program with error message.
258 *
259 * @return Never returns.
260 */
263 abortWithError("name()");
264 return "";
265}
266
267
268/**
269 * Aborts the program with error message.
270 *
271 * @exception ComponentAlreadyExists Never thrown.
272 * @exception InvalidName Never thrown.
273 */
274void
275NullRegisterFile::setName(const std::string&) {
276 abortWithError("setName()");
277}
278
279/**
280 * Aborts the program with error message.
281 *
282 * @exception OutOfRange Never thrown.
283 */
284void
286 abortWithError("setMaxReads()");
287}
288
289/**
290 * Aborts the program with error message.
291 *
292 * @exception OutOfRange Never thrown.
293 */
294void
296 abortWithError("setMaxWrites()");
297}
298
299/**
300 * Aborts the program with error message.
301 */
302void
306
307
308/**
309 * Aborts the program with error message.
310 *
311 * @return Never returns.
312 */
313int
315 abortWithError("guardLatency()");
316 return 0;
317}
318
319
320/**
321 * Aborts the program with error message.
322 *
323 * @exception OutOfRange Never thrown.
324 */
325void
327 abortWithError("setGuardLatency()");
328}
329
330/**
331 * Aborts the program with error message.
332 *
333 * @return Never returns.
334 */
337 abortWithError("saveState()");
338 return NULL;
339}
340
341
342/**
343 * Aborts the program with error message.
344 *
345 * @exception ObjectStateLoadingException Never thrown.
346 */
347void
349 abortWithError("loadState()");
350}
351}
#define abortWithError(message)
static NullRegisterFile instance_
The only instance.
virtual bool isVolatile() const
virtual Machine * machine() const
virtual int numberOfRegisters() const
virtual void setNumberOfRegisters(int registers)
virtual TCEString name() const
virtual void setMaxReads(int reads)
virtual void setName(const std::string &name)
virtual bool hasPort(const std::string &name) const
virtual RegisterFile::Type type() const
virtual void setMaxWrites(int maxWrites)
static NullRegisterFile & instance()
virtual void setGuardLatency(int latency)
virtual void loadState(const ObjectState *state)
virtual bool isReserved() const
virtual bool isRegistered() const
virtual void ensureRegistration(const Component &component) const
virtual void setWidth(int width)
virtual void setType(RegisterFile::Type type)
virtual void setMachine(Machine &mach)
virtual ObjectState * saveState() const
Type
Type of the register file indicates how the RF is used.
@ NORMAL
Used for general register allocation.
@ NORMAL
Definition tceopgen.cc:45