Add support for reduction NOR.

This commit is contained in:
steve 1999-10-05 06:19:46 +00:00
parent a7f48c86e2
commit 4d8c0c79d6
5 changed files with 53 additions and 26 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: design_dump.cc,v 1.45 1999/09/30 02:43:01 steve Exp $"
#ident "$Id: design_dump.cc,v 1.46 1999/10/05 06:19:46 steve Exp $"
#endif
/*
@ -698,7 +698,15 @@ void NetEUFunc::dump(ostream&o) const
void NetEUnary::dump(ostream&o) const
{
o << op_ << "(";
switch (op_) {
case 'N':
o << "~|";
break;
default:
o << op_;
break;
}
o << "(";
expr_->dump(o);
o << ")";
}
@ -774,6 +782,9 @@ void Design::dump(ostream&o) const
/*
* $Log: design_dump.cc,v $
* Revision 1.46 1999/10/05 06:19:46 steve
* Add support for reduction NOR.
*
* Revision 1.45 1999/09/30 02:43:01 steve
* Elaborate ~^ and ~| operators.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: elaborate.cc,v 1.108 1999/10/05 02:00:06 steve Exp $"
#ident "$Id: elaborate.cc,v 1.109 1999/10/05 06:19:46 steve Exp $"
#endif
/*
@ -1867,6 +1867,12 @@ NetProc* PCondit::elaborate(Design*des, const string&path) const
// generate a comparison operator to get the result down to
// one bit. Turn <e> into <e> != 0;
if (expr->expr_width() < 1) {
cerr << get_line() << ": internal error: "
"incomprehensible expression width (0)." << endl;
return 0;
}
if (! expr->set_width(1)) {
assert(expr->expr_width() > 1);
verinum zero (verinum::V0, expr->expr_width());
@ -2547,6 +2553,9 @@ Design* elaborate(const map<string,Module*>&modules,
/*
* $Log: elaborate.cc,v $
* Revision 1.109 1999/10/05 06:19:46 steve
* Add support for reduction NOR.
*
* Revision 1.108 1999/10/05 02:00:06 steve
* sorry message for non-constant l-value bit select.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: set_width.cc,v 1.5 1999/10/05 04:02:10 steve Exp $"
#ident "$Id: set_width.cc,v 1.6 1999/10/05 06:19:46 steve Exp $"
#endif
/*
@ -245,14 +245,8 @@ bool NetEUnary::set_width(unsigned w)
case '-':
flag = expr_->set_width(w);
break;
case '&':
case '!':
if (w != 1) {
flag = false;
}
break;
default:
flag = false;
flag = expr_width() == w;
break;
}
expr_width(w);
@ -262,6 +256,9 @@ bool NetEUnary::set_width(unsigned w)
/*
* $Log: set_width.cc,v $
* Revision 1.6 1999/10/05 06:19:46 steve
* Add support for reduction NOR.
*
* Revision 1.5 1999/10/05 04:02:10 steve
* Relaxed width handling for <= assignment.
*

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.57 1999/10/05 04:02:10 steve Exp $"
#ident "$Id: t-vvm.cc,v 1.58 1999/10/05 06:19:46 steve Exp $"
#endif
# include <iostream>
@ -305,32 +305,29 @@ void vvm_proc_rval::expr_unary(const NetEUnary*expr)
expr->expr()->expr_scan(this);
string tname = make_temp();
os_ << " vvm_bitset_t<" << expr->expr_width() << "> "
os_ << " vvm_bitset_t<" << expr->expr_width() << "> "
<< tname << " = ";
switch (expr->op()) {
case '~':
os_ << "vvm_unop_not(" << result << ");"
<< endl;
os_ << "vvm_unop_not(" << result << ");" << endl;
break;
case '&':
os_ << "vvm_unop_and(" << result << ");"
<< endl;
os_ << "vvm_unop_and(" << result << ");" << endl;
break;
case '^':
os_ << "vvm_unop_xor(" << result << ");"
<< endl;
os_ << "vvm_unop_xor(" << result << ");" << endl;
break;
case '!':
os_ << "vvm_unop_lnot(" << result << ");"
<< endl;
os_ << "vvm_unop_lnot(" << result << ");" << endl;
break;
case '-':
os_ << "vvm_unop_uminus(" << result << ");"
<< endl;
os_ << "vvm_unop_uminus(" << result << ");" << endl;
break;
case 'N':
os_ << "vvm_unop_nor(" << result << ");" << endl;
break;
case 'X':
os_ << "vvm_unop_xnor(" << result << ");"
<< endl;
os_ << "vvm_unop_xnor(" << result << ");" << endl;
break;
default:
cerr << "vvm: Unhandled unary op `" << expr->op() << "'"
@ -1681,6 +1678,9 @@ extern const struct target tgt_vvm = {
};
/*
* $Log: t-vvm.cc,v $
* Revision 1.58 1999/10/05 06:19:46 steve
* Add support for reduction NOR.
*
* Revision 1.57 1999/10/05 04:02:10 steve
* Relaxed width handling for <= assignment.
*

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.13 1999/10/01 15:26:29 steve Exp $"
#ident "$Id: vvm_func.h,v 1.14 1999/10/05 06:19:47 steve Exp $"
#endif
# include "vvm.h"
@ -78,6 +78,13 @@ vvm_bitset_t<1> vvm_unop_or(const vvm_bitset_t<WIDTH>&r)
return res;
}
template <unsigned WIDTH>
vvm_bitset_t<1> vvm_unop_nor(const vvm_bitset_t<WIDTH>&r)
{
vvm_bitset_t<1>res = vvm_unop_or(r);
return vvm_unop_not(res);
}
template <unsigned WIDTH>
vvm_bitset_t<1> vvm_unop_lnot(const vvm_bitset_t<WIDTH>&r)
{
@ -601,6 +608,9 @@ vvm_bitset_t<W> vvm_ternary(vvm_bit_t c, const vvm_bitset_t<W>&t,
/*
* $Log: vvm_func.h,v $
* Revision 1.14 1999/10/05 06:19:47 steve
* Add support for reduction NOR.
*
* Revision 1.13 1999/10/01 15:26:29 steve
* Add some vvm operators from Eric Aardoom.
*