Skip to content
Permalink
Browse files

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.
  • Loading branch information
martinwhitaker committed Mar 6, 2014
1 parent 3e41a93 commit bc9382eea39b65119c5496a54675d55a1162416d
Showing with 2 additions and 0 deletions.
  1. +1 −0 dup_expr.cc
  2. +1 −0 eval_tree.cc
@@ -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;
}
@@ -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 "

0 comments on commit bc9382e

Please sign in to comment.