Don't try to shrink a valid r-vlaue width.

In assignments, the expression width may be defined by the width of
operands, and not that of the l-value. Choose whichever is creater and
set (or pad) the expression to that width.
This commit is contained in:
Stephen Williams 2008-10-04 21:44:10 -07:00
parent cc9e3d1536
commit 5cfe47da2b
1 changed files with 5 additions and 3 deletions

View File

@ -1954,9 +1954,11 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
} else {
unsigned wid = count_lval_width(lv);
if (wid > rv->expr_width()) {
rv->set_width(wid);
rv = pad_to_width(rv, wid);
assert(rv->expr_width() >= wid);
}
ivl_assert(*this, rv->expr_width() >= wid);
}
NetAssign*cur = new NetAssign(lv, rv);