Skip to content
This repository
Newer
Older
100644 155 lines (134 sloc) 3.837 kb
4cfa3e40 » steve
1999-11-27 Support the creation of scopes.
1 /*
fac1cc5a » caryr
2008-02-22 Add user function synth and clean up expression code.
2 * Copyright (c) 1999-2008 Stephen Williams (steve@icarus.com)
4cfa3e40 » steve
1999-11-27 Support the creation of scopes.
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
b825f8d2 » steve
2001-07-25 Create a config.h.in file to hold all the config
20 # include "config.h"
21
4cfa3e40 » steve
1999-11-27 Support the creation of scopes.
22 # include "netlist.h"
23 # include <cassert>
23127852 » ldoolitt
2008-08-31 Compatibility with gcc-4.3
24 # include <stdlib.h>
9f04641f »
2008-07-30 Detect and elaborate AMS access functions.
25 # include "ivl_assert.h"
26
27 NetEAccess* NetEAccess::dup_expr() const
28 {
b292a5fc »
2008-08-04 Create a branch object to be the argument to the access function.
29 NetEAccess*tmp = new NetEAccess(branch_, nature_);
9f04641f »
2008-07-30 Detect and elaborate AMS access functions.
30 ivl_assert(*this, tmp);
31 tmp->set_line(*this);
32 return tmp;
33 }
4cfa3e40 » steve
1999-11-27 Support the creation of scopes.
34
c602d94c » steve
2003-03-15 Comparison operators do have defined width.
35 NetEBComp* NetEBComp::dup_expr() const
36 {
70c5c9fe » caryr
2008-02-27 Propagate file and line information in more places.
37 NetEBComp*tmp = new NetEBComp(op_, left_->dup_expr(),
38 right_->dup_expr());
39 assert(tmp);
40 tmp->set_line(*this);
41 return tmp;
c602d94c » steve
2003-03-15 Comparison operators do have defined width.
42 }
43
1222153c » steve
2003-03-10 Keep parameter constants for the ivl_target API.
44 NetEConst* NetEConst::dup_expr() const
45 {
46 NetEConst*tmp = new NetEConst(value_);
70c5c9fe » caryr
2008-02-27 Propagate file and line information in more places.
47 assert(tmp);
1222153c » steve
2003-03-10 Keep parameter constants for the ivl_target API.
48 tmp->set_line(*this);
49 return tmp;
50 }
51
52 NetEConstParam* NetEConstParam::dup_expr() const
53 {
54 NetEConstParam*tmp = new NetEConstParam(scope_, name_, value());
70c5c9fe » caryr
2008-02-27 Propagate file and line information in more places.
55 assert(tmp);
1222153c » steve
2003-03-10 Keep parameter constants for the ivl_target API.
56 tmp->set_line(*this);
57 return tmp;
58 }
59
5903f074 » steve
2003-05-30 Support parameters in real expressions and
60 NetECRealParam* NetECRealParam::dup_expr() const
61 {
62 NetECRealParam*tmp = new NetECRealParam(scope_, name_, value());
70c5c9fe » caryr
2008-02-27 Propagate file and line information in more places.
63 assert(tmp);
5903f074 » steve
2003-05-30 Support parameters in real expressions and
64 tmp->set_line(*this);
65 return tmp;
66 }
67
f1cc9d86 » steve
2003-04-22 Support event names as expressions elements.
68 NetEEvent* NetEEvent::dup_expr() const
69 {
70 assert(0);
71 return 0;
72 }
73
4cfa3e40 » steve
1999-11-27 Support the creation of scopes.
74 NetEScope* NetEScope::dup_expr() const
75 {
76 assert(0);
77 return 0;
78 }
79
364ffc90 » steve
2002-01-28 Add support for bit select of parameters.
80 NetESelect* NetESelect::dup_expr() const
81 {
70c5c9fe » caryr
2008-02-27 Propagate file and line information in more places.
82 NetESelect*tmp = new NetESelect(expr_->dup_expr(),
83 base_? base_->dup_expr() : 0,
84 expr_width());
85 assert(tmp);
86 tmp->set_line(*this);
87 return tmp;
364ffc90 » steve
2002-01-28 Add support for bit select of parameters.
88 }
89
fbe475ef » steve
2000-05-04 Add infrastructure for system functions, move
90 NetESFunc* NetESFunc::dup_expr() const
91 {
6d94f2ea » steve
2003-03-15 Better organize the NetESFunc return type guesses.
92 NetESFunc*tmp = new NetESFunc(name_, type_, expr_width(), nparms());
cfed3933 » steve
2001-11-19 Port close cropping behavior from mcrgb
93 assert(tmp);
b3529d85 » steve
2004-06-17 Help system function signedness survive elaboration.
94
95 tmp->cast_signed(has_sign());
cfed3933 » steve
2001-11-19 Port close cropping behavior from mcrgb
96 for (unsigned idx = 0 ; idx < nparms() ; idx += 1) {
97 assert(tmp->parm(idx));
b28f2584 » steve
2000-05-07 Import MCD support from Stephen Tell, and add
98 tmp->parm(idx, tmp->parm(idx)->dup_expr());
cfed3933 » steve
2001-11-19 Port close cropping behavior from mcrgb
99 }
b28f2584 » steve
2000-05-07 Import MCD support from Stephen Tell, and add
100
70c5c9fe » caryr
2008-02-27 Propagate file and line information in more places.
101 tmp->set_line(*this);
b28f2584 » steve
2000-05-07 Import MCD support from Stephen Tell, and add
102 return tmp;
fbe475ef » steve
2000-05-04 Add infrastructure for system functions, move
103 }
104
cfed3933 » steve
2001-11-19 Port close cropping behavior from mcrgb
105 NetESignal* NetESignal::dup_expr() const
106 {
ef9ee52e » caryr
2008-03-12 NetESignal::dup_expr() was not passing the word_ information.
107 NetESignal*tmp = new NetESignal(net_, word_);
cfed3933 » steve
2001-11-19 Port close cropping behavior from mcrgb
108 assert(tmp);
109 tmp->expr_width(expr_width());
ef9ee52e » caryr
2008-03-12 NetESignal::dup_expr() was not passing the word_ information.
110 tmp->set_line(*this);
cfed3933 » steve
2001-11-19 Port close cropping behavior from mcrgb
111 return tmp;
112 }
113
114 NetETernary* NetETernary::dup_expr() const
115 {
116 NetETernary*tmp = new NetETernary(cond_->dup_expr(),
117 true_val_->dup_expr(),
118 false_val_->dup_expr());
70c5c9fe » caryr
2008-02-27 Propagate file and line information in more places.
119 assert(tmp);
120 tmp->set_line(*this);
cfed3933 » steve
2001-11-19 Port close cropping behavior from mcrgb
121 return tmp;
122 }
123
588931fc » steve
2002-11-09 Add dup_expr for user defined function calls.
124 NetEUFunc* NetEUFunc::dup_expr() const
125 {
126 NetEUFunc*tmp;
127 svector<NetExpr*> tmp_parms (parms_.count());
128
129 for (unsigned idx = 0 ; idx < tmp_parms.count() ; idx += 1) {
130 assert(parms_[idx]);
131 tmp_parms[idx] = parms_[idx]->dup_expr();
132 }
133
fac1cc5a » caryr
2008-02-22 Add user function synth and clean up expression code.
134 tmp = new NetEUFunc(scope_, func_, result_sig_->dup_expr(), tmp_parms);
588931fc » steve
2002-11-09 Add dup_expr for user defined function calls.
135
5472b27e » steve
2004-05-31 Rewire/generalize parsing an elaboration of
136 assert(tmp);
70c5c9fe » caryr
2008-02-27 Propagate file and line information in more places.
137 tmp->set_line(*this);
588931fc » steve
2002-11-09 Add dup_expr for user defined function calls.
138 return tmp;
139 }
140
cfed3933 » steve
2001-11-19 Port close cropping behavior from mcrgb
141 NetEUnary* NetEUnary::dup_expr() const
142 {
143 NetEUnary*tmp = new NetEUnary(op_, expr_->dup_expr());
144 assert(tmp);
70c5c9fe » caryr
2008-02-27 Propagate file and line information in more places.
145 tmp->set_line(*this);
cfed3933 » steve
2001-11-19 Port close cropping behavior from mcrgb
146 return tmp;
147 }
148
7fd669fc » steve
2003-10-31 NetEUReduce has its own dup_expr method.
149 NetEUReduce* NetEUReduce::dup_expr() const
150 {
151 NetEUReduce*tmp = new NetEUReduce(op_, expr_->dup_expr());
152 assert(tmp);
70c5c9fe » caryr
2008-02-27 Propagate file and line information in more places.
153 tmp->set_line(*this);
7fd669fc » steve
2003-10-31 NetEUReduce has its own dup_expr method.
154 return tmp;
155 }
Something went wrong with that request. Please try again.