Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 146 lines (125 sloc) 3.61 kb
4cfa3e4 Support the creation of scopes.
steve authored
1 /*
fac1cc5 @caryr Add user function synth and clean up expression code.
caryr authored
2 * Copyright (c) 1999-2008 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>
24
c602d94 Comparison operators do have defined width.
steve authored
25 NetEBComp* NetEBComp::dup_expr() const
26 {
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
27 NetEBComp*tmp = new NetEBComp(op_, left_->dup_expr(),
28 right_->dup_expr());
29 assert(tmp);
30 tmp->set_line(*this);
31 return tmp;
c602d94 Comparison operators do have defined width.
steve authored
32 }
33
1222153 Keep parameter constants for the ivl_target API.
steve authored
34 NetEConst* NetEConst::dup_expr() const
35 {
36 NetEConst*tmp = new NetEConst(value_);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
37 assert(tmp);
1222153 Keep parameter constants for the ivl_target API.
steve authored
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());
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
45 assert(tmp);
1222153 Keep parameter constants for the ivl_target API.
steve authored
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());
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
53 assert(tmp);
5903f07 Support parameters in real expressions and
steve authored
54 tmp->set_line(*this);
55 return tmp;
56 }
57
f1cc9d8 Support event names as expressions elements.
steve authored
58 NetEEvent* NetEEvent::dup_expr() const
59 {
60 assert(0);
61 return 0;
62 }
63
4cfa3e4 Support the creation of scopes.
steve authored
64 NetEScope* NetEScope::dup_expr() const
65 {
66 assert(0);
67 return 0;
68 }
69
364ffc9 Add support for bit select of parameters.
steve authored
70 NetESelect* NetESelect::dup_expr() const
71 {
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
72 NetESelect*tmp = new NetESelect(expr_->dup_expr(),
73 base_? base_->dup_expr() : 0,
74 expr_width());
75 assert(tmp);
76 tmp->set_line(*this);
77 return tmp;
364ffc9 Add support for bit select of parameters.
steve authored
78 }
79
fbe475e Add infrastructure for system functions, move
steve authored
80 NetESFunc* NetESFunc::dup_expr() const
81 {
6d94f2e Better organize the NetESFunc return type guesses.
steve authored
82 NetESFunc*tmp = new NetESFunc(name_, type_, expr_width(), nparms());
cfed393 Port close cropping behavior from mcrgb
steve authored
83 assert(tmp);
b3529d8 Help system function signedness survive elaboration.
steve authored
84
85 tmp->cast_signed(has_sign());
cfed393 Port close cropping behavior from mcrgb
steve authored
86 for (unsigned idx = 0 ; idx < nparms() ; idx += 1) {
87 assert(tmp->parm(idx));
b28f258 Import MCD support from Stephen Tell, and add
steve authored
88 tmp->parm(idx, tmp->parm(idx)->dup_expr());
cfed393 Port close cropping behavior from mcrgb
steve authored
89 }
b28f258 Import MCD support from Stephen Tell, and add
steve authored
90
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
91 tmp->set_line(*this);
b28f258 Import MCD support from Stephen Tell, and add
steve authored
92 return tmp;
fbe475e Add infrastructure for system functions, move
steve authored
93 }
94
cfed393 Port close cropping behavior from mcrgb
steve authored
95 NetESignal* NetESignal::dup_expr() const
96 {
ef9ee52 @caryr NetESignal::dup_expr() was not passing the word_ information.
caryr authored
97 NetESignal*tmp = new NetESignal(net_, word_);
cfed393 Port close cropping behavior from mcrgb
steve authored
98 assert(tmp);
99 tmp->expr_width(expr_width());
ef9ee52 @caryr NetESignal::dup_expr() was not passing the word_ information.
caryr authored
100 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored
101 return tmp;
102 }
103
104 NetETernary* NetETernary::dup_expr() const
105 {
106 NetETernary*tmp = new NetETernary(cond_->dup_expr(),
107 true_val_->dup_expr(),
108 false_val_->dup_expr());
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
109 assert(tmp);
110 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored
111 return tmp;
112 }
113
588931f Add dup_expr for user defined function calls.
steve authored
114 NetEUFunc* NetEUFunc::dup_expr() const
115 {
116 NetEUFunc*tmp;
117 svector<NetExpr*> tmp_parms (parms_.count());
118
119 for (unsigned idx = 0 ; idx < tmp_parms.count() ; idx += 1) {
120 assert(parms_[idx]);
121 tmp_parms[idx] = parms_[idx]->dup_expr();
122 }
123
fac1cc5 @caryr Add user function synth and clean up expression code.
caryr authored
124 tmp = new NetEUFunc(scope_, func_, result_sig_->dup_expr(), tmp_parms);
588931f Add dup_expr for user defined function calls.
steve authored
125
5472b27 Rewire/generalize parsing an elaboration of
steve authored
126 assert(tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
127 tmp->set_line(*this);
588931f Add dup_expr for user defined function calls.
steve authored
128 return tmp;
129 }
130
cfed393 Port close cropping behavior from mcrgb
steve authored
131 NetEUnary* NetEUnary::dup_expr() const
132 {
133 NetEUnary*tmp = new NetEUnary(op_, expr_->dup_expr());
134 assert(tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
135 tmp->set_line(*this);
cfed393 Port close cropping behavior from mcrgb
steve authored
136 return tmp;
137 }
138
7fd669f NetEUReduce has its own dup_expr method.
steve authored
139 NetEUReduce* NetEUReduce::dup_expr() const
140 {
141 NetEUReduce*tmp = new NetEUReduce(op_, expr_->dup_expr());
142 assert(tmp);
70c5c9f @caryr Propagate file and line information in more places.
caryr authored
143 tmp->set_line(*this);
7fd669f NetEUReduce has its own dup_expr method.
steve authored
144 return tmp;
145 }
Something went wrong with that request. Please try again.