1999-11-27 20:07:57 +01:00
|
|
|
/*
|
2008-02-22 23:51:53 +01:00
|
|
|
* Copyright (c) 1999-2008 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
|
|
|
|
|
*/
|
|
|
|
|
|
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
|
|
|
|
|
{
|
2008-02-27 20:34:51 +01:00
|
|
|
NetEBComp*tmp = new NetEBComp(op_, left_->dup_expr(),
|
|
|
|
|
right_->dup_expr());
|
|
|
|
|
assert(tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
2003-03-15 19:08:43 +01:00
|
|
|
}
|
|
|
|
|
|
2003-03-11 00:40:53 +01:00
|
|
|
NetEConst* NetEConst::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEConst*tmp = new NetEConst(value_);
|
2008-02-27 20:34:51 +01:00
|
|
|
assert(tmp);
|
2003-03-11 00:40:53 +01:00
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetEConstParam* NetEConstParam::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEConstParam*tmp = new NetEConstParam(scope_, name_, value());
|
2008-02-27 20:34:51 +01:00
|
|
|
assert(tmp);
|
2003-03-11 00:40:53 +01:00
|
|
|
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());
|
2008-02-27 20:34:51 +01:00
|
|
|
assert(tmp);
|
2003-05-30 04:55:32 +02:00
|
|
|
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
|
|
|
|
|
{
|
2008-02-27 20:34:51 +01:00
|
|
|
NetESelect*tmp = new NetESelect(expr_->dup_expr(),
|
|
|
|
|
base_? base_->dup_expr() : 0,
|
|
|
|
|
expr_width());
|
|
|
|
|
assert(tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
2002-01-28 01:52:41 +01:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
2008-02-27 20:34:51 +01:00
|
|
|
tmp->set_line(*this);
|
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
|
|
|
|
|
{
|
2008-03-12 22:58:45 +01:00
|
|
|
NetESignal*tmp = new NetESignal(net_, word_);
|
2001-11-19 02:54:14 +01:00
|
|
|
assert(tmp);
|
|
|
|
|
tmp->expr_width(expr_width());
|
2008-03-12 22:58:45 +01:00
|
|
|
tmp->set_line(*this);
|
2001-11-19 02:54:14 +01:00
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetETernary* NetETernary::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetETernary*tmp = new NetETernary(cond_->dup_expr(),
|
|
|
|
|
true_val_->dup_expr(),
|
|
|
|
|
false_val_->dup_expr());
|
2008-02-27 20:34:51 +01:00
|
|
|
assert(tmp);
|
|
|
|
|
tmp->set_line(*this);
|
2001-11-19 02:54:14 +01:00
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-22 23:51:53 +01:00
|
|
|
tmp = new NetEUFunc(scope_, func_, result_sig_->dup_expr(), tmp_parms);
|
2002-11-09 01:25:27 +01:00
|
|
|
|
2004-06-01 01:34:36 +02:00
|
|
|
assert(tmp);
|
2008-02-27 20:34:51 +01:00
|
|
|
tmp->set_line(*this);
|
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);
|
2008-02-27 20:34:51 +01:00
|
|
|
tmp->set_line(*this);
|
2001-11-19 02:54:14 +01:00
|
|
|
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);
|
2008-02-27 20:34:51 +01:00
|
|
|
tmp->set_line(*this);
|
2003-10-31 03:47:11 +01:00
|
|
|
return tmp;
|
|
|
|
|
}
|