Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 180 lines (155 sloc) 4.359 kB
4cfa3e4 Support the creation of scopes.
steve authored
1 /*
1993bf6 @caryr Remove malloc.h support and for C++ files use <c...> include files.
caryr authored
2 * Copyright (c) 1999-2010 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 */
19
b825f8d Create a config.h.in file to hold all the config
steve authored
20 # include "config.h"
21
4cfa3e4 Support the creation of scopes.
steve authored
22 # include "netlist.h"
23 # include <cassert>
1993bf6 @caryr Remove malloc.h support and for C++ files use <c...> include files.
caryr authored
24 # include <cstdlib>
9f04641 @steveicarus Detect and elaborate AMS access functions.
authored
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
29 NetEAccess*tmp = new NetEAccess(branch_, nature_);
9f04641 @steveicarus Detect and elaborate AMS access functions.
authored
30 ivl_assert(*this, tmp);
31 tmp->set_line(*this);
32 return tmp;
33 }
4cfa3e4 Support the creation of scopes.
steve authored
34
c602d94 Comparison operators do have defined width.
steve authored
35 NetEBComp* NetEBComp::dup_expr() const
36 {
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
37 NetEBComp*tmp = new NetEBComp(op_, left_->dup_expr(),
38 right_->dup_expr());
39 assert(tmp);
40 tmp->set_line(*this);
41 return tmp;
c602d94 Comparison operators do have defined width.
steve authored
42 }
43
1222153 Keep parameter constants for the ivl_target API.
steve authored
44 NetEConst* NetEConst::dup_expr() const
45 {
46 NetEConst*tmp = new NetEConst(value_);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
47 assert(tmp);
1222153 Keep parameter constants for the ivl_target API.
steve authored
48 tmp->set_line(*this);
49 return tmp;
50 }
51
a14fa03 @steveicarus Enum names in r-value expressions
authored
52 NetEConstEnum* NetEConstEnum::dup_expr() const
53 {
54 NetEConstEnum*tmp = new NetEConstEnum(scope_, name_, enum_set_, value());
55 assert(tmp);
56 tmp->set_line(*this);
57 return tmp;
58 }
59
1222153 Keep parameter constants for the ivl_target API.
steve authored
60 NetEConstParam* NetEConstParam::dup_expr() const
61 {
62 NetEConstParam*tmp = new NetEConstParam(scope_, name_, value());
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
63 assert(tmp);
1222153 Keep parameter constants for the ivl_target API.
steve authored
64 tmp->set_line(*this);
65 return tmp;
66 }
67
5903f07 Support parameters in real expressions and
steve authored
68 NetECRealParam* NetECRealParam::dup_expr() const
69 {
70 NetECRealParam*tmp = new NetECRealParam(scope_, name_, value());
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
71 assert(tmp);
5903f07 Support parameters in real expressions and
steve authored
72 tmp->set_line(*this);
73 return tmp;
74 }
75
f1cc9d8 Support event names as expressions elements.
steve authored
76 NetEEvent* NetEEvent::dup_expr() const
77 {
78 assert(0);
79 return 0;
80 }
81
4cfa3e4 Support the creation of scopes.
steve authored
82 NetEScope* NetEScope::dup_expr() const
83 {
84 assert(0);
85 return 0;
86 }
87
364ffc9 Add support for bit select of parameters.
steve authored
88 NetESelect* NetESelect::dup_expr() const
89 {
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
90 NetESelect*tmp = new NetESelect(expr_->dup_expr(),
91 base_? base_->dup_expr() : 0,
92 expr_width());
93 assert(tmp);
94 tmp->set_line(*this);
95 return tmp;
364ffc9 Add support for bit select of parameters.
steve authored
96 }
97
fbe475e Add infrastructure for system functions, move
steve authored
98 NetESFunc* NetESFunc::dup_expr() const
99 {
6d94f2e Better organize the NetESFunc return type guesses.
steve authored
100 NetESFunc*tmp = new NetESFunc(name_, type_, expr_width(), nparms());
cfed393 Port close cropping behavior from mcrgb
steve authored
101 assert(tmp);
b3529d8 Help system function signedness survive elaboration.
steve authored
102
103 tmp->cast_signed(has_sign());
cfed393 Port close cropping behavior from mcrgb
steve authored
104 for (unsigned idx = 0 ; idx < nparms() ; idx += 1) {
c41fb50 @caryr Copy from the existing function when duping a system function.
caryr authored
105 assert(parm(idx));
106 tmp->parm(idx, parm(idx)->dup_expr());
cfed393 Port close cropping behavior from mcrgb
steve authored
107 }
b28f258 Import MCD support from Stephen Tell, and add
steve authored
108
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
109 tmp->set_line(*this);
b28f258 Import MCD support from Stephen Tell, and add
steve authored
110 return tmp;
fbe475e Add infrastructure for system functions, move
steve authored
111 }
112
cfed393 Port close cropping behavior from mcrgb
steve authored
113 NetESignal* NetESignal::dup_expr() const
114 {
ef9ee52 @caryr NetESignal::dup_expr() was not passing the word_ information.
caryr authored
115 NetESignal*tmp = new NetESignal(net_, word_);
cfed393 Port close cropping behavior from mcrgb
steve authored
116 assert(tmp);
117 tmp->expr_width(expr_width());
ef9ee52 @caryr NetESignal::dup_expr() was not passing the word_ information.
caryr authored
118 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored
119 return tmp;
120 }
121
122 NetETernary* NetETernary::dup_expr() const
123 {
124 NetETernary*tmp = new NetETernary(cond_->dup_expr(),
125 true_val_->dup_expr(),
126 false_val_->dup_expr());
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
127 assert(tmp);
128 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored
129 return tmp;
130 }
131
588931f Add dup_expr for user defined function calls.
steve authored
132 NetEUFunc* NetEUFunc::dup_expr() const
133 {
134 NetEUFunc*tmp;
135 svector<NetExpr*> tmp_parms (parms_.count());
136
137 for (unsigned idx = 0 ; idx < tmp_parms.count() ; idx += 1) {
138 assert(parms_[idx]);
139 tmp_parms[idx] = parms_[idx]->dup_expr();
140 }
141
fac1cc5 @caryr Add user function synth and clean up expression code.
caryr authored
142 tmp = new NetEUFunc(scope_, func_, result_sig_->dup_expr(), tmp_parms);
588931f Add dup_expr for user defined function calls.
steve authored
143
5472b27 Rewire/generalize parsing an elaboration of
steve authored
144 assert(tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
145 tmp->set_line(*this);
588931f Add dup_expr for user defined function calls.
steve authored
146 return tmp;
147 }
148
403a1e9 @steveicarus Add a dup_expr method to NetEUBits.
authored
149 NetEUBits* NetEUBits::dup_expr() const
150 {
151 NetEUBits*tmp = new NetEUBits(op_, expr_->dup_expr());
152 assert(tmp);
153 tmp->set_line(*this);
154 return tmp;
155 }
156
cfed393 Port close cropping behavior from mcrgb
steve authored
157 NetEUnary* NetEUnary::dup_expr() const
158 {
159 NetEUnary*tmp = new NetEUnary(op_, expr_->dup_expr());
160 assert(tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
161 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored
162 return tmp;
163 }
164
7fd669f NetEUReduce has its own dup_expr method.
steve authored
165 NetEUReduce* NetEUReduce::dup_expr() const
166 {
167 NetEUReduce*tmp = new NetEUReduce(op_, expr_->dup_expr());
168 assert(tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
169 tmp->set_line(*this);
7fd669f NetEUReduce has its own dup_expr method.
steve authored
170 return tmp;
171 }
21d15ce @caryr Fix the compiler and modpath scaling of real delays.
caryr authored
172
173 NetECast* NetECast::dup_expr() const
174 {
175 NetECast*tmp = new NetECast(op_, expr_->dup_expr());
176 assert(tmp);
177 tmp->set_line(*this);
178 return tmp;
179 }
Something went wrong with that request. Please try again.