Fix for GitHub issue 20 : confused about signed/unsigned in strange ?: example.
The root cause was that NetESignal::dup_exr() was not copying the calculated type (signed/unsigned) of the expression. In passing, found and fixed a similar issue when calculating a blended value for a constant ternary expression.
This commit is contained in:
parent
3e41a93f3e
commit
bc9382eea3
|
|
@ -249,6 +249,7 @@ NetESignal* NetESignal::dup_expr() const
|
||||||
NetESignal*tmp = new NetESignal(net_, word_);
|
NetESignal*tmp = new NetESignal(net_, word_);
|
||||||
ivl_assert(*this, tmp);
|
ivl_assert(*this, tmp);
|
||||||
tmp->expr_width(expr_width());
|
tmp->expr_width(expr_width());
|
||||||
|
tmp->cast_signed(has_sign());
|
||||||
tmp->set_line(*this);
|
tmp->set_line(*this);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1384,6 +1384,7 @@ NetExpr*NetETernary::blended_arguments_(const NetExpr*te, const NetExpr*fe) cons
|
||||||
if (tv == fv) val.set(idx, tv);
|
if (tv == fv) val.set(idx, tv);
|
||||||
else val.set(idx, verinum::Vx);
|
else val.set(idx, verinum::Vx);
|
||||||
}
|
}
|
||||||
|
val.has_sign(has_sign());
|
||||||
|
|
||||||
if (debug_eval_tree) {
|
if (debug_eval_tree) {
|
||||||
cerr << get_fileline() << ": debug: Evaluate ternary with "
|
cerr << get_fileline() << ": debug: Evaluate ternary with "
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue