OpenASIP  2.0
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 
35 #include "UnboundedRegisterFile.hh"
36 #include "Port.hh"
37 
38 using 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  */
58 }
59 
60 
61 /**
62  * Returns INT_MAX.
63  *
64  * UnboundedRegisterFile has "unlimited" amount of registers.
65  *
66  * @return INT_MAX.
67  */
68 int
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  */
81 void
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  */
97 void
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  */
113 void
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  */
130 void
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  */
148 void
149 UnboundedRegisterFile::setName(const std::string&) {
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  */
164 void
165 UnboundedRegisterFile::setType(RegisterFile::Type) {
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  */
180 void
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 }
UnboundedRegisterFile::setMaxWrites
virtual void setMaxWrites(int maxWrites)
Definition: UnboundedRegisterFile.cc:98
UnboundedRegisterFile::numberOfRegisters
virtual int numberOfRegisters() const
Definition: UnboundedRegisterFile.cc:69
Application::writeToErrorLog
static void writeToErrorLog(const std::string fileName, const int lineNumber, const std::string functionName, const std::string message, const int neededVerbosity=0)
Definition: Application.cc:224
UnboundedRegisterFile::~UnboundedRegisterFile
virtual ~UnboundedRegisterFile()
Definition: UnboundedRegisterFile.cc:57
ObjectState
Definition: ObjectState.hh:59
UnboundedRegisterFile::setType
virtual void setType(RegisterFile::Type type)
Definition: UnboundedRegisterFile.cc:165
Port.hh
UnboundedRegisterFile::loadState
virtual void loadState(const ObjectState *state)
Definition: UnboundedRegisterFile.cc:181
UnboundedRegisterFile::setNumberOfRegisters
virtual void setNumberOfRegisters(int registers)
Definition: UnboundedRegisterFile.cc:114
UnboundedRegisterFile.hh
UnboundedRegisterFile::setName
virtual void setName(const std::string &name)
Definition: UnboundedRegisterFile.cc:149
UnboundedRegisterFile::setMaxReads
virtual void setMaxReads(int reads)
Definition: UnboundedRegisterFile.cc:82
Application::abortProgram
static void abortProgram() __attribute__((noreturn))
Definition: Application.cc:266
UnboundedRegisterFile::UnboundedRegisterFile
UnboundedRegisterFile(const std::string &name, int width, RegisterFile::Type type)
Definition: UnboundedRegisterFile.cc:50
UnboundedRegisterFile::setWidth
virtual void setWidth(int width)
Definition: UnboundedRegisterFile.cc:131