Fix LPM GE to match LPM GT behavior.
This commit is contained in:
parent
0a630b60dd
commit
6d40326a2f
78
vvp/arith.cc
78
vvp/arith.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: arith.cc,v 1.28 2004/06/30 02:15:57 steve Exp $"
|
#ident "$Id: arith.cc,v 1.29 2004/09/22 16:44:07 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "arith.h"
|
# include "arith.h"
|
||||||
|
|
@ -472,58 +472,22 @@ void vvp_cmp_ne::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vvp_cmp_ge::vvp_cmp_ge(unsigned wid, bool flag)
|
vvp_cmp_gtge_base_::vvp_cmp_gtge_base_(unsigned wid, bool flag)
|
||||||
: vvp_arith_(wid), signed_flag_(flag)
|
: vvp_arith_(wid), signed_flag_(flag)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vvp_cmp_gtge_base_::set_base(vvp_ipoint_t i,
|
||||||
void vvp_cmp_ge::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
|
bool push,
|
||||||
|
unsigned val,
|
||||||
|
unsigned,
|
||||||
|
unsigned out_if_equal)
|
||||||
{
|
{
|
||||||
put(i, val);
|
put(i, val);
|
||||||
vvp_ipoint_t base = ipoint_make(i,0);
|
vvp_ipoint_t base = ipoint_make(i,0);
|
||||||
|
|
||||||
unsigned out_val = 1;
|
unsigned out_val = out_if_equal;
|
||||||
|
|
||||||
for (unsigned idx = wid_ ; idx > 0 ; idx -= 1) {
|
|
||||||
vvp_ipoint_t ptr = ipoint_index(base,idx-1);
|
|
||||||
functor_t obj = functor_index(ptr);
|
|
||||||
|
|
||||||
unsigned val = obj->ival;
|
|
||||||
if (val & 0x0a) {
|
|
||||||
out_val = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned a = (val & 0x01)? 1 : 0;
|
|
||||||
unsigned b = (val & 0x04)? 1 : 0;
|
|
||||||
|
|
||||||
if (a > b) {
|
|
||||||
out_val = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a < b) {
|
|
||||||
out_val = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
put_oval(out_val, push);
|
|
||||||
}
|
|
||||||
|
|
||||||
vvp_cmp_gt::vvp_cmp_gt(unsigned wid, bool flag)
|
|
||||||
: vvp_arith_(wid), signed_flag_(flag)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void vvp_cmp_gt::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
|
|
||||||
{
|
|
||||||
put(i, val);
|
|
||||||
vvp_ipoint_t base = ipoint_make(i,0);
|
|
||||||
|
|
||||||
unsigned out_val = 0;
|
|
||||||
|
|
||||||
unsigned idx = wid_;
|
unsigned idx = wid_;
|
||||||
|
|
||||||
|
|
@ -599,6 +563,29 @@ void vvp_cmp_gt::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vvp_cmp_ge::vvp_cmp_ge(unsigned wid, bool flag)
|
||||||
|
: vvp_cmp_gtge_base_(wid, flag)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void vvp_cmp_ge::set(vvp_ipoint_t i, bool push, unsigned val, unsigned str)
|
||||||
|
{
|
||||||
|
set_base(i, push, val, str, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
vvp_cmp_gt::vvp_cmp_gt(unsigned wid, bool flag)
|
||||||
|
: vvp_cmp_gtge_base_(wid, flag)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void vvp_cmp_gt::set(vvp_ipoint_t i, bool push, unsigned val, unsigned str)
|
||||||
|
{
|
||||||
|
set_base(i, push, val, str, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void vvp_shiftl::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
|
void vvp_shiftl::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
|
||||||
{
|
{
|
||||||
put(i, val);
|
put(i, val);
|
||||||
|
|
@ -700,6 +687,9 @@ void vvp_shiftr::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: arith.cc,v $
|
* $Log: arith.cc,v $
|
||||||
|
* Revision 1.29 2004/09/22 16:44:07 steve
|
||||||
|
* Fix LPM GE to match LPM GT behavior.
|
||||||
|
*
|
||||||
* Revision 1.28 2004/06/30 02:15:57 steve
|
* Revision 1.28 2004/06/30 02:15:57 steve
|
||||||
* Add signed LPM divide.
|
* Add signed LPM divide.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
23
vvp/arith.h
23
vvp/arith.h
|
|
@ -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: arith.h,v 1.17 2004/06/30 02:15:57 steve Exp $"
|
#ident "$Id: arith.h,v 1.18 2004/09/22 16:44:07 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "functor.h"
|
# include "functor.h"
|
||||||
|
|
@ -121,24 +121,34 @@ class vvp_cmp_ne : public vvp_arith_ {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class vvp_cmp_ge : public vvp_arith_ {
|
class vvp_cmp_gtge_base_ : public vvp_arith_ {
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit vvp_cmp_gtge_base_(unsigned wid, bool signed_flag);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void set_base(vvp_ipoint_t i, bool push, unsigned val, unsigned str,
|
||||||
|
unsigned out_if_equal);
|
||||||
|
private:
|
||||||
|
bool signed_flag_;
|
||||||
|
};
|
||||||
|
|
||||||
|
class vvp_cmp_ge : public vvp_cmp_gtge_base_ {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit vvp_cmp_ge(unsigned wid, bool signed_flag);
|
explicit vvp_cmp_ge(unsigned wid, bool signed_flag);
|
||||||
void set(vvp_ipoint_t i, bool push, unsigned val, unsigned str);
|
void set(vvp_ipoint_t i, bool push, unsigned val, unsigned str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool signed_flag_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class vvp_cmp_gt : public vvp_arith_ {
|
class vvp_cmp_gt : public vvp_cmp_gtge_base_ {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit vvp_cmp_gt(unsigned wid, bool signed_flag);
|
explicit vvp_cmp_gt(unsigned wid, bool signed_flag);
|
||||||
void set(vvp_ipoint_t i, bool push, unsigned val, unsigned str);
|
void set(vvp_ipoint_t i, bool push, unsigned val, unsigned str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool signed_flag_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class vvp_shiftl : public vvp_arith_ {
|
class vvp_shiftl : public vvp_arith_ {
|
||||||
|
|
@ -159,6 +169,9 @@ class vvp_shiftr : public vvp_arith_ {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: arith.h,v $
|
* $Log: arith.h,v $
|
||||||
|
* Revision 1.18 2004/09/22 16:44:07 steve
|
||||||
|
* Fix LPM GE to match LPM GT behavior.
|
||||||
|
*
|
||||||
* Revision 1.17 2004/06/30 02:15:57 steve
|
* Revision 1.17 2004/06/30 02:15:57 steve
|
||||||
* Add signed LPM divide.
|
* Add signed LPM divide.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue