From 4febf5801b1d1432b8423ededd38994c7a20b7a4 Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 18 Jun 2000 03:29:52 +0000 Subject: [PATCH] Handle width expansion of shift operators. --- set_width.cc | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/set_width.cc b/set_width.cc index ccf1842c8..23e93b52f 100644 --- a/set_width.cc +++ b/set_width.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: set_width.cc,v 1.13 2000/05/04 03:37:59 steve Exp $" +#ident "$Id: set_width.cc,v 1.14 2000/06/18 03:29:52 steve Exp $" #endif /* @@ -47,8 +47,8 @@ bool NetEBinary::set_width(unsigned w) case 'l': // left shift (<<) case 'r': // right shift (>>) - flag = left_->set_width(w); - expr_width(w); + /* these operators are handled in the derived class. */ + assert(0); break; /* The default rule is that the operands of the binary @@ -163,8 +163,15 @@ bool NetEBMult::set_width(unsigned w) */ bool NetEBShift::set_width(unsigned w) { - bool flag; - flag = left_->set_width(w); + bool flag = true; + + left_->set_width(w); + if (left_->expr_width() < w) + left_ = pad_to_width(left_, w); + + expr_width(left_->expr_width()); + flag = expr_width() == w; + return flag; } @@ -300,6 +307,9 @@ bool NetEUnary::set_width(unsigned w) /* * $Log: set_width.cc,v $ + * Revision 1.14 2000/06/18 03:29:52 steve + * Handle width expansion of shift operators. + * * Revision 1.13 2000/05/04 03:37:59 steve * Add infrastructure for system functions, move * $time to that structure and add $random.