From 6fcbc0e59ab95e050ca03e05701d75217ca6f7e4 Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 2 Apr 2003 04:25:26 +0000 Subject: [PATCH] Fix xz extension of constants. --- elab_expr.cc | 14 +++++++++++++- set_width.cc | 22 ++++++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/elab_expr.cc b/elab_expr.cc index ccc0b1551..419003c3b 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: elab_expr.cc,v 1.73 2003/03/25 03:00:04 steve Exp $" +#ident "$Id: elab_expr.cc,v 1.74 2003/04/02 04:25:26 steve Exp $" #endif # include "config.h" @@ -161,6 +161,15 @@ NetEBinary* PEBinary::elaborate_expr_base_(Design*des, case 'E': /* === */ case 'n': /* != */ case 'N': /* !== */ + if (dynamic_cast(rp) + && (lp->expr_width() > rp->expr_width())) + rp->set_width(lp->expr_width()); + + if (dynamic_cast(lp) + && (lp->expr_width() < rp->expr_width())) + lp->set_width(rp->expr_width()); + + /* from here, handle this like other compares. */ case 'L': /* <= */ case 'G': /* >= */ case '<': @@ -943,6 +952,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, bool) const /* * $Log: elab_expr.cc,v $ + * Revision 1.74 2003/04/02 04:25:26 steve + * Fix xz extension of constants. + * * Revision 1.73 2003/03/25 03:00:04 steve * Scope names can be relative. * diff --git a/set_width.cc b/set_width.cc index 791c3292f..eb17e6af4 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 */ #ifdef HAVE_CVS_IDENT -#ident "$Id: set_width.cc,v 1.27 2003/02/06 17:50:23 steve Exp $" +#ident "$Id: set_width.cc,v 1.28 2003/04/02 04:25:26 steve Exp $" #endif # include "config.h" @@ -249,9 +249,24 @@ bool NetEConst::set_width(unsigned w) if (w > value_.len()) { verinum::V pad = verinum::V0; - if (value_.has_sign()) + 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)) { + case verinum::V1: + case verinum::V0: + break; + case verinum::Vx: + pad = verinum::Vx; + break; + case verinum::Vz: + pad = verinum::Vz; + break; + } + verinum tmp (verinum::V0, w, has_width()); for (unsigned idx = 0 ; idx < value_.len() ; idx += 1) tmp.set(idx, value_[idx]); @@ -383,6 +398,9 @@ bool NetEUReduce::set_width(unsigned w) /* * $Log: set_width.cc,v $ + * Revision 1.28 2003/04/02 04:25:26 steve + * Fix xz extension of constants. + * * Revision 1.27 2003/02/06 17:50:23 steve * Real constants have no defined vector width *