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:
Martin Whitaker 2014-03-06 19:35:25 +00:00
parent 3e41a93f3e
commit bc9382eea3
2 changed files with 2 additions and 0 deletions

View File

@ -249,6 +249,7 @@ NetESignal* NetESignal::dup_expr() const
NetESignal*tmp = new NetESignal(net_, word_);
ivl_assert(*this, tmp);
tmp->expr_width(expr_width());
tmp->cast_signed(has_sign());
tmp->set_line(*this);
return tmp;
}

View File

@ -1384,6 +1384,7 @@ NetExpr*NetETernary::blended_arguments_(const NetExpr*te, const NetExpr*fe) cons
if (tv == fv) val.set(idx, tv);
else val.set(idx, verinum::Vx);
}
val.has_sign(has_sign());
if (debug_eval_tree) {
cerr << get_fileline() << ": debug: Evaluate ternary with "