2 * Copyright (c) 2000 Stephen Williams (steve@icarus.com)
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)
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.
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
20 #ident "$Id: net_assign.cc,v 1.22 2007/01/16 05:44:15 steve Exp $"
31 unsigned count_lval_width(const NetAssign_
*idx
)
41 NetAssign_::NetAssign_(NetNet
*s
)
42 : sig_(s
), word_(0), base_(0)
44 lwid_
= sig_
->vector_width();
49 NetAssign_::~NetAssign_()
53 if (turn_sig_to_wire_on_release_
&& sig_
->peek_lref() == 0)
54 sig_
->type(NetNet::WIRE
);
58 if (word_
) delete word_
;
61 void NetAssign_::set_word(NetExpr
*r
)
67 NetExpr
* NetAssign_::word()
72 const NetExpr
* NetAssign_::word() const
77 const NetExpr
* NetAssign_::get_base() const
82 unsigned NetAssign_::lwidth() const
87 perm_string
NetAssign_::name() const
92 return perm_string::literal("");
96 NetNet
* NetAssign_::sig() const
101 void NetAssign_::set_part(NetExpr
*base
, unsigned wid
)
109 void NetAssign_::turn_sig_to_wire_on_release()
111 turn_sig_to_wire_on_release_
= true;
114 NetAssignBase::NetAssignBase(NetAssign_
*lv
, NetExpr
*rv
)
115 : lval_(lv
), rval_(rv
), delay_(0)
119 NetAssignBase::~NetAssignBase()
121 if (rval_
) delete rval_
;
123 NetAssign_
*tmp
= lval_
;
130 NetExpr
* NetAssignBase::rval()
135 const NetExpr
* NetAssignBase::rval() const
140 void NetAssignBase::set_rval(NetExpr
*r
)
142 if (rval_
) delete rval_
;
146 NetAssign_
* NetAssignBase::l_val(unsigned idx
)
148 NetAssign_
*cur
= lval_
;
161 const NetAssign_
* NetAssignBase::l_val(unsigned idx
) const
163 const NetAssign_
*cur
= lval_
;
176 unsigned NetAssignBase::l_val_count() const
178 const NetAssign_
*cur
= lval_
;
188 unsigned NetAssignBase::lwidth() const
191 for (NetAssign_
*cur
= lval_
; cur
; cur
= cur
->more
)
192 sum
+= cur
->lwidth();
196 void NetAssignBase::set_delay(NetExpr
*expr
)
201 const NetExpr
* NetAssignBase::get_delay() const
206 NetAssign::NetAssign(NetAssign_
*lv
, NetExpr
*rv
)
207 : NetAssignBase(lv
, rv
)
211 NetAssign::~NetAssign()
215 NetAssignNB::NetAssignNB(NetAssign_
*lv
, NetExpr
*rv
)
216 : NetAssignBase(lv
, rv
)
220 NetAssignNB::~NetAssignNB()
224 NetCAssign::NetCAssign(NetAssign_
*lv
, NetExpr
*rv
)
225 : NetAssignBase(lv
, rv
)
229 NetCAssign::~NetCAssign()
233 NetDeassign::NetDeassign(NetAssign_
*l
)
234 : NetAssignBase(l
, 0)
238 NetDeassign::~NetDeassign()
242 NetForce::NetForce(NetAssign_
*lv
, NetExpr
*rv
)
243 : NetAssignBase(lv
, rv
)
247 NetForce::~NetForce()
251 NetRelease::NetRelease(NetAssign_
*l
)
252 : NetAssignBase(l
, 0)
256 NetRelease::~NetRelease()
261 * $Log: net_assign.cc,v $
262 * Revision 1.22 2007/01/16 05:44:15 steve
263 * Major rework of array handling. Memories are replaced with the
264 * more general concept of arrays. The NetMemory and NetEMemory
265 * classes are removed from the ivl core program, and the IVL_LPM_RAM
266 * lpm type is removed from the ivl_target API.
268 * Revision 1.21 2006/02/02 02:43:58 steve
269 * Allow part selects of memory words in l-values.
271 * Revision 1.20 2005/07/11 16:56:50 steve
272 * Remove NetVariable and ivl_variable_t structures.
274 * Revision 1.19 2004/12/11 02:31:26 steve
275 * Rework of internals to carry vectors through nexus instead
276 * of single bits. Make the ivl, tgt-vvp and vvp initial changes
279 * Revision 1.18 2004/08/28 15:08:31 steve
280 * Do not change reg to wire in NetAssign_ unless synthesizing.
282 * Revision 1.17 2004/02/18 17:11:56 steve
283 * Use perm_strings for named langiage items.
285 * Revision 1.16 2003/01/26 21:15:58 steve
286 * Rework expression parsing and elaboration to
287 * accommodate real/realtime values and expressions.