Fix xz extension of constants.
This commit is contained in:
parent
1ef01b404e
commit
6fcbc0e59a
14
elab_expr.cc
14
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<NetEConst*>(rp)
|
||||
&& (lp->expr_width() > rp->expr_width()))
|
||||
rp->set_width(lp->expr_width());
|
||||
|
||||
if (dynamic_cast<NetEConst*>(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.
|
||||
*
|
||||
|
|
|
|||
22
set_width.cc
22
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
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue