Pad signed expressions in continuous asignments

When the continuous assignment is signed, then sign-extend the r-value
in the few cases where the expression is stubbornly smaller then the
desired width.
This commit is contained in:
Stephen Williams 2008-08-14 20:38:34 -07:00
parent 4b646aca90
commit 61b9c5e069
1 changed files with 6 additions and 2 deletions

View File

@ -150,8 +150,12 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
(perhaps it is explicitly sized) the pad it out to be the
right width so that something is connected to all the bits
of the l-value. */
if (lval->vector_width() > rval->vector_width())
rval = pad_to_width(des, rval, lval->vector_width());
if (lval->vector_width() > rval->vector_width()) {
if (rval->get_signed())
rval = pad_to_width_signed(des, rval, lval->vector_width());
else
rval = pad_to_width(des, rval, lval->vector_width());
}
/* If, on the other hand, the r-value insists on being
LARGER then the l-value, use a part select to chop it down