From 5cfe47da2bc268fb74e7ccd2afd385d76ed58c7b Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Sat, 4 Oct 2008 21:44:10 -0700 Subject: [PATCH] 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. --- elaborate.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index 9464b2dcd..59130d660 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -1954,9 +1954,11 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const } else { unsigned wid = count_lval_width(lv); - rv->set_width(wid); - rv = pad_to_width(rv, wid); - assert(rv->expr_width() >= wid); + if (wid > rv->expr_width()) { + rv->set_width(wid); + rv = pad_to_width(rv, wid); + } + ivl_assert(*this, rv->expr_width() >= wid); } NetAssign*cur = new NetAssign(lv, rv);