Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 215 lines (191 sloc) 5.909 kb
4cfa3e4 Support the creation of scopes.
steve authored
1 /*
588931f Add dup_expr for user defined function calls.
steve authored
2 * Copyright (c) 1999-2002 Stephen Williams (steve@icarus.com)
4cfa3e4 Support the creation of scopes.
steve authored
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 */
52bf4e6 conditional ident string using autoconfig.
steve authored
19 #ifdef HAVE_CVS_IDENT
aa3cbbd Error message for condit expression not synthesized.
steve authored
20 #ident "$Id: dup_expr.cc,v 1.18.2.2 2006/11/02 02:13:15 steve Exp $"
4cfa3e4 Support the creation of scopes.
steve authored
21 #endif
22
b825f8d Create a config.h.in file to hold all the config
steve authored
23 # include "config.h"
24
4cfa3e4 Support the creation of scopes.
steve authored
25 # include "netlist.h"
26 # include <cassert>
27
c602d94 Comparison operators do have defined width.
steve authored
28 NetEBComp* NetEBComp::dup_expr() const
29 {
30 NetEBComp*result = new NetEBComp(op_, left_->dup_expr(),
31 right_->dup_expr());
aa3cbbd Error message for condit expression not synthesized.
steve authored
32 result->set_line(*this);
c602d94 Comparison operators do have defined width.
steve authored
33 return result;
34 }
35
1222153 Keep parameter constants for the ivl_target API.
steve authored
36 NetEConst* NetEConst::dup_expr() const
37 {
38 NetEConst*tmp = new NetEConst(value_);
39 tmp->set_line(*this);
40 return tmp;
41 }
42
43 NetEConstParam* NetEConstParam::dup_expr() const
44 {
45 NetEConstParam*tmp = new NetEConstParam(scope_, name_, value());
46 tmp->set_line(*this);
47 return tmp;
48 }
49
5903f07 Support parameters in real expressions and
steve authored
50 NetECRealParam* NetECRealParam::dup_expr() const
51 {
52 NetECRealParam*tmp = new NetECRealParam(scope_, name_, value());
53 tmp->set_line(*this);
54 return tmp;
55 }
56
f1cc9d8 Support event names as expressions elements.
steve authored
57 NetEEvent* NetEEvent::dup_expr() const
58 {
59 assert(0);
60 return 0;
61 }
62
4cfa3e4 Support the creation of scopes.
steve authored
63 NetEScope* NetEScope::dup_expr() const
64 {
65 assert(0);
66 return 0;
67 }
68
364ffc9 Add support for bit select of parameters.
steve authored
69 NetESelect* NetESelect::dup_expr() const
70 {
71 return new NetESelect(expr_->dup_expr(), base_->dup_expr(),
72 expr_width());
73 }
74
fbe475e Add infrastructure for system functions, move
steve authored
75 NetESFunc* NetESFunc::dup_expr() const
76 {
6d94f2e Better organize the NetESFunc return type guesses.
steve authored
77 NetESFunc*tmp = new NetESFunc(name_, type_, expr_width(), nparms());
cfed393 Port close cropping behavior from mcrgb
steve authored
78 assert(tmp);
b3529d8 Help system function signedness survive elaboration.
steve authored
79
80 tmp->cast_signed(has_sign());
cfed393 Port close cropping behavior from mcrgb
steve authored
81 for (unsigned idx = 0 ; idx < nparms() ; idx += 1) {
82 assert(tmp->parm(idx));
b28f258 Import MCD support from Stephen Tell, and add
steve authored
83 tmp->parm(idx, tmp->parm(idx)->dup_expr());
cfed393 Port close cropping behavior from mcrgb
steve authored
84 }
b28f258 Import MCD support from Stephen Tell, and add
steve authored
85
86 return tmp;
fbe475e Add infrastructure for system functions, move
steve authored
87 }
88
cfed393 Port close cropping behavior from mcrgb
steve authored
89 NetESignal* NetESignal::dup_expr() const
90 {
91 NetESignal*tmp = new NetESignal(net_, msi_, lsi_);
92 assert(tmp);
93 tmp->expr_width(expr_width());
35e5cea Add support for -Wunused warnings.
steve authored
94 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored
95 return tmp;
96 }
97
98 NetETernary* NetETernary::dup_expr() const
99 {
100 NetETernary*tmp = new NetETernary(cond_->dup_expr(),
101 true_val_->dup_expr(),
102 false_val_->dup_expr());
103 return tmp;
104 }
105
588931f Add dup_expr for user defined function calls.
steve authored
106 NetEUFunc* NetEUFunc::dup_expr() const
107 {
108 NetEUFunc*tmp;
109 svector<NetExpr*> tmp_parms (parms_.count());
110
111 for (unsigned idx = 0 ; idx < tmp_parms.count() ; idx += 1) {
112 assert(parms_[idx]);
113 tmp_parms[idx] = parms_[idx]->dup_expr();
114 }
115
5472b27 Rewire/generalize parsing an elaboration of
steve authored
116 tmp = 0;
117 if (result_sig_)
118 tmp = new NetEUFunc(func_, result_sig_->dup_expr(), tmp_parms);
119 if (result_var_)
120 tmp = new NetEUFunc(func_, result_var_->dup_expr(), tmp_parms);
588931f Add dup_expr for user defined function calls.
steve authored
121
5472b27 Rewire/generalize parsing an elaboration of
steve authored
122 assert(tmp);
aa3cbbd Error message for condit expression not synthesized.
steve authored
123 tmp->set_line(*this);
588931f Add dup_expr for user defined function calls.
steve authored
124 return tmp;
125 }
126
cfed393 Port close cropping behavior from mcrgb
steve authored
127 NetEUnary* NetEUnary::dup_expr() const
128 {
129 NetEUnary*tmp = new NetEUnary(op_, expr_->dup_expr());
130 assert(tmp);
131 return tmp;
132 }
133
7fd669f NetEUReduce has its own dup_expr method.
steve authored
134 NetEUReduce* NetEUReduce::dup_expr() const
135 {
136 NetEUReduce*tmp = new NetEUReduce(op_, expr_->dup_expr());
137 assert(tmp);
138 return tmp;
139 }
140
46253ed Rework expression parsing and elaboration to
steve authored
141 NetEVariable* NetEVariable::dup_expr() const
142 {
143 NetEVariable*tmp = new NetEVariable(var_);
144 return tmp;
145 }
146
4cfa3e4 Support the creation of scopes.
steve authored
147 /*
148 * $Log: dup_expr.cc,v $
aa3cbbd Error message for condit expression not synthesized.
steve authored
149 * Revision 1.18.2.2 2006/11/02 02:13:15 steve
150 * Error message for condit expression not synthesized.
151 *
35e5cea Add support for -Wunused warnings.
steve authored
152 * Revision 1.18.2.1 2006/06/12 00:16:50 steve
153 * Add support for -Wunused warnings.
154 *
b3529d8 Help system function signedness survive elaboration.
steve authored
155 * Revision 1.18 2004/06/17 16:06:18 steve
156 * Help system function signedness survive elaboration.
157 *
5472b27 Rewire/generalize parsing an elaboration of
steve authored
158 * Revision 1.17 2004/05/31 23:34:36 steve
159 * Rewire/generalize parsing an elaboration of
160 * function return values to allow for better
161 * speed and more type support.
162 *
7fd669f NetEUReduce has its own dup_expr method.
steve authored
163 * Revision 1.16 2003/10/31 02:47:11 steve
164 * NetEUReduce has its own dup_expr method.
165 *
5903f07 Support parameters in real expressions and
steve authored
166 * Revision 1.15 2003/05/30 02:55:32 steve
167 * Support parameters in real expressions and
168 * as real expressions, and fix multiply and
169 * divide with real results.
170 *
f1cc9d8 Support event names as expressions elements.
steve authored
171 * Revision 1.14 2003/04/22 04:48:29 steve
172 * Support event names as expressions elements.
173 *
c602d94 Comparison operators do have defined width.
steve authored
174 * Revision 1.13 2003/03/15 18:08:43 steve
175 * Comparison operators do have defined width.
176 *
6d94f2e Better organize the NetESFunc return type guesses.
steve authored
177 * Revision 1.12 2003/03/15 04:46:28 steve
178 * Better organize the NetESFunc return type guesses.
179 *
1222153 Keep parameter constants for the ivl_target API.
steve authored
180 * Revision 1.11 2003/03/10 23:40:53 steve
181 * Keep parameter constants for the ivl_target API.
182 *
46253ed Rework expression parsing and elaboration to
steve authored
183 * Revision 1.10 2003/01/26 21:15:58 steve
184 * Rework expression parsing and elaboration to
185 * accommodate real/realtime values and expressions.
186 *
588931f Add dup_expr for user defined function calls.
steve authored
187 * Revision 1.9 2002/11/09 00:25:27 steve
188 * Add dup_expr for user defined function calls.
189 *
52bf4e6 conditional ident string using autoconfig.
steve authored
190 * Revision 1.8 2002/08/12 01:34:58 steve
191 * conditional ident string using autoconfig.
192 *
364ffc9 Add support for bit select of parameters.
steve authored
193 * Revision 1.7 2002/01/28 00:52:41 steve
194 * Add support for bit select of parameters.
195 * This leads to a NetESelect node and the
196 * vvp code generator to support that.
197 *
cfed393 Port close cropping behavior from mcrgb
steve authored
198 * Revision 1.6 2001/11/19 01:54:14 steve
199 * Port close cropping behavior from mcrgb
200 * Move window array reset to libmc.
201 *
b825f8d Create a config.h.in file to hold all the config
steve authored
202 * Revision 1.5 2001/07/25 03:10:48 steve
203 * Create a config.h.in file to hold all the config
204 * junk, and support gcc 3.0. (Stephan Boettcher)
205 *
b28f258 Import MCD support from Stephen Tell, and add
steve authored
206 * Revision 1.4 2000/05/07 18:20:07 steve
207 * Import MCD support from Stephen Tell, and add
208 * system function parameter support to the IVL core.
209 *
fbe475e Add infrastructure for system functions, move
steve authored
210 * Revision 1.3 2000/05/04 03:37:58 steve
211 * Add infrastructure for system functions, move
212 * $time to that structure and add $random.
4cfa3e4 Support the creation of scopes.
steve authored
213 */
214
Something went wrong with that request. Please try again.