1999-11-27 20:07:57 +01:00
|
|
|
/*
|
2013-02-15 03:55:34 +01:00
|
|
|
* Copyright (c) 1999-2013 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
|
2012-08-29 03:41:23 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1999-11-27 20:07:57 +01:00
|
|
|
*/
|
|
|
|
|
|
2001-07-25 05:10:48 +02:00
|
|
|
# include "config.h"
|
|
|
|
|
|
1999-11-27 20:07:57 +01:00
|
|
|
# include "netlist.h"
|
|
|
|
|
# include <cassert>
|
2010-05-31 22:12:06 +02:00
|
|
|
# include <cstdlib>
|
2008-07-31 03:01:41 +02:00
|
|
|
# include "ivl_assert.h"
|
|
|
|
|
|
|
|
|
|
NetEAccess* NetEAccess::dup_expr() const
|
|
|
|
|
{
|
2008-08-05 05:54:05 +02:00
|
|
|
NetEAccess*tmp = new NetEAccess(branch_, nature_);
|
2008-07-31 03:01:41 +02:00
|
|
|
ivl_assert(*this, tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
1999-11-27 20:07:57 +01:00
|
|
|
|
2013-10-10 05:15:10 +02:00
|
|
|
NetEArrayPattern*NetEArrayPattern::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
vector<NetExpr*>tmp (items_.size());
|
|
|
|
|
for (size_t idx = 0 ; idx < tmp.size() ; idx += 1)
|
|
|
|
|
tmp[idx] = items_[idx]->dup_expr();
|
|
|
|
|
|
|
|
|
|
NetEArrayPattern*res = new NetEArrayPattern(net_type(), tmp);
|
|
|
|
|
res->set_line(*this);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-26 23:59:52 +01:00
|
|
|
NetEBinary* NetEBinary::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
ivl_assert(*this, 0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetEBAdd* NetEBAdd::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEBAdd*tmp = new NetEBAdd(op_, left_->dup_expr(), right_->dup_expr(),
|
|
|
|
|
expr_width(), has_sign());
|
|
|
|
|
ivl_assert(*this, tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetEBBits* NetEBBits::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEBBits*tmp = new NetEBBits(op_, left_->dup_expr(), right_->dup_expr(),
|
|
|
|
|
expr_width(), has_sign());
|
|
|
|
|
ivl_assert(*this, tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-15 19:08:43 +01:00
|
|
|
NetEBComp* NetEBComp::dup_expr() const
|
|
|
|
|
{
|
2011-02-26 23:59:52 +01:00
|
|
|
NetEBComp*tmp = new NetEBComp(op_, left_->dup_expr(), right_->dup_expr());
|
|
|
|
|
ivl_assert(*this, tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetEBDiv* NetEBDiv::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEBDiv*tmp = new NetEBDiv(op_, left_->dup_expr(), right_->dup_expr(),
|
|
|
|
|
expr_width(), has_sign());
|
|
|
|
|
ivl_assert(*this, tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetEBLogic* NetEBLogic::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEBLogic*tmp = new NetEBLogic(op_, left_->dup_expr(), right_->dup_expr());
|
|
|
|
|
ivl_assert(*this, tmp);
|
2008-02-27 20:34:51 +01:00
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
2003-03-15 19:08:43 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-26 23:59:52 +01:00
|
|
|
NetEBMult* NetEBMult::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEBMult*tmp = new NetEBMult(op_, left_->dup_expr(), right_->dup_expr(),
|
|
|
|
|
expr_width(), has_sign());
|
|
|
|
|
ivl_assert(*this, tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetEBPow* NetEBPow::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEBPow*tmp = new NetEBPow(op_, left_->dup_expr(), right_->dup_expr(),
|
|
|
|
|
expr_width(), has_sign());
|
|
|
|
|
ivl_assert(*this, tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetEBShift* NetEBShift::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEBShift*tmp = new NetEBShift(op_, left_->dup_expr(), right_->dup_expr(),
|
|
|
|
|
expr_width(), has_sign());
|
|
|
|
|
ivl_assert(*this, tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetEConcat* NetEConcat::dup_expr() const
|
|
|
|
|
{
|
2012-06-25 00:33:40 +02:00
|
|
|
NetEConcat*dup = new NetEConcat(parms_.size(), repeat_, expr_type_);
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, dup);
|
|
|
|
|
dup->set_line(*this);
|
2012-06-25 00:33:40 +02:00
|
|
|
for (unsigned idx = 0 ; idx < parms_.size() ; idx += 1)
|
2011-02-26 23:59:52 +01:00
|
|
|
if (parms_[idx]) {
|
|
|
|
|
NetExpr*tmp = parms_[idx]->dup_expr();
|
|
|
|
|
ivl_assert(*this, tmp);
|
|
|
|
|
dup->parms_[idx] = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dup->expr_width(expr_width());
|
|
|
|
|
|
|
|
|
|
return dup;
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-11 00:40:53 +01:00
|
|
|
NetEConst* NetEConst::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEConst*tmp = new NetEConst(value_);
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, tmp);
|
2003-03-11 00:40:53 +01:00
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-31 19:26:09 +01:00
|
|
|
NetEConstEnum* NetEConstEnum::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEConstEnum*tmp = new NetEConstEnum(scope_, name_, enum_set_, value());
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, tmp);
|
2010-10-31 19:26:09 +01:00
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-11 00:40:53 +01:00
|
|
|
NetEConstParam* NetEConstParam::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetEConstParam*tmp = new NetEConstParam(scope_, name_, value());
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NetECReal* NetECReal::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetECReal*tmp = new NetECReal(value_);
|
|
|
|
|
ivl_assert(*this, 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());
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, 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
|
|
|
|
|
{
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, 0);
|
2003-04-22 06:48:29 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-17 01:11:40 +02:00
|
|
|
NetELast* NetELast::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
NetELast*tmp = new NetELast(sig_);
|
|
|
|
|
ivl_assert(*this, tmp);
|
|
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-21 00:09:32 +01:00
|
|
|
NetENetenum* NetENetenum::dup_expr() const
|
|
|
|
|
{
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, 0);
|
2010-11-21 00:09:32 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-17 18:20:13 +01:00
|
|
|
NetENew* NetENew::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
ivl_assert(*this, 0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-12 02:42:31 +01:00
|
|
|
NetENull* NetENull::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
ivl_assert(*this, 0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-25 19:13:05 +01:00
|
|
|
NetEProperty* NetEProperty::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
ivl_assert(*this, 0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-27 20:07:57 +01:00
|
|
|
NetEScope* NetEScope::dup_expr() const
|
|
|
|
|
{
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, 0);
|
1999-11-27 20:07:57 +01:00
|
|
|
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,
|
2011-02-23 18:15:36 +01:00
|
|
|
expr_width(), sel_type_);
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, tmp);
|
2013-02-15 03:55:34 +01:00
|
|
|
tmp->cast_signed(has_sign());
|
2008-02-27 20:34:51 +01:00
|
|
|
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());
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, 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) {
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, parm(idx));
|
2008-10-07 22:27:48 +02:00
|
|
|
tmp->parm(idx, 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
|
|
|
}
|
|
|
|
|
|
2013-04-28 04:54:13 +02:00
|
|
|
NetEShallowCopy* NetEShallowCopy::dup_expr() const
|
|
|
|
|
{
|
|
|
|
|
ivl_assert(*this, 0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
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_);
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, tmp);
|
2001-11-19 02:54:14 +01:00
|
|
|
tmp->expr_width(expr_width());
|
2014-03-06 20:35:25 +01:00
|
|
|
tmp->cast_signed(has_sign());
|
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(),
|
2011-02-26 23:59:52 +01:00
|
|
|
false_val_->dup_expr(),
|
|
|
|
|
expr_width(),
|
|
|
|
|
has_sign());
|
|
|
|
|
ivl_assert(*this, tmp);
|
2008-02-27 20:34:51 +01:00
|
|
|
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;
|
2012-05-29 01:49:41 +02:00
|
|
|
vector<NetExpr*> tmp_parms (parms_.size());
|
2002-11-09 01:25:27 +01:00
|
|
|
|
2012-05-29 01:49:41 +02:00
|
|
|
for (unsigned idx = 0 ; idx < tmp_parms.size() ; idx += 1) {
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, parms_[idx]);
|
2002-11-09 01:25:27 +01:00
|
|
|
tmp_parms[idx] = parms_[idx]->dup_expr();
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-05 21:43:54 +02:00
|
|
|
tmp = new NetEUFunc(scope_, func_, result_sig_->dup_expr(), tmp_parms,
|
|
|
|
|
need_const_);
|
2002-11-09 01:25:27 +01:00
|
|
|
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, tmp);
|
2008-02-27 20:34:51 +01:00
|
|
|
tmp->set_line(*this);
|
2002-11-09 01:25:27 +01:00
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-31 06:11:05 +01:00
|
|
|
NetEUBits* NetEUBits::dup_expr() const
|
|
|
|
|
{
|
2011-02-26 23:59:52 +01:00
|
|
|
NetEUBits*tmp = new NetEUBits(op_, expr_->dup_expr(), expr_width(), has_sign());
|
|
|
|
|
ivl_assert(*this, tmp);
|
2008-10-31 06:11:05 +01:00
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-19 02:54:14 +01:00
|
|
|
NetEUnary* NetEUnary::dup_expr() const
|
|
|
|
|
{
|
2011-02-26 23:59:52 +01:00
|
|
|
NetEUnary*tmp = new NetEUnary(op_, expr_->dup_expr(), expr_width(), has_sign());
|
|
|
|
|
ivl_assert(*this, 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());
|
2011-02-26 23:59:52 +01:00
|
|
|
ivl_assert(*this, tmp);
|
2008-02-27 20:34:51 +01:00
|
|
|
tmp->set_line(*this);
|
2003-10-31 03:47:11 +01:00
|
|
|
return tmp;
|
|
|
|
|
}
|
2010-06-19 01:03:17 +02:00
|
|
|
|
|
|
|
|
NetECast* NetECast::dup_expr() const
|
|
|
|
|
{
|
2011-02-26 23:59:52 +01:00
|
|
|
NetECast*tmp = new NetECast(op_, expr_->dup_expr(), expr_width(), has_sign());
|
|
|
|
|
ivl_assert(*this, tmp);
|
2010-06-19 01:03:17 +02:00
|
|
|
tmp->set_line(*this);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|