OpenASIP  2.0
HDLPort.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2010 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 HDLPort.cc
26  *
27  * Implementation of HDLPort class.
28  *
29  * @author Otto Esko 2010 (otto.esko-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #include "HDLPort.hh"
34 #include "NetlistPort.hh"
35 #include "NetlistBlock.hh"
36 using ProGe::NetlistPort;
37 
39  const TCEString name, const TCEString& widthFormula, ProGe::DataType type,
40  ProGe::Direction direction, bool needsInversion)
41  : name_(name),
42  widthFormula_(widthFormula),
43  type_(type),
44  direction_(direction),
45  needsInversion_(needsInversion),
46  hasWidth_(false),
47  width_(0),
48  hasStaticValue_(false),
49  staticValue_(ProGe::StaticSignal::GND) {}
50 
52  const TCEString name, const TCEString& widthFormula, ProGe::DataType type,
53  ProGe::Direction direction, bool needsInversion, int width)
54  : name_(name),
55  widthFormula_(widthFormula),
56  type_(type),
57  direction_(direction),
58  needsInversion_(needsInversion),
59  hasWidth_(true),
60  width_(width),
61  hasStaticValue_(false),
62  staticValue_(ProGe::StaticSignal::GND) {}
63 
65  name_(old.name_), widthFormula_(old.widthFormula_), type_(old.type_),
66  direction_(old.direction_), needsInversion_(old.needsInversion_),
67  hasWidth_(old.hasWidth_), width_(old.width_),
68  hasStaticValue_(old.hasStaticValue_), staticValue_(old.staticValue_) {
69 }
70 
72  : name_(port.name()),
73  widthFormula_(port.widthFormula()),
74  type_(port.dataType()),
75  direction_(port.direction()),
76  needsInversion_(false),
77  hasWidth_(port.realWidthAvailable()),
78  width_(0),
79  hasStaticValue_(false),
80  staticValue_(ProGe::StaticSignal::GND) {
81  if (port.realWidthAvailable()) {
82  width_ = port.realWidth();
83  }
84 }
85 
86 TCEString
87 HDLPort::name() const {
88  return name_;
89 }
90 
91 TCEString
93  return widthFormula_;
94 }
95 
96 void
97 HDLPort::updateWidthFormula(const TCEString& widthFormula) {
99 }
100 
101 bool
103  return hasWidth_;
104 }
105 
106 int
108  return width_;
109 }
110 
113  return direction_;
114 }
115 
117 HDLPort::type() const {
118  return type_;
119 }
120 
121 bool
123  return needsInversion_;
124 }
125 
128 
129  NetlistPort* port;
130  if (hasWidth_) {
132  direction_, block);
133  } else {
135  block);
136  }
137  if (hasStaticValue_) {
138  port->setToStatic(staticValue_);
139  }
140  return port;
141 }
142 
143 
144 void
146 
147  hasStaticValue_ = true;
148  staticValue_ = value;
149 }
150 
151 
152 bool
154 
155  return hasStaticValue_;
156 }
157 
158 
161 
162  return staticValue_;
163 }
HDLPort::width_
int width_
Definition: PlatformIntegrator/HDLPort.hh:102
ProGe::NetlistBlock
Definition: NetlistBlock.hh:61
HDLPort
Definition: PlatformIntegrator/HDLPort.hh:48
HDLPort::staticValue
ProGe::StaticSignal staticValue() const
Definition: HDLPort.cc:160
HDLPort::needsInversion_
bool needsInversion_
Definition: PlatformIntegrator/HDLPort.hh:100
ProGe::NetlistPort::setToStatic
void setToStatic(StaticSignal value) const
Definition: NetlistPort.cc:410
HDLPort::type
ProGe::DataType type() const
Definition: HDLPort.cc:117
HDLPort::hasWidth_
bool hasWidth_
Definition: PlatformIntegrator/HDLPort.hh:101
HDLPort::staticValue_
ProGe::StaticSignal staticValue_
Definition: PlatformIntegrator/HDLPort.hh:104
HDLPort::convertToNetlistPort
ProGe::NetlistPort * convertToNetlistPort(ProGe::NetlistBlock &block) const
Definition: HDLPort.cc:127
ProGe::NetlistPort::realWidthAvailable
bool realWidthAvailable() const
Definition: NetlistPort.cc:334
HDLPort::type_
ProGe::DataType type_
Definition: PlatformIntegrator/HDLPort.hh:98
HDLPort::hasStaticValue
bool hasStaticValue() const
Definition: HDLPort.cc:153
ProGe::StaticSignal
Definition: NetlistPort.hh:47
HDLPort::name_
TCEString name_
Definition: PlatformIntegrator/HDLPort.hh:96
NetlistPort.hh
NetlistBlock.hh
HDLPort::updateWidthFormula
void updateWidthFormula(const TCEString &widthFormula)
Definition: HDLPort.cc:97
HDLPort::name
TCEString name() const
Definition: HDLPort.cc:87
HDLPort.hh
HDLPort::direction
ProGe::Direction direction() const
Definition: HDLPort.cc:112
ProGe::NetlistPort::realWidth
int realWidth() const
Definition: NetlistPort.cc:348
HDLPort::setToStatic
void setToStatic(ProGe::StaticSignal value)
Definition: HDLPort.cc:145
false
find Finds info of the inner loops in the false
Definition: InnerLoopFinder.cc:81
ProGe
Definition: FUGen.hh:54
ProGe::DataType
DataType
Data types of hardware ports.
Definition: ProGeTypes.hh:46
TCEString
Definition: TCEString.hh:53
ProGe::NetlistPort
Definition: NetlistPort.hh:70
HDLPort::widthFormula
TCEString widthFormula() const
Definition: HDLPort.cc:92
HDLPort::hasRealWidth
bool hasRealWidth() const
Definition: HDLPort.cc:102
HDLPort::hasStaticValue_
bool hasStaticValue_
Definition: PlatformIntegrator/HDLPort.hh:103
HDLPort::realWidth
int realWidth() const
Definition: HDLPort.cc:107
HDLPort::widthFormula_
TCEString widthFormula_
Definition: PlatformIntegrator/HDLPort.hh:97
ProGe::Direction
Direction
Direction of the port.
Definition: ProGeTypes.hh:52
HDLPort::HDLPort
HDLPort(const TCEString name, const TCEString &widthFormula, ProGe::DataType type, ProGe::Direction direction, bool needsInversion)
Definition: HDLPort.cc:38
HDLPort::direction_
ProGe::Direction direction_
Definition: PlatformIntegrator/HDLPort.hh:99
HDLPort::needsInversion
bool needsInversion() const
Definition: HDLPort.cc:122