From 20cfe9945768e3f30ab07b87342d405cde3dcf47 Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 20 Sep 2006 20:27:02 +0000 Subject: [PATCH] Fix left shift of small unsized constants. --- eval.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/eval.cc b/eval.cc index 2bff9eca5..9e5c02565 100644 --- a/eval.cc +++ b/eval.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: eval.cc,v 1.36.2.2 2005/12/18 21:06:01 steve Exp $" +#ident "$Id: eval.cc,v 1.36.2.3 2006/09/20 20:27:02 steve Exp $" #endif # include "config.h" @@ -112,7 +112,10 @@ verinum* PEBinary::eval_const(const Design*des, const NetScope*scope) const case 'l': { // left shift (<<) assert(r->is_defined()); unsigned long rv = r->as_ulong(); - res = new verinum(verinum::V0, l->len()); + unsigned use_wid = l->len(); + if (! l->has_len()) + use_wid += rv; + res = new verinum(verinum::V0, use_wid); if (rv < res->len()) { unsigned cnt = res->len() - rv; for (unsigned idx = 0 ; idx < cnt ; idx += 1) @@ -261,6 +264,9 @@ verinum* PEUnary::eval_const(const Design*des, const NetScope*scope) const /* * $Log: eval.cc,v $ + * Revision 1.36.2.3 2006/09/20 20:27:02 steve + * Fix left shift of small unsized constants. + * * Revision 1.36.2.2 2005/12/18 21:06:01 steve * Properly fail when concat is not actually constant. *