OpenASIP 2.2
Loading...
Searching...
No Matches
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"
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
88 return name_;
89}
90
93 return widthFormula_;
94}
95
96void
100
101bool
103 return hasWidth_;
104}
105
106int
108 return width_;
109}
110
113 return direction_;
114}
115
118 return type_;
119}
120
121bool
123 return needsInversion_;
124}
125
128
129 NetlistPort* port;
130 if (hasWidth_) {
132 direction_, block);
133 } else {
135 block);
136 }
137 if (hasStaticValue_) {
139 }
140 return port;
141}
142
143
144void
146
147 hasStaticValue_ = true;
148 staticValue_ = value;
149}
150
151
152bool
154
155 return hasStaticValue_;
156}
157
158
161
162 return staticValue_;
163}
find Finds info of the inner loops in the false
void setToStatic(ProGe::StaticSignal value)
Definition HDLPort.cc:145
int realWidth() const
Definition HDLPort.cc:107
ProGe::Direction direction() const
Definition HDLPort.cc:112
ProGe::DataType type_
bool hasStaticValue() const
Definition HDLPort.cc:153
ProGe::StaticSignal staticValue() const
Definition HDLPort.cc:160
ProGe::StaticSignal staticValue_
ProGe::NetlistPort * convertToNetlistPort(ProGe::NetlistBlock &block) const
Definition HDLPort.cc:127
TCEString widthFormula() const
Definition HDLPort.cc:92
TCEString name() const
Definition HDLPort.cc:87
HDLPort(const TCEString name, const TCEString &widthFormula, ProGe::DataType type, ProGe::Direction direction, bool needsInversion)
Definition HDLPort.cc:38
ProGe::Direction direction_
bool hasRealWidth() const
Definition HDLPort.cc:102
ProGe::DataType type() const
Definition HDLPort.cc:117
void updateWidthFormula(const TCEString &widthFormula)
Definition HDLPort.cc:97
bool needsInversion() const
Definition HDLPort.cc:122
void setToStatic(StaticSignal value) const
bool realWidthAvailable() const
int realWidth() const
Definition FUGen.hh:54
DataType
Data types of hardware ports.
Definition ProGeTypes.hh:46
Direction
Direction of the port.
Definition ProGeTypes.hh:52