Remove redundant elab_and_eval_lossless().
(cherry picked from commit 711623f682)
This commit is contained in:
parent
a14118cd6c
commit
a676db798a
41
netmisc.cc
41
netmisc.cc
|
|
@ -844,17 +844,13 @@ NetExpr* condition_reduce(NetExpr*expr)
|
||||||
return cmp;
|
return cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NetExpr* do_elab_and_eval(Design*des, NetScope*scope, PExpr*pe,
|
NetExpr* elab_and_eval(Design*des, NetScope*scope, PExpr*pe,
|
||||||
int context_width, bool need_const,
|
int context_width, bool need_const, bool annotatable,
|
||||||
bool annotatable, bool force_expand,
|
ivl_variable_type_t cast_type, bool force_unsigned)
|
||||||
ivl_variable_type_t cast_type,
|
|
||||||
bool force_unsigned)
|
|
||||||
{
|
{
|
||||||
PExpr::width_mode_t mode = PExpr::SIZED;
|
PExpr::width_mode_t mode = PExpr::SIZED;
|
||||||
if ((context_width == -2) && !gn_strict_expr_width_flag)
|
if ((context_width == -2) && !gn_strict_expr_width_flag)
|
||||||
mode = PExpr::EXPAND;
|
mode = PExpr::EXPAND;
|
||||||
if (force_expand)
|
|
||||||
mode = PExpr::EXPAND;
|
|
||||||
|
|
||||||
pe->test_width(des, scope, mode);
|
pe->test_width(des, scope, mode);
|
||||||
|
|
||||||
|
|
@ -891,7 +887,6 @@ static NetExpr* do_elab_and_eval(Design*des, NetScope*scope, PExpr*pe,
|
||||||
<< "returns type=" << pe->expr_type()
|
<< "returns type=" << pe->expr_type()
|
||||||
<< ", context_width=" << context_width
|
<< ", context_width=" << context_width
|
||||||
<< ", signed=" << pe->has_sign()
|
<< ", signed=" << pe->has_sign()
|
||||||
<< ", force_expand=" << force_expand
|
|
||||||
<< ", expr_width=" << expr_width
|
<< ", expr_width=" << expr_width
|
||||||
<< ", mode=" << PExpr::width_mode_name(mode) << endl;
|
<< ", mode=" << PExpr::width_mode_name(mode) << endl;
|
||||||
cerr << pe->get_fileline() << ": : "
|
cerr << pe->get_fileline() << ": : "
|
||||||
|
|
@ -964,13 +959,6 @@ static NetExpr* do_elab_and_eval(Design*des, NetScope*scope, PExpr*pe,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the context_width sent is is actually the minimum width,
|
|
||||||
// then raise the context_width to be big enough for the
|
|
||||||
// lossless expression.
|
|
||||||
if (force_expand && context_width > 0) {
|
|
||||||
context_width = max(context_width, (int)expr_width);
|
|
||||||
}
|
|
||||||
|
|
||||||
eval_expr(tmp, context_width);
|
eval_expr(tmp, context_width);
|
||||||
|
|
||||||
if (NetEConst*ce = dynamic_cast<NetEConst*>(tmp)) {
|
if (NetEConst*ce = dynamic_cast<NetEConst*>(tmp)) {
|
||||||
|
|
@ -981,29 +969,6 @@ static NetExpr* do_elab_and_eval(Design*des, NetScope*scope, PExpr*pe,
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetExpr* elab_and_eval(Design*des, NetScope*scope, PExpr*pe,
|
|
||||||
int context_width, bool need_const, bool annotatable,
|
|
||||||
ivl_variable_type_t cast_type, bool force_unsigned)
|
|
||||||
{
|
|
||||||
return do_elab_and_eval(des, scope, pe, context_width,
|
|
||||||
need_const, annotatable, false,
|
|
||||||
cast_type, force_unsigned);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This variant of elab_and_eval does the expression losslessly, no
|
|
||||||
* matter what the generation of Verilog. This is in support of
|
|
||||||
* certain special contexts, notably index expressions.
|
|
||||||
*/
|
|
||||||
NetExpr* elab_and_eval_lossless(Design*des, NetScope*scope, PExpr*pe,
|
|
||||||
int context_width, bool need_const, bool annotatable,
|
|
||||||
ivl_variable_type_t cast_type)
|
|
||||||
{
|
|
||||||
return do_elab_and_eval(des, scope, pe, context_width,
|
|
||||||
need_const, annotatable, true,
|
|
||||||
cast_type, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
NetExpr* elab_and_eval(Design*des, NetScope*scope, PExpr*pe,
|
NetExpr* elab_and_eval(Design*des, NetScope*scope, PExpr*pe,
|
||||||
ivl_type_t lv_net_type, bool need_const)
|
ivl_type_t lv_net_type, bool need_const)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -281,12 +281,6 @@ extern NetExpr* elab_and_eval(Design*des, NetScope*scope,
|
||||||
ivl_variable_type_t cast_type =IVL_VT_NO_TYPE,
|
ivl_variable_type_t cast_type =IVL_VT_NO_TYPE,
|
||||||
bool force_unsigned =false);
|
bool force_unsigned =false);
|
||||||
|
|
||||||
extern NetExpr* elab_and_eval_lossless(Design*des, NetScope*scope,
|
|
||||||
PExpr*pe, int context_width,
|
|
||||||
bool need_const =false,
|
|
||||||
bool annotatable =false,
|
|
||||||
ivl_variable_type_t cast_type =IVL_VT_NO_TYPE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This form of elab_and_eval uses the ivl_type_t to carry type
|
* This form of elab_and_eval uses the ivl_type_t to carry type
|
||||||
* information instead of the piecemeal form. We should transition to
|
* information instead of the piecemeal form. We should transition to
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue