Skip to content
Newer
Older
100644 281 lines (243 sloc) 7.16 KB
4cfa3e4 Support the creation of scopes.
steve authored Nov 27, 1999
1 /*
a6220fe @caryr Add support for passing variable indexed part select type information
caryr authored Feb 23, 2011
2 * Copyright (c) 1999-2011 Stephen Williams (steve@icarus.com)
4cfa3e4 Support the creation of scopes.
steve authored Nov 27, 1999
3 *
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 */
19
b825f8d Create a config.h.in file to hold all the config
steve authored Jul 25, 2001
20 # include "config.h"
21
4cfa3e4 Support the creation of scopes.
steve authored Nov 27, 1999
22 # include "netlist.h"
23 # include <cassert>
1993bf6 @caryr Remove malloc.h support and for C++ files use <c...> include files.
caryr authored May 31, 2010
24 # include <cstdlib>
9f04641 @steveicarus Detect and elaborate AMS access functions.
authored Jul 30, 2008
25 # include "ivl_assert.h"
26
27 NetEAccess* NetEAccess::dup_expr() const
28 {
b292a5f @steveicarus Create a branch object to be the argument to the access function.
authored Aug 4, 2008
29 NetEAccess*tmp = new NetEAccess(branch_, nature_);
9f04641 @steveicarus Detect and elaborate AMS access functions.
authored Jul 31, 2008
30 ivl_assert(*this, tmp);
31 tmp->set_line(*this);
32 return tmp;
33 }
4cfa3e4 Support the creation of scopes.
steve authored Nov 27, 1999
34
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
35 NetEBinary* NetEBinary::dup_expr() const
36 {
37 ivl_assert(*this, 0);
38 return 0;
39 }
40
41 NetEBAdd* NetEBAdd::dup_expr() const
42 {
43 NetEBAdd*tmp = new NetEBAdd(op_, left_->dup_expr(), right_->dup_expr(),
44 expr_width(), has_sign());
45 ivl_assert(*this, tmp);
46 tmp->set_line(*this);
47 return tmp;
48 }
49
50 NetEBBits* NetEBBits::dup_expr() const
51 {
52 NetEBBits*tmp = new NetEBBits(op_, left_->dup_expr(), right_->dup_expr(),
53 expr_width(), has_sign());
54 ivl_assert(*this, tmp);
55 tmp->set_line(*this);
56 return tmp;
57 }
58
c602d94 Comparison operators do have defined width.
steve authored Mar 15, 2003
59 NetEBComp* NetEBComp::dup_expr() const
60 {
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
61 NetEBComp*tmp = new NetEBComp(op_, left_->dup_expr(), right_->dup_expr());
62 ivl_assert(*this, tmp);
63 tmp->set_line(*this);
64 return tmp;
65 }
66
67 NetEBDiv* NetEBDiv::dup_expr() const
68 {
69 NetEBDiv*tmp = new NetEBDiv(op_, left_->dup_expr(), right_->dup_expr(),
70 expr_width(), has_sign());
71 ivl_assert(*this, tmp);
72 tmp->set_line(*this);
73 return tmp;
74 }
75
76 NetEBLogic* NetEBLogic::dup_expr() const
77 {
78 NetEBLogic*tmp = new NetEBLogic(op_, left_->dup_expr(), right_->dup_expr());
79 ivl_assert(*this, tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored Feb 27, 2008
80 tmp->set_line(*this);
81 return tmp;
c602d94 Comparison operators do have defined width.
steve authored Mar 15, 2003
82 }
83
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
84 NetEBMult* NetEBMult::dup_expr() const
85 {
86 NetEBMult*tmp = new NetEBMult(op_, left_->dup_expr(), right_->dup_expr(),
87 expr_width(), has_sign());
88 ivl_assert(*this, tmp);
89 tmp->set_line(*this);
90 return tmp;
91 }
92
93 NetEBPow* NetEBPow::dup_expr() const
94 {
95 NetEBPow*tmp = new NetEBPow(op_, left_->dup_expr(), right_->dup_expr(),
96 expr_width(), has_sign());
97 ivl_assert(*this, tmp);
98 tmp->set_line(*this);
99 return tmp;
100 }
101
102 NetEBShift* NetEBShift::dup_expr() const
103 {
104 NetEBShift*tmp = new NetEBShift(op_, left_->dup_expr(), right_->dup_expr(),
105 expr_width(), has_sign());
106 ivl_assert(*this, tmp);
107 tmp->set_line(*this);
108 return tmp;
109 }
110
111 NetEConcat* NetEConcat::dup_expr() const
112 {
113 NetEConcat*dup = new NetEConcat(parms_.count(), repeat_);
114 ivl_assert(*this, dup);
115 dup->set_line(*this);
116 for (unsigned idx = 0 ; idx < parms_.count() ; idx += 1)
117 if (parms_[idx]) {
118 NetExpr*tmp = parms_[idx]->dup_expr();
119 ivl_assert(*this, tmp);
120 dup->parms_[idx] = tmp;
121 }
122
123 dup->expr_width(expr_width());
124
125 return dup;
126 }
127
1222153 Keep parameter constants for the ivl_target API.
steve authored Mar 10, 2003
128 NetEConst* NetEConst::dup_expr() const
129 {
130 NetEConst*tmp = new NetEConst(value_);
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
131 ivl_assert(*this, tmp);
1222153 Keep parameter constants for the ivl_target API.
steve authored Mar 10, 2003
132 tmp->set_line(*this);
133 return tmp;
134 }
135
a14fa03 @steveicarus Enum names in r-value expressions
authored Oct 31, 2010
136 NetEConstEnum* NetEConstEnum::dup_expr() const
137 {
138 NetEConstEnum*tmp = new NetEConstEnum(scope_, name_, enum_set_, value());
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
139 ivl_assert(*this, tmp);
a14fa03 @steveicarus Enum names in r-value expressions
authored Oct 31, 2010
140 tmp->set_line(*this);
141 return tmp;
142 }
143
1222153 Keep parameter constants for the ivl_target API.
steve authored Mar 10, 2003
144 NetEConstParam* NetEConstParam::dup_expr() const
145 {
146 NetEConstParam*tmp = new NetEConstParam(scope_, name_, value());
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
147 ivl_assert(*this, tmp);
148 tmp->set_line(*this);
149 return tmp;
150 }
151
152 NetECReal* NetECReal::dup_expr() const
153 {
154 NetECReal*tmp = new NetECReal(value_);
155 ivl_assert(*this, tmp);
1222153 Keep parameter constants for the ivl_target API.
steve authored Mar 10, 2003
156 tmp->set_line(*this);
157 return tmp;
158 }
159
5903f07 Support parameters in real expressions and
steve authored May 30, 2003
160 NetECRealParam* NetECRealParam::dup_expr() const
161 {
162 NetECRealParam*tmp = new NetECRealParam(scope_, name_, value());
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
163 ivl_assert(*this, tmp);
5903f07 Support parameters in real expressions and
steve authored May 30, 2003
164 tmp->set_line(*this);
165 return tmp;
166 }
167
f1cc9d8 Support event names as expressions elements.
steve authored Apr 22, 2003
168 NetEEvent* NetEEvent::dup_expr() const
169 {
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
170 ivl_assert(*this, 0);
f1cc9d8 Support event names as expressions elements.
steve authored Apr 22, 2003
171 return 0;
172 }
173
de215f1 @steveicarus Describe enum type to code generators
authored Nov 20, 2010
174 NetENetenum* NetENetenum::dup_expr() const
175 {
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
176 ivl_assert(*this, 0);
de215f1 @steveicarus Describe enum type to code generators
authored Nov 20, 2010
177 return 0;
178 }
179
4cfa3e4 Support the creation of scopes.
steve authored Nov 27, 1999
180 NetEScope* NetEScope::dup_expr() const
181 {
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
182 ivl_assert(*this, 0);
4cfa3e4 Support the creation of scopes.
steve authored Nov 27, 1999
183 return 0;
184 }
185
364ffc9 Add support for bit select of parameters.
steve authored Jan 28, 2002
186 NetESelect* NetESelect::dup_expr() const
187 {
70c5c9f @caryr Propagate file and line information in more places.
caryr authored Feb 27, 2008
188 NetESelect*tmp = new NetESelect(expr_->dup_expr(),
189 base_? base_->dup_expr() : 0,
a6220fe @caryr Add support for passing variable indexed part select type information
caryr authored Feb 23, 2011
190 expr_width(), sel_type_);
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
191 ivl_assert(*this, tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored Feb 27, 2008
192 tmp->set_line(*this);
193 return tmp;
364ffc9 Add support for bit select of parameters.
steve authored Jan 28, 2002
194 }
195
fbe475e Add infrastructure for system functions, move
steve authored May 4, 2000
196 NetESFunc* NetESFunc::dup_expr() const
197 {
6d94f2e Better organize the NetESFunc return type guesses.
steve authored Mar 15, 2003
198 NetESFunc*tmp = new NetESFunc(name_, type_, expr_width(), nparms());
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
199 ivl_assert(*this, tmp);
b3529d8 Help system function signedness survive elaboration.
steve authored Jun 17, 2004
200
201 tmp->cast_signed(has_sign());
cfed393 Port close cropping behavior from mcrgb
steve authored Nov 19, 2001
202 for (unsigned idx = 0 ; idx < nparms() ; idx += 1) {
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
203 ivl_assert(*this, parm(idx));
c41fb50 @caryr Copy from the existing function when duping a system function.
caryr authored Oct 7, 2008
204 tmp->parm(idx, parm(idx)->dup_expr());
cfed393 Port close cropping behavior from mcrgb
steve authored Nov 19, 2001
205 }
b28f258 Import MCD support from Stephen Tell, and add
steve authored May 7, 2000
206
70c5c9f @caryr Propagate file and line information in more places.
caryr authored Feb 27, 2008
207 tmp->set_line(*this);
b28f258 Import MCD support from Stephen Tell, and add
steve authored May 7, 2000
208 return tmp;
fbe475e Add infrastructure for system functions, move
steve authored May 4, 2000
209 }
210
cfed393 Port close cropping behavior from mcrgb
steve authored Nov 19, 2001
211 NetESignal* NetESignal::dup_expr() const
212 {
ef9ee52 @caryr NetESignal::dup_expr() was not passing the word_ information.
caryr authored Mar 12, 2008
213 NetESignal*tmp = new NetESignal(net_, word_);
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
214 ivl_assert(*this, tmp);
cfed393 Port close cropping behavior from mcrgb
steve authored Nov 19, 2001
215 tmp->expr_width(expr_width());
ef9ee52 @caryr NetESignal::dup_expr() was not passing the word_ information.
caryr authored Mar 12, 2008
216 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored Nov 19, 2001
217 return tmp;
218 }
219
220 NetETernary* NetETernary::dup_expr() const
221 {
222 NetETernary*tmp = new NetETernary(cond_->dup_expr(),
223 true_val_->dup_expr(),
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
224 false_val_->dup_expr(),
225 expr_width(),
226 has_sign());
227 ivl_assert(*this, tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored Feb 27, 2008
228 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored Nov 19, 2001
229 return tmp;
230 }
231
588931f Add dup_expr for user defined function calls.
steve authored Nov 9, 2002
232 NetEUFunc* NetEUFunc::dup_expr() const
233 {
234 NetEUFunc*tmp;
235 svector<NetExpr*> tmp_parms (parms_.count());
236
237 for (unsigned idx = 0 ; idx < tmp_parms.count() ; idx += 1) {
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
238 ivl_assert(*this, parms_[idx]);
588931f Add dup_expr for user defined function calls.
steve authored Nov 9, 2002
239 tmp_parms[idx] = parms_[idx]->dup_expr();
240 }
241
1e9f968 @martinwhitaker First step towards supporting constant user functions.
martinwhitaker authored Apr 5, 2011
242 tmp = new NetEUFunc(scope_, func_, result_sig_->dup_expr(), tmp_parms,
243 need_const_);
588931f Add dup_expr for user defined function calls.
steve authored Nov 9, 2002
244
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
245 ivl_assert(*this, tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored Feb 27, 2008
246 tmp->set_line(*this);
588931f Add dup_expr for user defined function calls.
steve authored Nov 9, 2002
247 return tmp;
248 }
249
403a1e9 @steveicarus Add a dup_expr method to NetEUBits.
authored Oct 30, 2008
250 NetEUBits* NetEUBits::dup_expr() const
251 {
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
252 NetEUBits*tmp = new NetEUBits(op_, expr_->dup_expr(), expr_width(), has_sign());
253 ivl_assert(*this, tmp);
403a1e9 @steveicarus Add a dup_expr method to NetEUBits.
authored Oct 31, 2008
254 tmp->set_line(*this);
255 return tmp;
256 }
257
cfed393 Port close cropping behavior from mcrgb
steve authored Nov 19, 2001
258 NetEUnary* NetEUnary::dup_expr() const
259 {
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
260 NetEUnary*tmp = new NetEUnary(op_, expr_->dup_expr(), expr_width(), has_sign());
261 ivl_assert(*this, tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored Feb 27, 2008
262 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored Nov 19, 2001
263 return tmp;
264 }
265
7fd669f NetEUReduce has its own dup_expr method.
steve authored Oct 31, 2003
266 NetEUReduce* NetEUReduce::dup_expr() const
267 {
268 NetEUReduce*tmp = new NetEUReduce(op_, expr_->dup_expr());
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
269 ivl_assert(*this, tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored Feb 27, 2008
270 tmp->set_line(*this);
7fd669f NetEUReduce has its own dup_expr method.
steve authored Oct 31, 2003
271 return tmp;
272 }
21d15ce @caryr Fix the compiler and modpath scaling of real delays.
caryr authored Jun 18, 2010
273
274 NetECast* NetECast::dup_expr() const
275 {
312b4da @martinwhitaker Expression width rework.
martinwhitaker authored Feb 26, 2011
276 NetECast*tmp = new NetECast(op_, expr_->dup_expr(), expr_width(), has_sign());
277 ivl_assert(*this, tmp);
21d15ce @caryr Fix the compiler and modpath scaling of real delays.
caryr authored Jun 18, 2010
278 tmp->set_line(*this);
279 return tmp;
280 }
Something went wrong with that request. Please try again.