Fix handling of expression width with $ivlh_to_unsigned.

The first argument to $ivlh_to_unsigned should be treated as having
a self-determined width.
This commit is contained in:
Martin Whitaker 2015-04-25 09:20:31 +01:00
parent 19d966e235
commit 22d15f9ca9
1 changed files with 5 additions and 2 deletions

View File

@ -1100,7 +1100,10 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope,
bool rc = eval_as_long(value, nexpr);
ivl_assert(*this, rc && value>=0);
parms_[0]->test_width(des, scope, mode);
// The argument type/width is self-determined and doesn't
// affect the result type/width.
width_mode_t arg_mode = SIZED;
parms_[0]->test_width(des, scope, arg_mode);
expr_width_ = value;
signed_flag_= false;
@ -1451,7 +1454,7 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope,
PExpr*expr = parms_[0];
ivl_assert(*this, expr);
NetExpr*sub = expr->elaborate_expr(des, scope, expr_width_, flags);
NetExpr*sub = expr->elaborate_expr(des, scope, expr->expr_width(), flags);
return cast_to_width_(sub, expr_wid);
}