OpenASIP 2.2
Loading...
Searching...
No Matches
CentralizedControlICGenerator.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 CentralizedControlICGenerator.cc
26 *
27 * Implementation of CentralizedControlICGenerator class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
34#include "NetlistPort.hh"
35#include "MapTools.hh"
36#include "Application.hh"
37
38using namespace ProGe;
39using namespace TTAMachine;
40
41/**
42 * The constructor.
43 */
47
48
49/**
50 * The destructor.
51 */
54
55
56/**
57 * Returns the short immediate data port for the given bus.
58 *
59 * @param busName Name of the bus.
60 * @return The netlist port that was added by the IC generator.
61 * @exception InstanceNotFound If the port was not created.
62 */
64CentralizedControlICGenerator::simmDataPort(const std::string& busName) const {
65 try {
67 simmDataPortMap_, busName);
68 } catch (const Exception&) {
69 throw InstanceNotFound(__FILE__, __LINE__, __func__);
70 }
71}
72
73/**
74 * Returns the short immediate control port for the given bus.
75 *
76 * @param busName Name of the bus.
77 * @return The netlist port that was added by the IC generator.
78 * @exception InstanceNotFound If the port was not created.
79 */
81CentralizedControlICGenerator::simmCntrlPort(const std::string& busName) const {
82 try {
84 simmCntrlPortMap_, busName);
85 } catch (const Exception&) {
86 throw InstanceNotFound(__FILE__, __LINE__, __func__);
87 }
88}
89
90/**
91 * Returns the bus control port of the given socket in the IC block.
92 *
93 * @param socketName Name of the socket.
94 * @return The netlist port that was added by the IC generator.
95 * @exception InstanceNotFound If the port was not created.
96 */
99 const std::string& socketName) const {
100 try {
102 } catch (const Exception&) {
103 throw InstanceNotFound(__FILE__, __LINE__, __func__);
104 }
105}
106
107/**
108 * Returns the data control port of the given socket in the IC block.
109 *
110 * @param socketName Name of the socket.
111 * @return The netlist port that was added by the IC generator.
112 * @exception InstanceNotFound If the port was not created.
113 */
116 const std::string& socketName) const {
117 try {
119 } catch (const Exception&) {
120 throw InstanceNotFound(__FILE__, __LINE__, __func__);
121 }
122}
123
124/**
125 * Returns true if IC has glock port.
126 */
127bool
131
132
133/**
134 * Returns reference to NetlistPort of glock.
135 *
136 * @exception InstanceNotFound If IC does not have glock port.
137 */
140 if (!hasGlockPort()) {
141 throw InstanceNotFound(__FILE__, __LINE__, __func__,
142 "IC does not have glock port.");
143 } else {
144 return *glockPort_;
145 }
146}
147
148/**
149 * Maps the given netlist port as the short immediate data port of the
150 * given bus.
151 *
152 * @param busName The bus.
153 * @param port The netlist port.
154 */
155void
157 const std::string& busName,
158 ProGe::NetlistPort& port) {
159
161 simmDataPortMap_.insert(
162 std::pair<std::string, NetlistPort*>(busName, &port));
163}
164
165
166/**
167 * Maps the given netlist port as the short immediate control port of the
168 * given bus.
169 *
170 * @param busName The bus.
171 * @param port The netlist port.
172 */
173void
175 const std::string& busName,
176 ProGe::NetlistPort& port) {
177
179 simmCntrlPortMap_.insert(
180 std::pair<std::string, NetlistPort*>(busName, &port));
181}
182
183
184/**
185 * Maps the given bus control port for the given socket.
186 *
187 * @param socketName Name of the socket.
188 * @param port The netlist port.
189 */
190void
192 const std::string& socketName,
193 ProGe::NetlistPort& port) {
194
196 busCntrlPortMap_.insert(
197 std::pair<std::string, NetlistPort*>(socketName, &port));
198}
199
200
201/**
202 * Maps the given data control port for the given socket.
203 *
204 * @param socketName Name of the socket.
205 * @param port The netlist port.
206 */
207void
209 const std::string& socketName,
210 ProGe::NetlistPort& port) {
211
213 dataCntrlPortMap_.insert(
214 std::pair<std::string, NetlistPort*>(socketName, &port));
215}
216
217
218/**
219 * Sets optional glock port of IC.
220 *
221 * @param glockPort The glock port.
222 */
223void
228
#define __func__
#define assert(condition)
ProGe::NetlistPort & busCntrlPortOfSocket(const std::string &socketName) const
ProGe::NetlistPort & simmCntrlPort(const std::string &busName) const
NetlistPortMap dataCntrlPortMap_
Maps the data control ports of sockets.
NetlistPortMap simmCntrlPortMap_
Maps the short immediate control ports for buses.
ProGe::NetlistPort & dataCntrlPortOfSocket(const std::string &socketName) const
NetlistPortMap busCntrlPortMap_
Maps the bus control ports of sockets.
void mapDataCntrlPortOfSocket(const std::string &socketName, ProGe::NetlistPort &port)
void setGlockPort(ProGe::NetlistPort &glockPort)
NetlistPortMap simmDataPortMap_
Maps the short immediate data ports for buses.
void mapSImmDataPort(const std::string &busName, ProGe::NetlistPort &port)
ProGe::NetlistPort & simmDataPort(const std::string &busName) const
void mapSImmCntrlPort(const std::string &busName, ProGe::NetlistPort &port)
void mapBusCntrlPortOfSocket(const std::string &socketName, ProGe::NetlistPort &port)
ProGe::NetlistPort * glockPort_
(optional) Glock port
static KeyType keyForValue(const MapType &aMap, const ValueType &aValue)
static bool containsKey(const MapType &aMap, const KeyType &aKey)
Definition FUGen.hh:54