OpenASIP  2.0
FUPortImplementation.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 FUPortImplementation.cc
26  *
27  * Implementation of FUPortImplementation class.
28  *
29  * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #include <string>
34 
35 #include "FUPortImplementation.hh"
36 #include "FUImplementation.hh"
37 
38 using std::string;
39 
40 namespace HDB {
41 
42 /**
43  * The constructor.
44  *
45  * Adds the port automatically to the given FUImplementation.
46  *
47  * @param name Name of the port.
48  * @param architecturePort Name of the corresponding port in architecture.
49  * @param widthFormula The formula for the width of the port.
50  * @param loadPort Name of the load enable port.
51  * @param guardPort Name of the guard port if the port is guarded.
52  * @param parent The parent FU implementation.
53  */
55  const std::string& name,
56  const std::string& architecturePort,
57  const std::string& widthFormula,
58  const std::string& loadPort,
59  const std::string& guardPort,
60  FUImplementation& parent) :
61  PortImplementation(name, loadPort),
62  architecturePort_(architecturePort), widthFormula_(widthFormula),
63  guardPort_(guardPort) {
64 
65  parent.addArchitecturePort(this);
66 }
67 
68 
69 /**
70  * The destructor.
71  */
73 }
74 
75 
76 /**
77  * Sets the corresponding port in the FU architecture.
78  *
79  * @param name Name of the port.
80  */
81 void
84 }
85 
86 
87 /**
88  * Returns the name of the corresponding port in the FU architecture.
89  *
90  * @return The name of the port.
91  */
92 std::string
94  return architecturePort_;
95 }
96 
97 
98 /**
99  * Sets the name of the guard port if the port is guarded.
100  *
101  * @param name Name of the guard port.
102  */
103 void
104 FUPortImplementation::setGuardPort(const std::string& name) {
105  guardPort_ = name;
106 }
107 
108 
109 /**
110  * Returns the name of the guard port if the port is guarded.
111  *
112  * @return The name of the guard port.
113  */
114 std::string
116  return guardPort_;
117 }
118 
119 
120 /**
121  * Sets the width formula of the port.
122  *
123  * @param formula The new formula.
124  */
125 void
126 FUPortImplementation::setWidthFormula(const std::string& formula) {
127  widthFormula_ = formula;
128 }
129 
130 
131 /**
132  * Returns the formula for the width of the port.
133  *
134  * @return The formula.
135  */
136 std::string
138  return widthFormula_;
139 }
140 }
HDB::FUImplementation::addArchitecturePort
void addArchitecturePort(FUPortImplementation *port)
Definition: FUImplementation.cc:274
HDB::FUPortImplementation::architecturePort_
std::string architecturePort_
Name of the corresponding port in architecture.
Definition: FUPortImplementation.hh:66
HDB
Definition: CostDatabase.hh:49
FUPortImplementation.hh
HDB::FUPortImplementation::~FUPortImplementation
virtual ~FUPortImplementation()
Definition: FUPortImplementation.cc:72
HDB::PortImplementation
Definition: PortImplementation.hh:44
HDB::FUPortImplementation::FUPortImplementation
FUPortImplementation(const std::string &name, const std::string &architecturePort, const std::string &widthFormula, const std::string &loadPort, const std::string &guardPort, FUImplementation &parent)
Definition: FUPortImplementation.cc:54
HDB::FUPortImplementation::setGuardPort
void setGuardPort(const std::string &name)
Definition: FUPortImplementation.cc:104
FUImplementation.hh
HDB::FUImplementation
Definition: FUImplementation.hh:53
HDB::FUPortImplementation::architecturePort
std::string architecturePort() const
Definition: FUPortImplementation.cc:93
HDB::PortImplementation::name
std::string name() const
Definition: PortImplementation.cc:74
HDB::FUPortImplementation::guardPort_
std::string guardPort_
Name of the guard port.
Definition: FUPortImplementation.hh:70
HDB::FUPortImplementation::guardPort
std::string guardPort() const
Definition: FUPortImplementation.cc:115
HDB::FUPortImplementation::setWidthFormula
void setWidthFormula(const std::string &formula)
Definition: FUPortImplementation.cc:126
HDB::FUPortImplementation::widthFormula_
std::string widthFormula_
The formula for the width of the port.
Definition: FUPortImplementation.hh:68
HDB::FUPortImplementation::widthFormula
std::string widthFormula() const
Definition: FUPortImplementation.cc:137
HDB::FUPortImplementation::setArchitecturePort
void setArchitecturePort(const std::string &name)
Definition: FUPortImplementation.cc:82