Add the XNOR operator.
This commit is contained in:
parent
ef98be1192
commit
d84b72609d
9
t-vvm.cc
9
t-vvm.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
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#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
|
#endif
|
||||||
|
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
|
|
@ -433,6 +433,10 @@ void vvm_proc_rval::expr_binary(const NetEBinary*expr)
|
||||||
os_ << setw(indent_) << "" << result << " = vvm_binop_shiftr("
|
os_ << setw(indent_) << "" << result << " = vvm_binop_shiftr("
|
||||||
<< lres << "," << rres << ");" << endl;
|
<< lres << "," << rres << ");" << endl;
|
||||||
break;
|
break;
|
||||||
|
case 'X':
|
||||||
|
os_ << setw(indent_) << "" << result << " = vvm_binop_xnor("
|
||||||
|
<< lres << "," << rres << ");" << endl;
|
||||||
|
break;
|
||||||
case '+':
|
case '+':
|
||||||
os_ << setw(indent_) << "" << result << " = vvm_binop_plus("
|
os_ << setw(indent_) << "" << result << " = vvm_binop_plus("
|
||||||
<< lres << "," << rres << ");" << endl;
|
<< lres << "," << rres << ");" << endl;
|
||||||
|
|
@ -2036,6 +2040,9 @@ extern const struct target tgt_vvm = {
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
* $Log: t-vvm.cc,v $
|
* $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
|
* Revision 1.96 2000/01/13 05:11:25 steve
|
||||||
* Support for multiple VPI modules.
|
* Support for multiple VPI modules.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#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
|
#endif
|
||||||
|
|
||||||
# include "vvm.h"
|
# include "vvm.h"
|
||||||
|
|
@ -160,6 +160,17 @@ vvm_bitset_t<WIDTH> vvm_binop_or(const vvm_bitset_t<WIDTH>&l,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <unsigned WIDTH>
|
||||||
|
vvm_bitset_t<WIDTH> vvm_binop_nor(const vvm_bitset_t<WIDTH>&l,
|
||||||
|
const vvm_bitset_t<WIDTH>&r)
|
||||||
|
{
|
||||||
|
vvm_bitset_t<WIDTH> 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
|
* Implement the binary + operator in the verilog way. This takes
|
||||||
* vectors of identical width and returns another vector of same width
|
* vectors of identical width and returns another vector of same width
|
||||||
|
|
@ -228,6 +239,17 @@ vvm_bitset_t<WIDTH> vvm_binop_xor(const vvm_bitset_t<WIDTH>&l,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <unsigned WIDTH>
|
||||||
|
vvm_bitset_t<WIDTH> vvm_binop_xnor(const vvm_bitset_t<WIDTH>&l,
|
||||||
|
const vvm_bitset_t<WIDTH>&r)
|
||||||
|
{
|
||||||
|
vvm_bitset_t<WIDTH> 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
|
* 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
|
* indicated by argument r. r is an unsigned integer, which is represented
|
||||||
|
|
@ -626,6 +648,9 @@ vvm_bitset_t<W> vvm_ternary(vpip_bit_t c, const vvm_bitset_t<W>&t,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vvm_func.h,v $
|
* $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
|
* Revision 1.17 2000/01/13 03:35:35 steve
|
||||||
* Multiplication all the way to simulation.
|
* Multiplication all the way to simulation.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue