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:
parent
cc9e3d1536
commit
5cfe47da2b
|
|
@ -1954,9 +1954,11 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
unsigned wid = count_lval_width(lv);
|
unsigned wid = count_lval_width(lv);
|
||||||
rv->set_width(wid);
|
if (wid > rv->expr_width()) {
|
||||||
rv = pad_to_width(rv, wid);
|
rv->set_width(wid);
|
||||||
assert(rv->expr_width() >= wid);
|
rv = pad_to_width(rv, wid);
|
||||||
|
}
|
||||||
|
ivl_assert(*this, rv->expr_width() >= wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
NetAssign*cur = new NetAssign(lv, rv);
|
NetAssign*cur = new NetAssign(lv, rv);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue