OpenASIP  2.0
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 
35 namespace TTAMachine {
36 
37 NullRegisterFile NullRegisterFile::instance_;
38 
39 /**
40  * The constructor.
41  */
43  RegisterFile("NULL", 1, 1, 1, 1, 0, RegisterFile::NORMAL) {
44 }
45 
46 
47 /**
48  * The destructor.
49  */
51 }
52 
53 
54 /**
55  * Returns the only instance of NullRegisterFile.
56  */
59  return instance_;
60 }
61 
62 
63 /**
64  * Aborts the program with error message.
65  *
66  * @return Never returns.
67  */
68 Machine*
70  abortWithError("machine()");
71  return NULL;
72 }
73 
74 
75 /**
76  * Aborts the program with error message.
77  *
78  * @exception IllegalRegistration Never thrown.
79  */
80 void
82  abortWithError("ensureRegistration()");
83 }
84 
85 /**
86  * Aborts the program with error message.
87  *
88  * @return Never returns.
89  */
90 bool
92  abortWithError("isRegistered()");
93  return false;
94 }
95 
96 
97 /**
98  * Aborts the program with error message.
99  *
100  * @return Never returns.
101  */
102 bool
103 NullRegisterFile::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  */
114 int
116  abortWithError("portCount()");
117  return 0;
118 }
119 
120 
121 /**
122  * Aborts the program with error message.
123  *
124  * @exception ComponentAlreadyExists Never thrown.
125  */
126 void
128  abortWithError("setMachine");
129 }
130 
131 /**
132  * Aborts the program with error message.
133  */
134 void
136  abortWithError("unsetMachine()");
137 }
138 
139 
140 /**
141  * Aborts the program with error message.
142  *
143  * @return Never returns.
144  */
145 int
147  abortWithError("numberOfRegisters()");
148  return 0;
149 }
150 
151 
152 /**
153  * Aborts the program with error message.
154  *
155  * @return Never returns.
156  */
157 int
159  abortWithError("width()");
160  return 0;
161 }
162 
163 
164 /**
165  * Aborts the program with error message.
166  *
167  * @exception OutOfRange Never thrown.
168  */
169 void
171  abortWithError("setNumberOfRegisters()");
172 }
173 
174 /**
175  * Aborts the program with error message.
176  *
177  * @exception OutOfRange Never thrown.
178  */
179 void
181  abortWithError("setWidth()");
182 }
183 
184 /**
185  * Aborts the program with error message.
186  *
187  * @return Never returns.
188  */
189 int
191  abortWithError("maxReads()");
192  return 0;
193 }
194 
195 
196 /**
197  * Aborts the program with error message.
198  *
199  * @return Never returns.
200  */
201 int
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()");
216  return RegisterFile::NORMAL;
217 }
218 
219 
220 /**
221  * Aborts the program with error message.
222  *
223  * @return Never returns.
224  */
225 bool
227  abortWithError("isNormal()");
228  return false;
229 }
230 
231 
232 /**
233  * Aborts the program with error message.
234  *
235  * @return Never returns.
236  */
237 bool
239  abortWithError("isVolatile()");
240  return false;
241 }
242 
243 
244 /**
245  * Aborts the program with error message.
246  *
247  * @return Never returns.
248  */
249 bool
251  abortWithError("isReserved()");
252  return false;
253 }
254 
255 
256 /**
257  * Aborts the program with error message.
258  *
259  * @return Never returns.
260  */
261 TCEString
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  */
274 void
275 NullRegisterFile::setName(const std::string&) {
276  abortWithError("setName()");
277 }
278 
279 /**
280  * Aborts the program with error message.
281  *
282  * @exception OutOfRange Never thrown.
283  */
284 void
286  abortWithError("setMaxReads()");
287 }
288 
289 /**
290  * Aborts the program with error message.
291  *
292  * @exception OutOfRange Never thrown.
293  */
294 void
296  abortWithError("setMaxWrites()");
297 }
298 
299 /**
300  * Aborts the program with error message.
301  */
302 void
304  abortWithError("setType()");
305 }
306 
307 
308 /**
309  * Aborts the program with error message.
310  *
311  * @return Never returns.
312  */
313 int
315  abortWithError("guardLatency()");
316  return 0;
317 }
318 
319 
320 /**
321  * Aborts the program with error message.
322  *
323  * @exception OutOfRange Never thrown.
324  */
325 void
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  */
347 void
349  abortWithError("loadState()");
350 }
351 }
TTAMachine::NullRegisterFile::setGuardLatency
virtual void setGuardLatency(int latency)
Definition: NullRegisterFile.cc:326
TTAMachine::NullRegisterFile::maxWrites
virtual int maxWrites() const
Definition: NullRegisterFile.cc:202
NullRegisterFile.hh
TTAMachine::NullRegisterFile::~NullRegisterFile
virtual ~NullRegisterFile()
Definition: NullRegisterFile.cc:50
ObjectState
Definition: ObjectState.hh:59
TTAMachine::NullRegisterFile::ensureRegistration
virtual void ensureRegistration(const Component &component) const
Definition: NullRegisterFile.cc:81
TTAMachine::NullRegisterFile::hasPort
virtual bool hasPort(const std::string &name) const
Definition: NullRegisterFile.cc:103
TTAMachine::NullRegisterFile::machine
virtual Machine * machine() const
Definition: NullRegisterFile.cc:69
TTAMachine::NullRegisterFile::isReserved
virtual bool isReserved() const
Definition: NullRegisterFile.cc:250
TTAMachine::NullRegisterFile::instance
static NullRegisterFile & instance()
Definition: NullRegisterFile.cc:58
TTAMachine::NullRegisterFile::loadState
virtual void loadState(const ObjectState *state)
Definition: NullRegisterFile.cc:348
TTAMachine::NullRegisterFile::NullRegisterFile
NullRegisterFile()
Definition: NullRegisterFile.cc:42
TTAMachine::NullRegisterFile::numberOfRegisters
virtual int numberOfRegisters() const
Definition: NullRegisterFile.cc:146
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
TTAMachine::NullRegisterFile::isRegistered
virtual bool isRegistered() const
Definition: NullRegisterFile.cc:91
TTAMachine::NullRegisterFile::setMachine
virtual void setMachine(Machine &mach)
Definition: NullRegisterFile.cc:127
TTAMachine::NullRegisterFile::instance_
static NullRegisterFile instance_
The only instance.
Definition: NullRegisterFile.hh:88
TTAMachine::Component
Definition: MachinePart.hh:90
TTAMachine::NullRegisterFile::setMaxWrites
virtual void setMaxWrites(int maxWrites)
Definition: NullRegisterFile.cc:295
TTAMachine::NullRegisterFile::unsetMachine
virtual void unsetMachine()
Definition: NullRegisterFile.cc:135
NORMAL
@ NORMAL
Definition: tceopgen.cc:45
TTAMachine::NullRegisterFile::setNumberOfRegisters
virtual void setNumberOfRegisters(int registers)
Definition: NullRegisterFile.cc:170
TTAMachine::NullRegisterFile::setWidth
virtual void setWidth(int width)
Definition: NullRegisterFile.cc:180
TTAMachine::NullRegisterFile::width
virtual int width() const
Definition: NullRegisterFile.cc:158
TCEString
Definition: TCEString.hh:53
TTAMachine::NullRegisterFile::name
virtual TCEString name() const
Definition: NullRegisterFile.cc:262
TTAMachine::RegisterFile::NORMAL
@ NORMAL
Used for general register allocation.
Definition: RegisterFile.hh:51
TTAMachine::NullRegisterFile::isNormal
virtual bool isNormal() const
Definition: NullRegisterFile.cc:226
TTAMachine::RegisterFile::Type
Type
Type of the register file indicates how the RF is used.
Definition: RegisterFile.hh:50
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
TTAMachine
Definition: Assembler.hh:48
TTAMachine::NullRegisterFile::setMaxReads
virtual void setMaxReads(int reads)
Definition: NullRegisterFile.cc:285
TTAMachine::NullRegisterFile
Definition: NullRegisterFile.hh:43
TTAMachine::NullRegisterFile::isVolatile
virtual bool isVolatile() const
Definition: NullRegisterFile.cc:238
TTAMachine::NullRegisterFile::guardLatency
virtual int guardLatency() const
Definition: NullRegisterFile.cc:314
TTAMachine::NullRegisterFile::portCount
virtual int portCount() const
Definition: NullRegisterFile.cc:115
TTAMachine::NullRegisterFile::type
virtual RegisterFile::Type type() const
Definition: NullRegisterFile.cc:214
TTAMachine::NullRegisterFile::maxReads
virtual int maxReads() const
Definition: NullRegisterFile.cc:190
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::NullRegisterFile::setName
virtual void setName(const std::string &name)
Definition: NullRegisterFile.cc:275
TTAMachine::NullRegisterFile::saveState
virtual ObjectState * saveState() const
Definition: NullRegisterFile.cc:336
TTAMachine::NullRegisterFile::setType
virtual void setType(RegisterFile::Type type)
Definition: NullRegisterFile.cc:303