Fix zero/sign extension of parameter values in expressions.

For sized parameters, the choice of zero or sign extension should
be based on the expression type, not the parameter type.
This commit is contained in:
Martin Whitaker 2013-10-13 22:14:30 +01:00
parent 589bb59268
commit 20ad1ff261
1 changed files with 5 additions and 1 deletions

View File

@ -3777,8 +3777,12 @@ NetExpr* PEIdent::elaborate_expr_param_(Design*des,
NetEConstParam or NetECRealParam as appropriate. */
const NetEConst*ctmp = dynamic_cast<const NetEConst*>(par);
if (ctmp) {
verinum cvalue = cast_to_width(ctmp->value(), expr_wid);
verinum cvalue = ctmp->value();
if (cvalue.has_len())
cvalue.has_sign(signed_flag_);
cvalue = cast_to_width(cvalue, expr_wid);
tmp = new NetEConstParam(found_in, name, cvalue);
tmp->cast_signed(signed_flag_);
tmp->set_line(*par);
if (debug_elaborate)