1999-11-27 20:07:57 +01:00
|
|
|
/*
|
2002-11-09 01:25:27 +01:00
|
|
|
* Copyright (c) 1999-2002 Stephen Williams (steve@icarus.com)
|
1999-11-27 20:07:57 +01:00
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
|
*/
|
2002-08-12 03:34:58 +02:00
|
|
|
#ifdef HAVE_CVS_IDENT
|
2004-12-11 03:31:25 +01:00
|
|
|
#ident "$Id: dup_expr.cc,v 1.19 2004/12/11 02:31:25 steve Exp $"
|
1999-11-27 20:07:57 +01:00
|
|
|
#endif
|
|
|
|
|
|
2001-07-25 05:10:48 +02:00
|
|
|
# include "config.h"
|
|
|
|
|
|
1999-11-27 20:07:57 +01:00
|
|
|
# include "netlist.h"
|
|
|
|
|
# include <cassert>
|
|
|
|
|
|
2003-03-15 19:08:43 +01:00
|
|
|
NetEBComp* NetEBComp::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEBComp*result = new NetEBComp(op_, left_->dup_expr(),
|
|
|
|
|
right_->dup_expr());
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-11 00:40:53 +01:00
|
|
|
NetEConst* NetEConst::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEConst*tmp = new NetEConst(value_);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetEConstParam* NetEConstParam::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEConstParam*tmp = new NetEConstParam(scope_, name_, value());
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-30 04:55:32 +02:00
|
|
|
NetECRealParam* NetECRealParam::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetECRealParam*tmp = new NetECRealParam(scope_, name_, value());
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-22 06:48:29 +02:00
|
|
|
NetEEvent* NetEEvent::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
assert(0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-27 20:07:57 +01:00
|
|
|
NetEScope* NetEScope::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
assert(0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-28 01:52:41 +01:00
|
|
|
NetESelect* NetESelect::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
return new NetESelect(expr_->dup_expr(), base_->dup_expr(),
|
|
|
|
|
expr_width());
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-04 05:37:58 +02:00
|
|
|
NetESFunc* NetESFunc::dup_expr() const
|
|
|
|
|
{
|
2003-03-15 05:46:28 +01:00
|
|
|
NetESFunc*tmp = new NetESFunc(name_, type_, expr_width(), nparms());
|
2001-11-19 02:54:14 +01:00
|
|
|
assert(tmp);
|
2004-06-17 18:06:18 +02:00
|
|
|
|
|
|
|
|
tmp->cast_signed(has_sign());
|
2001-11-19 02:54:14 +01:00
|
|
|
for (unsigned idx = 0 ; idx < nparms() ; idx += 1) {
|
|
|
|
|
assert(tmp->parm(idx));
|
2000-05-07 20:20:07 +02:00
|
|
|
tmp->parm(idx, tmp->parm(idx)->dup_expr());
|
2001-11-19 02:54:14 +01:00
|
|
|
}
|
2000-05-07 20:20:07 +02:00
|
|
|
|
|
|
|
|
return tmp;
|
2000-05-04 05:37:58 +02:00
|
|
|
}
|
|
|
|
|
|
2001-11-19 02:54:14 +01:00
|
|
|
NetESignal* NetESignal::dup_expr() const
|
|
|
|
|
{
|
2004-12-11 03:31:25 +01:00
|
|
|
NetESignal*tmp = new NetESignal(net_);
|
2001-11-19 02:54:14 +01:00
|
|
|
assert(tmp);
|
|
|
|
|
tmp->expr_width(expr_width());
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetETernary* NetETernary::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetETernary*tmp = new NetETernary(cond_->dup_expr(),
|
|
|
|
|
true_val_->dup_expr(),
|
|
|
|
|
false_val_->dup_expr());
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-09 01:25:27 +01:00
|
|
|
NetEUFunc* NetEUFunc::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEUFunc*tmp;
|
|
|
|
|
svector<NetExpr*> tmp_parms (parms_.count());
|
|
|
|
|
|
|
|
|
|
for (unsigned idx = 0 ; idx < tmp_parms.count() ; idx += 1) {
|
|
|
|
|
assert(parms_[idx]);
|
|
|
|
|
tmp_parms[idx] = parms_[idx]->dup_expr();
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-01 01:34:36 +02:00
|
|
|
tmp = 0;
|
|
|
|
|
if (result_sig_)
|
|
|
|
|
tmp = new NetEUFunc(func_, result_sig_->dup_expr(), tmp_parms);
|
|
|
|
|
if (result_var_)
|
|
|
|
|
tmp = new NetEUFunc(func_, result_var_->dup_expr(), tmp_parms);
|
2002-11-09 01:25:27 +01:00
|
|
|
|
2004-06-01 01:34:36 +02:00
|
|
|
assert(tmp);
|
2002-11-09 01:25:27 +01:00
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-19 02:54:14 +01:00
|
|
|
NetEUnary* NetEUnary::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEUnary*tmp = new NetEUnary(op_, expr_->dup_expr());
|
|
|
|
|
assert(tmp);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-31 03:47:11 +01:00
|
|
|
NetEUReduce* NetEUReduce::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEUReduce*tmp = new NetEUReduce(op_, expr_->dup_expr());
|
|
|
|
|
assert(tmp);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-26 22:15:58 +01:00
|
|
|
NetEVariable* NetEVariable::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEVariable*tmp = new NetEVariable(var_);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-27 20:07:57 +01:00
|
|
|
/*
|
|
|
|
|
* $Log: dup_expr.cc,v $
|
2004-12-11 03:31:25 +01:00
|
|
|
* Revision 1.19 2004/12/11 02:31:25 steve
|
|
|
|
|
* Rework of internals to carry vectors through nexus instead
|
|
|
|
|
* of single bits. Make the ivl, tgt-vvp and vvp initial changes
|
|
|
|
|
* down this path.
|
|
|
|
|
*
|
2004-06-17 18:06:18 +02:00
|
|
|
* Revision 1.18 2004/06/17 16:06:18 steve
|
|
|
|
|
* Help system function signedness survive elaboration.
|
|
|
|
|
*
|
2004-06-01 01:34:36 +02:00
|
|
|
* Revision 1.17 2004/05/31 23:34:36 steve
|
|
|
|
|
* Rewire/generalize parsing an elaboration of
|
|
|
|
|
* function return values to allow for better
|
|
|
|
|
* speed and more type support.
|
|
|
|
|
*
|
2003-10-31 03:47:11 +01:00
|
|
|
* Revision 1.16 2003/10/31 02:47:11 steve
|
|
|
|
|
* NetEUReduce has its own dup_expr method.
|
|
|
|
|
*
|
2003-05-30 04:55:32 +02:00
|
|
|
* Revision 1.15 2003/05/30 02:55:32 steve
|
|
|
|
|
* Support parameters in real expressions and
|
|
|
|
|
* as real expressions, and fix multiply and
|
|
|
|
|
* divide with real results.
|
|
|
|
|
*
|
2003-04-22 06:48:29 +02:00
|
|
|
* Revision 1.14 2003/04/22 04:48:29 steve
|
|
|
|
|
* Support event names as expressions elements.
|
|
|
|
|
*
|
2003-03-15 19:08:43 +01:00
|
|
|
* Revision 1.13 2003/03/15 18:08:43 steve
|
|
|
|
|
* Comparison operators do have defined width.
|
|
|
|
|
*
|
2003-03-15 05:46:28 +01:00
|
|
|
* Revision 1.12 2003/03/15 04:46:28 steve
|
|
|
|
|
* Better organize the NetESFunc return type guesses.
|
|
|
|
|
*
|
2003-03-11 00:40:53 +01:00
|
|
|
* Revision 1.11 2003/03/10 23:40:53 steve
|
|
|
|
|
* Keep parameter constants for the ivl_target API.
|
|
|
|
|
*
|
2003-01-26 22:15:58 +01:00
|
|
|
* Revision 1.10 2003/01/26 21:15:58 steve
|
|
|
|
|
* Rework expression parsing and elaboration to
|
|
|
|
|
* accommodate real/realtime values and expressions.
|
|
|
|
|
*
|
2002-11-09 01:25:27 +01:00
|
|
|
* Revision 1.9 2002/11/09 00:25:27 steve
|
|
|
|
|
* Add dup_expr for user defined function calls.
|
|
|
|
|
*
|
2002-08-12 03:34:58 +02:00
|
|
|
* Revision 1.8 2002/08/12 01:34:58 steve
|
|
|
|
|
* conditional ident string using autoconfig.
|
|
|
|
|
*
|
2002-01-28 01:52:41 +01:00
|
|
|
* Revision 1.7 2002/01/28 00:52:41 steve
|
|
|
|
|
* Add support for bit select of parameters.
|
|
|
|
|
* This leads to a NetESelect node and the
|
|
|
|
|
* vvp code generator to support that.
|
|
|
|
|
*
|
2001-11-19 02:54:14 +01:00
|
|
|
* Revision 1.6 2001/11/19 01:54:14 steve
|
|
|
|
|
* Port close cropping behavior from mcrgb
|
|
|
|
|
* Move window array reset to libmc.
|
|
|
|
|
*
|
2001-07-25 05:10:48 +02:00
|
|
|
* Revision 1.5 2001/07/25 03:10:48 steve
|
|
|
|
|
* Create a config.h.in file to hold all the config
|
|
|
|
|
* junk, and support gcc 3.0. (Stephan Boettcher)
|
|
|
|
|
*
|
2000-05-07 20:20:07 +02:00
|
|
|
* Revision 1.4 2000/05/07 18:20:07 steve
|
|
|
|
|
* Import MCD support from Stephen Tell, and add
|
|
|
|
|
* system function parameter support to the IVL core.
|
|
|
|
|
*
|
2000-05-04 05:37:58 +02:00
|
|
|
* Revision 1.3 2000/05/04 03:37:58 steve
|
|
|
|
|
* Add infrastructure for system functions, move
|
|
|
|
|
* $time to that structure and add $random.
|
1999-11-27 20:07:57 +01:00
|
|
|
*/
|
|
|
|
|
|