Prevent overrun comparing verinums to zero.
This commit is contained in:
parent
6fcbc0e59a
commit
47060bfedd
|
|
@ -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: 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
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# 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. */
|
otherwise used) then move the Aset input to Aclr. */
|
||||||
if (tmp_aset.len() == ff->width()) {
|
if (tmp_aset.len() == ff->width()) {
|
||||||
|
|
||||||
if ((aset_value2.as_ulong() == 0)
|
if (aset_value2.is_zero()
|
||||||
&& ff2->pin_Aset().is_linked()
|
&& ff2->pin_Aset().is_linked()
|
||||||
&& !ff2->pin_Aclr().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());
|
assert(tmp.is_defined());
|
||||||
if (tmp.as_ulong() == 0) {
|
if (tmp.is_zero()) {
|
||||||
connect(ff->pin_Aclr(), ce->pin(0));
|
connect(ff->pin_Aclr(), ce->pin(0));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -779,6 +779,9 @@ void synth2(Design*des)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: synth2.cc,v $
|
* $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
|
* Revision 1.24 2003/03/25 04:04:29 steve
|
||||||
* Handle defaults in synthesized case statements.
|
* Handle defaults in synthesized case statements.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
13
verinum.cc
13
verinum.cc
|
|
@ -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: 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
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -293,6 +293,14 @@ bool verinum::is_defined() const
|
||||||
return true;
|
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
|
* This function returns a version of the verinum that has only as
|
||||||
* many bits as are needed to accurately represent the value. It takes
|
* 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 $
|
* $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
|
* Revision 1.37 2003/02/02 00:43:16 steve
|
||||||
* Fix conversion of signed numbes to long
|
* Fix conversion of signed numbes to long
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,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: 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
|
#endif
|
||||||
|
|
||||||
# include <string>
|
# include <string>
|
||||||
|
|
@ -71,6 +71,7 @@ class verinum {
|
||||||
|
|
||||||
// A number is "defined" if there are no x or z bits in its value.
|
// A number is "defined" if there are no x or z bits in its value.
|
||||||
bool is_defined() const;
|
bool is_defined() const;
|
||||||
|
bool is_zero() const;
|
||||||
|
|
||||||
// A number is "a string" if its value came directly from
|
// A number is "a string" if its value came directly from
|
||||||
// an ASCII description instead of a number value.
|
// an ASCII description instead of a number value.
|
||||||
|
|
@ -131,6 +132,9 @@ extern verinum v_not(const verinum&left);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: verinum.h,v $
|
* $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
|
* Revision 1.22 2003/01/30 16:23:08 steve
|
||||||
* Spelling fixes.
|
* Spelling fixes.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue