From 64cc38f0eb2bd51f3a146d0052e090c1dddf4fdf Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 23 Sep 1999 04:39:52 +0000 Subject: [PATCH] The <= operator takes different width operands. --- vvm/vvm_func.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/vvm/vvm_func.h b/vvm/vvm_func.h index 915abcb77..591a26d47 100644 --- a/vvm/vvm_func.h +++ b/vvm/vvm_func.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vvm_func.h,v 1.8 1999/09/11 04:43:17 steve Exp $" +#ident "$Id: vvm_func.h,v 1.9 1999/09/23 04:39:52 steve Exp $" #endif # include "vvm.h" @@ -308,16 +308,28 @@ vvm_bitset_t<1> vvm_binop_lt(const vvm_bitset_t&l, return result; } +/* + * The <= operator takes operands of natural width and returns a + * single bit. The result is V1 if l <= r, otherwise V0; + */ template vvm_bitset_t<1> vvm_binop_le(const vvm_bitset_t&l, const vvm_bitset_t&r) { - assert(LW == RW); vvm_bitset_t<1> result; result[0] = V1; - for (unsigned idx = 0 ; idx < LW ; idx += 1) + const unsigned common = (LW < RW)? LW : RW; + for (unsigned idx = 0 ; idx < common ; idx += 1) result[0] = less_with_cascade(l[idx], r[idx], result[0]); + if (LW > RW) { + for (unsigned idx = LW ; idx < RW ; idx += 1) + if (l[idx] != V0) { + result[0] = V0; + break; + } + } + return result; } @@ -357,6 +369,9 @@ vvm_bitset_t vvm_ternary(vvm_bit_t c, const vvm_bitset_t&t, /* * $Log: vvm_func.h,v $ + * Revision 1.9 1999/09/23 04:39:52 steve + * The <= operator takes different width operands. + * * Revision 1.8 1999/09/11 04:43:17 steve * Support ternary and <= operators in vvm. *