Do not MSB extend constants that already have a defined width.

During elaboration certain constants were getting extended with
the MSB. This patch makes that happen only if the constant does
not have a length. At this point most should have a length so
effectively every unsigned value is extended with 0.
This commit is contained in:
Cary R 2007-11-15 14:06:07 -08:00 committed by Stephen Williams
parent ca49d7efa4
commit 3765f5f421
1 changed files with 4 additions and 4 deletions

View File

@ -267,10 +267,10 @@ bool NetEConst::set_width(unsigned w, bool last_chance)
if (value_.has_sign()) {
pad = value_.get(value_.len()-1);
} else if (value_.len() == 0) {
pad = verinum::V0;
} else switch (value_.get(value_.len()-1)) {
/* It appears that you always have a defined length here,
* so this logic may be in error. */
} else if (value_.len() != 0 && !value_.has_len())
switch (value_.get(value_.len()-1)) {
case verinum::V1:
case verinum::V0:
break;