More resilient WRT right expression width of GT.

This commit is contained in:
steve 2003-03-15 18:07:58 +00:00
parent 90de3904f4
commit 7a752bd111
1 changed files with 14 additions and 9 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: eval_tree.cc,v 1.48 2003/03/10 23:40:53 steve Exp $" #ident "$Id: eval_tree.cc,v 1.49 2003/03/15 18:07:58 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -299,19 +299,21 @@ NetEConst* NetEBComp::eval_gt_()
return new NetEConst(result); return new NetEConst(result);
} }
/* Detect the case where the left side is greater than the /* Check for the special case where we know, simply by the
largest value the right side can possibly have. */ limited width of the right expression, that it cannot
assert(right_->expr_width() > 0); possibly be false. */
verinum rv (verinum::V1, right_->expr_width()); if (right_->expr_width() > 0) {
if (lv > rv) { verinum rv (verinum::V1, right_->expr_width());
verinum result(verinum::V1, 1); if (lv > rv) {
return new NetEConst(result); verinum result(verinum::V1, 1);
return new NetEConst(result);
}
} }
/* Now go on to the normal test of the values. */ /* Now go on to the normal test of the values. */
NetEConst*r = dynamic_cast<NetEConst*>(right_); NetEConst*r = dynamic_cast<NetEConst*>(right_);
if (r == 0) return 0; if (r == 0) return 0;
rv = r->value(); verinum rv = r->value();
if (! rv.is_defined()) { if (! rv.is_defined()) {
verinum result(verinum::Vx, 1); verinum result(verinum::Vx, 1);
return new NetEConst(result); return new NetEConst(result);
@ -1240,6 +1242,9 @@ NetEConst* NetEUReduce::eval_tree()
/* /*
* $Log: eval_tree.cc,v $ * $Log: eval_tree.cc,v $
* Revision 1.49 2003/03/15 18:07:58 steve
* More resilient WRT right expression width of GT.
*
* Revision 1.48 2003/03/10 23:40:53 steve * Revision 1.48 2003/03/10 23:40:53 steve
* Keep parameter constants for the ivl_target API. * Keep parameter constants for the ivl_target API.
* *