Propagate sign in unary minus.

This commit is contained in:
steve 2002-02-01 05:09:14 +00:00
parent 9fa0f95003
commit 9756cb6382
3 changed files with 23 additions and 5 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: eval_tree.cc,v 1.32 2002/01/22 01:40:04 steve Exp $"
#ident "$Id: eval_tree.cc,v 1.33 2002/02/01 05:09:14 steve Exp $"
#endif
# include "config.h"
@ -963,6 +963,7 @@ NetEConst* NetEUnary::eval_tree()
if (val.is_defined()) {
verinum tmp (verinum::V0, val.len());
tmp.has_sign(val.has_sign());
val = tmp - val;
} else {
@ -1063,6 +1064,9 @@ NetEConst* NetEUReduce::eval_tree()
/*
* $Log: eval_tree.cc,v $
* Revision 1.33 2002/02/01 05:09:14 steve
* Propagate sign in unary minus.
*
* Revision 1.32 2002/01/22 01:40:04 steve
* Precalculate constant results of memory index expressions.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.cc,v 1.180 2002/01/22 01:40:04 steve Exp $"
#ident "$Id: netlist.cc,v 1.181 2002/02/01 05:09:14 steve Exp $"
#endif
# include "config.h"
@ -2339,6 +2339,14 @@ NetEUnary::NetEUnary(char op, NetExpr*ex)
expr_width(1);
break;
}
switch (op_) {
case '-':
case '+':
cast_signed(ex->has_sign());
break;
default:
;
}
}
NetEUnary::~NetEUnary()
@ -2415,6 +2423,9 @@ const NetProc*NetTaskDef::proc() const
/*
* $Log: netlist.cc,v $
* Revision 1.181 2002/02/01 05:09:14 steve
* Propagate sign in unary minus.
*
* Revision 1.180 2002/01/22 01:40:04 steve
* Precalculate constant results of memory index expressions.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: verinum.cc,v 1.30 2001/12/31 00:02:33 steve Exp $"
#ident "$Id: verinum.cc,v 1.31 2002/02/01 05:09:14 steve Exp $"
#endif
# include "config.h"
@ -359,7 +359,7 @@ ostream& operator<< (ostream&o, const verinum&v)
if (v.has_sign())
o << "'sb";
else
o << "'sb";
o << "'b";
if (v.len() == 0) {
o << "0";
@ -595,7 +595,7 @@ verinum operator - (const verinum&left, const verinum&r)
for (unsigned idx = min ; idx < max ; idx += 1)
val.set(idx, add_with_carry(verinum::V0, right[idx], carry));
val.has_sign(left.has_sign() && r.has_sign());
return val;
}
@ -793,6 +793,9 @@ verinum::V operator & (verinum::V l, verinum::V r)
/*
* $Log: verinum.cc,v $
* Revision 1.31 2002/02/01 05:09:14 steve
* Propagate sign in unary minus.
*
* Revision 1.30 2001/12/31 00:02:33 steve
* Include s indicator in dump of signed numbers.
*