Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 186 lines (160 sloc) 4.451 kB
4cfa3e4 Support the creation of scopes.
steve authored
1 /*
a6220fe @caryr Add support for passing variable indexed part select type information
caryr authored
2 * Copyright (c) 1999-2011 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
de215f1 @steveicarus Describe enum type to code generators
authored
82 NetENetenum* NetENetenum::dup_expr() const
83 {
84 assert(0);
85 return 0;
86 }
87
4cfa3e4 Support the creation of scopes.
steve authored
88 NetEScope* NetEScope::dup_expr() const
89 {
90 assert(0);
91 return 0;
92 }
93
364ffc9 Add support for bit select of parameters.
steve authored
94 NetESelect* NetESelect::dup_expr() const
95 {
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
96 NetESelect*tmp = new NetESelect(expr_->dup_expr(),
97 base_? base_->dup_expr() : 0,
a6220fe @caryr Add support for passing variable indexed part select type information
caryr authored
98 expr_width(), sel_type_);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
99 assert(tmp);
100 tmp->set_line(*this);
101 return tmp;
364ffc9 Add support for bit select of parameters.
steve authored
102 }
103
fbe475e Add infrastructure for system functions, move
steve authored
104 NetESFunc* NetESFunc::dup_expr() const
105 {
6d94f2e Better organize the NetESFunc return type guesses.
steve authored
106 NetESFunc*tmp = new NetESFunc(name_, type_, expr_width(), nparms());
cfed393 Port close cropping behavior from mcrgb
steve authored
107 assert(tmp);
b3529d8 Help system function signedness survive elaboration.
steve authored
108
109 tmp->cast_signed(has_sign());
cfed393 Port close cropping behavior from mcrgb
steve authored
110 for (unsigned idx = 0 ; idx < nparms() ; idx += 1) {
c41fb50 @caryr Copy from the existing function when duping a system function.
caryr authored
111 assert(parm(idx));
112 tmp->parm(idx, parm(idx)->dup_expr());
cfed393 Port close cropping behavior from mcrgb
steve authored
113 }
b28f258 Import MCD support from Stephen Tell, and add
steve authored
114
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
115 tmp->set_line(*this);
b28f258 Import MCD support from Stephen Tell, and add
steve authored
116 return tmp;
fbe475e Add infrastructure for system functions, move
steve authored
117 }
118
cfed393 Port close cropping behavior from mcrgb
steve authored
119 NetESignal* NetESignal::dup_expr() const
120 {
ef9ee52 @caryr NetESignal::dup_expr() was not passing the word_ information.
caryr authored
121 NetESignal*tmp = new NetESignal(net_, word_);
cfed393 Port close cropping behavior from mcrgb
steve authored
122 assert(tmp);
123 tmp->expr_width(expr_width());
ef9ee52 @caryr NetESignal::dup_expr() was not passing the word_ information.
caryr authored
124 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored
125 return tmp;
126 }
127
128 NetETernary* NetETernary::dup_expr() const
129 {
130 NetETernary*tmp = new NetETernary(cond_->dup_expr(),
131 true_val_->dup_expr(),
132 false_val_->dup_expr());
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
133 assert(tmp);
134 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored
135 return tmp;
136 }
137
588931f Add dup_expr for user defined function calls.
steve authored
138 NetEUFunc* NetEUFunc::dup_expr() const
139 {
140 NetEUFunc*tmp;
141 svector<NetExpr*> tmp_parms (parms_.count());
142
143 for (unsigned idx = 0 ; idx < tmp_parms.count() ; idx += 1) {
144 assert(parms_[idx]);
145 tmp_parms[idx] = parms_[idx]->dup_expr();
146 }
147
fac1cc5 @caryr Add user function synth and clean up expression code.
caryr authored
148 tmp = new NetEUFunc(scope_, func_, result_sig_->dup_expr(), tmp_parms);
588931f Add dup_expr for user defined function calls.
steve authored
149
5472b27 Rewire/generalize parsing an elaboration of
steve authored
150 assert(tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
151 tmp->set_line(*this);
588931f Add dup_expr for user defined function calls.
steve authored
152 return tmp;
153 }
154
403a1e9 @steveicarus Add a dup_expr method to NetEUBits.
authored
155 NetEUBits* NetEUBits::dup_expr() const
156 {
157 NetEUBits*tmp = new NetEUBits(op_, expr_->dup_expr());
158 assert(tmp);
159 tmp->set_line(*this);
160 return tmp;
161 }
162
cfed393 Port close cropping behavior from mcrgb
steve authored
163 NetEUnary* NetEUnary::dup_expr() const
164 {
165 NetEUnary*tmp = new NetEUnary(op_, expr_->dup_expr());
166 assert(tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
167 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored
168 return tmp;
169 }
170
7fd669f NetEUReduce has its own dup_expr method.
steve authored
171 NetEUReduce* NetEUReduce::dup_expr() const
172 {
173 NetEUReduce*tmp = new NetEUReduce(op_, expr_->dup_expr());
174 assert(tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
175 tmp->set_line(*this);
7fd669f NetEUReduce has its own dup_expr method.
steve authored
176 return tmp;
177 }
21d15ce @caryr Fix the compiler and modpath scaling of real delays.
caryr authored
178
179 NetECast* NetECast::dup_expr() const
180 {
181 NetECast*tmp = new NetECast(op_, expr_->dup_expr());
182 assert(tmp);
183 tmp->set_line(*this);
184 return tmp;
185 }
Something went wrong with that request. Please try again.