diff --git a/t-vvm.cc b/t-vvm.cc index 83d46ac22..2f504907b 100644 --- a/t-vvm.cc +++ b/t-vvm.cc @@ -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.96 2000/01/13 05:11:25 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.97 2000/01/13 06:05:46 steve Exp $" #endif # include @@ -433,6 +433,10 @@ void vvm_proc_rval::expr_binary(const NetEBinary*expr) os_ << setw(indent_) << "" << result << " = vvm_binop_shiftr(" << lres << "," << rres << ");" << endl; break; + case 'X': + os_ << setw(indent_) << "" << result << " = vvm_binop_xnor(" + << lres << "," << rres << ");" << endl; + break; case '+': os_ << setw(indent_) << "" << result << " = vvm_binop_plus(" << lres << "," << rres << ");" << endl; @@ -2036,6 +2040,9 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.97 2000/01/13 06:05:46 steve + * Add the XNOR operator. + * * Revision 1.96 2000/01/13 05:11:25 steve * Support for multiple VPI modules. * diff --git a/vvm/vvm_func.h b/vvm/vvm_func.h index 6da4c8d9c..12b96d70c 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.17 2000/01/13 03:35:35 steve Exp $" +#ident "$Id: vvm_func.h,v 1.18 2000/01/13 06:05:46 steve Exp $" #endif # include "vvm.h" @@ -160,6 +160,17 @@ vvm_bitset_t vvm_binop_or(const vvm_bitset_t&l, return result; } +template +vvm_bitset_t vvm_binop_nor(const vvm_bitset_t&l, + const vvm_bitset_t&r) +{ + vvm_bitset_t result; + for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) + result[idx] = not(l[idx] | r[idx]); + + return result; +} + /* * Implement the binary + operator in the verilog way. This takes * vectors of identical width and returns another vector of same width @@ -228,6 +239,17 @@ vvm_bitset_t vvm_binop_xor(const vvm_bitset_t&l, return result; } +template +vvm_bitset_t vvm_binop_xnor(const vvm_bitset_t&l, + const vvm_bitset_t&r) +{ + vvm_bitset_t result; + for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) + result[idx] = not(l[idx] ^ r[idx]); + + return result; +} + /* * the binary 'l' operator is a logic left-shift by the number of positions * indicated by argument r. r is an unsigned integer, which is represented @@ -626,6 +648,9 @@ vvm_bitset_t vvm_ternary(vpip_bit_t c, const vvm_bitset_t&t, /* * $Log: vvm_func.h,v $ + * Revision 1.18 2000/01/13 06:05:46 steve + * Add the XNOR operator. + * * Revision 1.17 2000/01/13 03:35:35 steve * Multiplication all the way to simulation. *