From 3765f5f421eef52abc1257c493e6bf6c562b9923 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 15 Nov 2007 14:06:07 -0800 Subject: [PATCH] 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. --- set_width.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/set_width.cc b/set_width.cc index c47a2dad8..e293ca192 100644 --- a/set_width.cc +++ b/set_width.cc @@ -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;