Support in vvm > and >= behavioral operators.

This commit is contained in:
steve 1999-09-28 01:13:15 +00:00
parent bb38653654
commit 470b0d3d34
3 changed files with 75 additions and 7 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: t-vvm.cc,v 1.45 1999/09/23 03:56:57 steve Exp $"
#ident "$Id: t-vvm.cc,v 1.46 1999/09/28 01:13:15 steve Exp $"
#endif
# include <iostream>
@ -319,6 +319,10 @@ void vvm_proc_rval::expr_binary(const NetEBinary*expr)
os_ << setw(indent_) << "" << result << " = vvm_binop_eq("
<< lres << "," << rres << ");" << endl;
break;
case 'G': // >=
os_ << setw(indent_) << "" << result << " = vvm_binop_ge("
<< lres << "," << rres << ");" << endl;
break;
case 'l': // left shift(<<)
os_ << setw(indent_) << "" << result << " = vvm_binop_shiftl("
<< lres << "," << rres << ");" << endl;
@ -339,6 +343,10 @@ void vvm_proc_rval::expr_binary(const NetEBinary*expr)
os_ << setw(indent_) << "" << result << " = vvm_binop_lt("
<< lres << "," << rres << ");" << endl;
break;
case '>':
os_ << setw(indent_) << "" << result << " = vvm_binop_gt("
<< lres << "," << rres << ");" << endl;
break;
case 'o': // logical or (||)
os_ << setw(indent_) << "" << result << " = vvm_binop_lor("
<< lres << "," << rres << ");" << endl;
@ -1458,6 +1466,9 @@ extern const struct target tgt_vvm = {
};
/*
* $Log: t-vvm.cc,v $
* Revision 1.46 1999/09/28 01:13:15 steve
* Support in vvm > and >= behavioral operators.
*
* Revision 1.45 1999/09/23 03:56:57 steve
* Support shift operators.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vvm.h,v 1.10 1999/08/15 01:23:56 steve Exp $"
#ident "$Id: vvm.h,v 1.11 1999/09/28 01:13:15 steve Exp $"
#endif
# include <vector>
@ -80,6 +80,15 @@ inline vvm_bit_t less_with_cascade(vvm_bit_t l, vvm_bit_t r, vvm_bit_t c)
return c;
}
inline vvm_bit_t greater_with_cascade(vvm_bit_t l, vvm_bit_t r, vvm_bit_t c)
{
if (l == Vx) return Vx;
if (r == Vx) return Vx;
if (l > r) return V1;
if (l < r) return V0;
return c;
}
extern vvm_bit_t add_with_carry(vvm_bit_t l, vvm_bit_t r, vvm_bit_t&carry);
inline vvm_bit_t not(vvm_bit_t l)
@ -280,6 +289,9 @@ template <unsigned WIDTH> class vvm_signal_t : public vvm_monitor_t {
/*
* $Log: vvm.h,v $
* Revision 1.11 1999/09/28 01:13:15 steve
* Support in vvm > and >= behavioral operators.
*
* Revision 1.10 1999/08/15 01:23:56 steve
* Convert vvm to implement system tasks with vpi.
*

View File

@ -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.9 1999/09/23 04:39:52 steve Exp $"
#ident "$Id: vvm_func.h,v 1.10 1999/09/28 01:13:16 steve Exp $"
#endif
# include "vvm.h"
@ -323,11 +323,53 @@ vvm_bitset_t<1> vvm_binop_le(const vvm_bitset_t<LW>&l,
result[0] = less_with_cascade(l[idx], r[idx], result[0]);
if (LW > RW) {
for (unsigned idx = RW ; idx < LW ; idx += 1)
result[0] = less_with_cascade(l[idx], V0, result[0]);
} else {
for (unsigned idx = LW ; idx < RW ; idx += 1)
if (l[idx] != V0) {
result[0] = V0;
break;
}
result[0] = less_with_cascade(V0, r[idx], result[0]);
}
return result;
}
template <unsigned LW, unsigned RW>
vvm_bitset_t<1> vvm_binop_gt(const vvm_bitset_t<LW>&l,
const vvm_bitset_t<RW>&r)
{
vvm_bitset_t<1> result;
result[0] = V0;
const unsigned common = (LW < RW)? LW : RW;
for (unsigned idx = 0 ; idx < common ; idx += 1)
result[0] = greater_with_cascade(l[idx], r[idx], result[0]);
if (LW > RW) {
for (unsigned idx = RW ; idx < LW ; idx += 1)
result[0] = greater_with_cascade(l[idx], V0, result[0]);
} else {
for (unsigned idx = LW ; idx < RW ; idx += 1)
result[0] = greater_with_cascade(V0, r[idx], result[0]);
}
return result;
}
template <unsigned LW, unsigned RW>
vvm_bitset_t<1> vvm_binop_ge(const vvm_bitset_t<LW>&l,
const vvm_bitset_t<RW>&r)
{
vvm_bitset_t<1> result;
result[0] = V1;
const unsigned common = (LW < RW)? LW : RW;
for (unsigned idx = 0 ; idx < common ; idx += 1)
result[0] = greater_with_cascade(l[idx], r[idx], result[0]);
if (LW > RW) {
for (unsigned idx = RW ; idx < LW ; idx += 1)
result[0] = greater_with_cascade(l[idx], V0, result[0]);
} else {
for (unsigned idx = LW ; idx < RW ; idx += 1)
result[0] = greater_with_cascade(V0, r[idx], result[0]);
}
return result;
@ -369,6 +411,9 @@ vvm_bitset_t<W> vvm_ternary(vvm_bit_t c, const vvm_bitset_t<W>&t,
/*
* $Log: vvm_func.h,v $
* Revision 1.10 1999/09/28 01:13:16 steve
* Support in vvm > and >= behavioral operators.
*
* Revision 1.9 1999/09/23 04:39:52 steve
* The <= operator takes different width operands.
*