OpenASIP 2.2
Loading...
Searching...
No Matches
UnboundedRegisterFile.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 UnboundedRegisterFile.cc
26 *
27 * Implementation of UnboundedRegisterFile class.
28 *
29 * @author Lasse Laasonen 2004 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: yellow
31 */
32
33#include <climits>
34
36#include "Port.hh"
37
38using std::string;
39
40/**
41 * The constructor.
42 *
43 * @param name The name of the register file.
44 * @param width Bit width of the registers in the register file.
45 * @param type Type of the register file.
46 * @exception InvalidName If one of the given names is not a valid component
47 * name.
48 * @exception OutOfRange If the bit width is out of range.
49 */
51 const std::string& name, int width, RegisterFile::Type type)
52 : RegisterFile(name, INT_MAX, width, 1, 1, 0, type) {}
53
54/**
55 * The destructor.
56 */
59
60
61/**
62 * Returns INT_MAX.
63 *
64 * UnboundedRegisterFile has "unlimited" amount of registers.
65 *
66 * @return INT_MAX.
67 */
68int
70 return INT_MAX;
71}
72
73
74/**
75 * Aborts the program. It is not allowed to call this method of
76 * UnboundedRegisterFile. DO NOT CALL THIS METHOD!
77 *
78 * @param reads Never used.
79 * @exception OutOfRange Never thrown.
80 */
81void
83 const string procName = "UnboundedRegisterFile::setMaxReads";
84 const string errorMsg =
85 "Tried to set max reads of UnboundedRegisterFile!";
86 Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
88}
89
90/**
91 * Aborts the program. It is not allowed to call this method of
92 * UnboundedRegisterFile. DO NOT CALL THIS METHOD!
93 *
94 * @param maxWrites Never used.
95 * @exception OutOfRange Never thrown.
96 */
97void
99 const string procName = "UnboundedRegisterFile::setMaxWrites";
100 const string errorMsg = "Tries to set maxWrites of UnboundedRegisterFile!";
101 Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
103}
104
105/**
106 * Aborts the program. It is not allowed to set the number of
107 * registers of UnboundedRegisterFile. It has always unlimited amount
108 * of registers. DO NOT CALL THIS METHOD.
109 *
110 * @param registers Never used.
111 * @exception OutOfRange Never thrown.
112 */
113void
115 const string procName = "UnboundedRegisterFile::setNumberOfRegisters";
116 const string errorMsg =
117 "Tried to set the number of registers of UnboundedRegisterFile!";
118 Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
120}
121
122/**
123 * Aborts the program. It is not allowed to set the bit width of
124 * UnboundedRegisterFile once it is set at construction. DO NOT CALL
125 * THIS METHOD.
126 *
127 * @param width Never used.
128 * @exception OutOfRange Never thrown.
129 */
130void
132 const string procName = "UnboundedRegisterFile::setWidth";
133 const string errorMsg =
134 "Tried to set the bit width of UnboundedRegisterFile!";
135 Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
137}
138
139/**
140 * Aborts the program. It is not allowed to change the name of
141 * UnboundedRegisterFile once it is set at construction. DO NOT CALL
142 * THIS METHOD!
143 *
144 * @param name Never used.
145 * @exception ComponentAlreadyExists Never thrown.
146 * @exception InvalidName Never thrown.
147 */
148void
150 const string procName = "UnboundedRegisterFile::setName";
151 const string errorMsg =
152 "Tried to set the name of UnboundedRegisterFile!";
153 Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
155}
156
157/**
158 * Aborts the program. It is not allowed to set the type of
159 * UnboundedRegisterFile once it is set at construction. DO NOT CALL
160 * THIS METHOD!
161 *
162 * @param type Never used.
163 */
164void
166 const string procName = "UnboundedRegisterFile::setType";
167 const string errorMsg = "Tried to the type of UnboundedRegisterFile!";
168 Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
170}
171
172
173/**
174 * Aborts the program. It is not allowed to load UniversalMachine from
175 * an ObjectState tree. DO NOT CALL THIS METHOD!
176 *
177 * @param state Never used.
178 * @exception ObjectStateLoadingException Never thrown.
179 */
180void
182 const string procName = "UnboundedRegisterFile::loadState";
183 const string errorMsg =
184 "Tried to load state of UnboundedRegisterFile from an ObjectState"
185 "tree!";
186 Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
188}
static void abortProgram() __attribute__((noreturn))
static void writeToErrorLog(const std::string fileName, const int lineNumber, const std::string functionName, const std::string message, const int neededVerbosity=0)
virtual void setMaxReads(int reads)
virtual void setName(const std::string &name)
virtual void setNumberOfRegisters(int registers)
virtual void setWidth(int width)
UnboundedRegisterFile(const std::string &name, int width, RegisterFile::Type type)
virtual int numberOfRegisters() const
virtual void loadState(const ObjectState *state)
virtual void setMaxWrites(int maxWrites)
virtual void setType(RegisterFile::Type type)