OpenASIP 2.2
Loading...
Searching...
No Matches
NullInstructionTemplate.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 NullInstructionTemplate.cc
26 *
27 * Implementation of NullInstructionTemplate class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: yellow
31 */
32
34#include "Machine.hh"
35
36namespace TTAMachine {
37
39NullInstructionTemplate NullInstructionTemplate::instance_;
40
41/**
42 * The constructor.
43 */
47
48
49/**
50 * The destructor.
51 */
54
55
56/**
57 * Returns the only instance of NullInstructionTemplate.
58 *
59 * @return The only instance of NullInstructionTemplate.
60 */
65
66
67/**
68 * Aborts the program with error message.
69 *
70 * @return Never returns.
71 */
74 abortWithError("name()");
75 return "";
76}
77
78
79/**
80 * Aborts the program with error message.
81 *
82 * @exception ComponentAlreadyExists Never thrown.
83 * @exception InvalidName Never thrown.
84 */
85void
87 abortWithError("setName()");
88}
89
90/**
91 * Aborts the program with error message.
92 *
93 * @exception InstanceNotFound Never thrown.
94 * @exception ComponentAlreadyExists Never thrown.
95 * @exception OutOfRange Never thrown.
96 */
97void
99 abortWithError("addSlot()");
100}
101
102/**
103 * Aborts the program with error message.
104 */
105void
107 abortWithError("removeSlot()");
108}
109
110
111/**
112 * Aborts the program with error message.
113 *
114 * @return Never returns.
115 */
116void
120
121/**
122 * Aborts the program with error message.
123 *
124 * @return Never returns.
125 */
126int
128 abortWithError("slotCount()");
129 return -1;
130}
131
132/**
133 * Aborts the program with error message.
134 *
135 * @return Never returns.
136 */
139 abortWithError("slot()");
140 return NULL;
141}
142
143
144/**
145 * Aborts the program with error message.
146 *
147 * @return Never returns.
148 */
149bool
150NullInstructionTemplate::usesSlot(const std::string&) const {
151 abortWithError("usesSlot()");
152 return false;
153}
154
155
156/**
157 * Aborts the program with error message.
158 *
159 * @return Never returns.
160 */
161bool
163 const std::string&,
164 const ImmediateUnit&) const {
165
166 abortWithError("destinationUsesSlot()");
167 return false;
168}
169
170
171/**
172 * Aborts the program with error message.
173 *
174 * @return Never returns.
175 */
176int
178 abortWithError("numberOfDestinations()");
179 return 0;
180}
181
182
183/**
184 * Aborts the program with error message.
185 *
186 * @return Never returns.
187 */
188bool
190 abortWithError("isOneOfDestinations()");
191 return false;
192}
193
194
195/**
196 * Aborts the program with error message.
197 *
198 * @return Never returns.
199 */
202 abortWithError("destinationOfSlot()");
203 return NULL;
204}
205
206/**
207 * Aborts the program with error message.
208 *
209 * @return Never returns.
210 */
211int
213 abortWithError("numberOfSlots()");
214 return 0;
215}
216
217
218/**
219 * Aborts the program with error message.
220 *
221 * @return Never returns.
222 */
223std::string
225 abortWithError("slotOfDestination()");
226 return NULL;
227}
228
229/**
230 * Aborts the program with error message.
231 *
232 * @return Never returns.
233 */
234int
236 abortWithError("supportedWidth()");
237 return 0;
238}
239
240
241/**
242 * Aborts the program with error message.
243 *
244 * @return Never returns.
245 */
246int
248 abortWithError("supportedWidth()");
249 return 0;
250}
251
252
253/**
254 * Aborts the program with error message.
255 *
256 * @return Never returns.
257 */
258int
260 abortWithError("supportedWidth()");
261 return 0;
262}
263
264
265/**
266 * Aborts the program with error message.
267 *
268 * @return Never returns.
269 */
270bool
272 abortWithError("isEmpty()");
273 return false;
274}
275
276
277/**
278 * Aborts the program with error message.
279 *
280 * @exception ComponentAlreadyExists Never thrown.
281 */
282void
286
287/**
288 * Aborts the program with error message.
289 */
290void
294
295
296/**
297 * Aborts the program with error message.
298 *
299 * @return Never returns.
300 */
301Machine*
303 abortWithError("machine()");
304 return NULL;
305}
306
307
308/**
309 * Aborts the program with error message.
310 *
311 * @exception IllegalRegistration Never thrown.
312 */
313void
315 abortWithError("ensureRegistration()");
316}
317
318/**
319 * Aborts the program with error message.
320 *
321 * @return Never returns.
322 */
323bool
325 abortWithError("isRegistered()");
326 return false;
327}
328
329/**
330 * Aborts the program with error message.
331 *
332 * @return Never returns.
333 */
336 abortWithError("saveState()");
337 return NULL;
338}
339
340
341/**
342 * Aborts the program with error message.
343 *
344 * @exception ObjectStateLoadingException Never thrown.
345 */
346void
350}
#define abortWithError(message)
virtual void setName(const std::string &name)
virtual TemplateSlot * slot(int index) const
virtual void setMachine(Machine &machine)
virtual bool destinationUsesSlot(const std::string &slotName, const ImmediateUnit &dstUnit) const
static Machine machine_
Machine to which the null instruction template is registered.
virtual void addSlot(const std::string &slotName, int width, ImmediateUnit &dstUnit)
virtual void removeSlot(const std::string &slotName)
static NullInstructionTemplate & instance()
virtual void removeSlots(const ImmediateUnit &dstUnit)
virtual int numberOfSlots(const ImmediateUnit &dstUnit) const
virtual ImmediateUnit * destinationOfSlot(const std::string &slotName) const
virtual std::string slotOfDestination(const ImmediateUnit &dstUnit, int index) const
virtual bool usesSlot(const std::string &slotName) const
virtual bool isOneOfDestinations(const ImmediateUnit &dstUnit) const
static NullInstructionTemplate instance_
The only instance of NullInstructionTemplate.
virtual void loadState(const ObjectState *state)
virtual void ensureRegistration(const Component &component) const