Prevent overrun comparing verinums to zero.

This commit is contained in:
steve 2003-04-03 04:30:00 +00:00
parent 6fcbc0e59a
commit 47060bfedd
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
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: synth2.cc,v 1.24 2003/03/25 04:04:29 steve Exp $"
#ident "$Id: synth2.cc,v 1.25 2003/04/03 04:30:00 steve Exp $"
#endif
# include "config.h"
@ -425,7 +425,7 @@ bool NetBlock::synth_sync(Design*des, NetScope*scope, NetFF*ff,
otherwise used) then move the Aset input to Aclr. */
if (tmp_aset.len() == ff->width()) {
if ((aset_value2.as_ulong() == 0)
if (aset_value2.is_zero()
&& ff2->pin_Aset().is_linked()
&& !ff2->pin_Aclr().is_linked()) {
@ -518,7 +518,7 @@ bool NetCondit::synth_sync(Design*des, NetScope*scope, NetFF*ff,
}
assert(tmp.is_defined());
if (tmp.as_ulong() == 0) {
if (tmp.is_zero()) {
connect(ff->pin_Aclr(), ce->pin(0));
} else {
@ -779,6 +779,9 @@ void synth2(Design*des)
/*
* $Log: synth2.cc,v $
* Revision 1.25 2003/04/03 04:30:00 steve
* Prevent overrun comparing verinums to zero.
*
* Revision 1.24 2003/03/25 04:04:29 steve
* Handle defaults in synthesized case statements.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: verinum.cc,v 1.37 2003/02/02 00:43:16 steve Exp $"
#ident "$Id: verinum.cc,v 1.38 2003/04/03 04:30:00 steve Exp $"
#endif
# include "config.h"
@ -293,6 +293,14 @@ bool verinum::is_defined() const
return true;
}
bool verinum::is_zero() const
{
for (unsigned idx = 0 ; idx < nbits_ ; idx += 1)
if (bits_[idx] != V0) return false;
return true;
}
/*
* This function returns a version of the verinum that has only as
* many bits as are needed to accurately represent the value. It takes
@ -818,6 +826,9 @@ verinum::V operator & (verinum::V l, verinum::V r)
/*
* $Log: verinum.cc,v $
* Revision 1.38 2003/04/03 04:30:00 steve
* Prevent overrun comparing verinums to zero.
*
* Revision 1.37 2003/02/02 00:43:16 steve
* Fix conversion of signed numbes to long
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: verinum.h,v 1.22 2003/01/30 16:23:08 steve Exp $"
#ident "$Id: verinum.h,v 1.23 2003/04/03 04:30:00 steve Exp $"
#endif
# include <string>
@ -71,6 +71,7 @@ class verinum {
// A number is "defined" if there are no x or z bits in its value.
bool is_defined() const;
bool is_zero() const;
// A number is "a string" if its value came directly from
// an ASCII description instead of a number value.
@ -131,6 +132,9 @@ extern verinum v_not(const verinum&left);
/*
* $Log: verinum.h,v $
* Revision 1.23 2003/04/03 04:30:00 steve
* Prevent overrun comparing verinums to zero.
*
* Revision 1.22 2003/01/30 16:23:08 steve
* Spelling fixes.
*