Skip to content

HTTPS clone URL

Subversion checkout URL

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