OpenASIP  2.0
UniversalFUPort.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 UniversalFUPort.cc
26  *
27  * Implementation of UniversalFUPort class.
28  *
29  * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: yellow
31  */
32 
33 #include "UniversalFUPort.hh"
34 #include "UniversalFunctionUnit.hh"
35 
36 using std::string;
37 
38 /**
39  * The constructor.
40  *
41  * @param name Name of the port.
42  * @param width Bit width of the port.
43  * @param parent The function unit to which the port belongs.
44  * @param isTriggering If true, writing (or reading) this port starts the
45  * execution of a new operation.
46  * @param setsOpcode If true, writing (or reading) this port selects the
47  * operation to be executed. Opcode-setting ports must
48  * be triggering.
49  * @exception ComponentAlreadyExists If the function unit already has another
50  * port by the same name.
51  * @exception OutOfRange If the given bit width is less or equal to zero.
52  * @exception IllegalParameters If setsOpcode argument is true and
53  * isTriggering false.
54  * @exception InvalidName If the given name is not a valid component name.
55  */
57  const std::string& name, int width, UniversalFunctionUnit& parent,
58  bool isTriggering, bool setsOpcode)
59  : FUPort(name, width, parent, isTriggering, setsOpcode, true, true) {}
60 
61 /**
62  * The destructor.
63  */
65 }
66 
67 
68 /**
69  * Aborts the program. It is not allowed to set the name of UniversalFUPort.
70  * DO NOT CALL THIS METHOD!
71  *
72  * @param name Never used.
73  * @exception ComponentAlreadyExists Never thrown.
74  * @exception InvalidName Never thrown.
75  */
76 void
77 UniversalFUPort::setName(const std::string&) {
78  const string procName = "UniversalFUPort::setName";
79  const string errorMsg = "Tried to set the name of UniversalFUPort!";
80  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
82 }
83 
84 /**
85  * Aborts the program. It is not allowed to set the width of UniversalFUPort.
86  * DO NOT CALL THIS METHOD!
87  *
88  * @param width Never used.
89  * @exception OutOfRange Never thrown.
90  */
91 void
93  const string procName = "UniversalFUPort::setWidth";
94  const string errorMsg = "Tried to set width of UniversalFUPort!";
95  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
97 }
98 
99 /**
100  * Aborts the program. It is not allowed to modify UniversalFUPort. DO NOT
101  * CALL THIS METHOD!
102  *
103  * @param triggers Never used.
104  */
105 void
107  const string procName = "UniversalFUPort::setTriggering";
108  const string errorMsg =
109  "Tried to set the triggering property of UniversalFUPort!";
110  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
112 }
113 
114 
115 /**
116  * Aborts the program. It is not allowed to set the operation code setting
117  * property of UniversalFUPort. DO NOT CALL THIS METHOD!
118  *
119  * @param setsOpcode Never used.
120  * @exception ComponentAlreadyExists Never thrown.
121  */
122 void
124  const string procName = "UniversalFUPort::setOpcodeSetting";
125  const string errorMsg = "Tried to set the operation code setting "
126  "property of UniversalFUPort!";
127  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
129 }
130 
131 /**
132  * Aborts the program. It is not allowed to load the state of UniversalFUPort
133  * from an ObjectState tree. DO NOT CALL THIS METDOD!
134  *
135  * @param state Never used.
136  * @exception ObjectStateLoadingException Never thrown.
137  */
138 void
140  const string procName = "UniversalFUPort::loadState";
141  const string errorMsg =
142  "Tried to load state of UniversalFUPort from an ObjectState tree!";
143  Application::writeToErrorLog(__FILE__, __LINE__, procName, errorMsg);
145 }
UniversalFUPort::~UniversalFUPort
virtual ~UniversalFUPort()
Definition: UniversalFUPort.cc:64
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
UniversalFUPort::loadState
virtual void loadState(const ObjectState *state)
Definition: UniversalFUPort.cc:139
ObjectState
Definition: ObjectState.hh:59
UniversalFUPort::setWidth
virtual void setWidth(int width)
Definition: UniversalFUPort.cc:92
UniversalFunctionUnit
Definition: UniversalFunctionUnit.hh:50
UniversalFUPort::UniversalFUPort
UniversalFUPort(const std::string &name, int width, UniversalFunctionUnit &parent, bool isTriggering, bool setsOpcode)
Definition: UniversalFUPort.cc:56
UniversalFunctionUnit.hh
UniversalFUPort::setOpcodeSetting
virtual void setOpcodeSetting(bool setsOpcode)
Definition: UniversalFUPort.cc:123
UniversalFUPort::setName
virtual void setName(const std::string &name)
Definition: UniversalFUPort.cc:77
UniversalFUPort.hh
Application::abortProgram
static void abortProgram() __attribute__((noreturn))
Definition: Application.cc:266
UniversalFUPort::setTriggering
virtual void setTriggering(bool triggers)
Definition: UniversalFUPort.cc:106