diff --git a/netlist.cc b/netlist.cc index fc124f54a..51d70212d 100644 --- a/netlist.cc +++ b/netlist.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: netlist.cc,v 1.176 2001/11/19 01:54:14 steve Exp $" +#ident "$Id: netlist.cc,v 1.177 2001/11/19 04:26:46 steve Exp $" #endif # include "config.h" @@ -2326,6 +2326,11 @@ const NetExpr* NetETernary::false_expr() const NetEUnary::NetEUnary(char op, NetExpr*ex) : NetExpr(ex->expr_width()), op_(op), expr_(ex) { + switch (op_) { + case '!': + expr_width(1); + break; + } } NetEUnary::~NetEUnary() @@ -2402,6 +2407,9 @@ const NetProc*NetTaskDef::proc() const /* * $Log: netlist.cc,v $ + * Revision 1.177 2001/11/19 04:26:46 steve + * Unary reduction operators are all 1-bit results. + * * Revision 1.176 2001/11/19 01:54:14 steve * Port close cropping behavior from mcrgb * Move window array reset to libmc. diff --git a/netlist.h b/netlist.h index d9408cf41..32bf7daba 100644 --- a/netlist.h +++ b/netlist.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: netlist.h,v 1.224 2001/11/14 03:28:49 steve Exp $" +#ident "$Id: netlist.h,v 1.225 2001/11/19 04:26:46 steve Exp $" #endif /* @@ -2445,6 +2445,7 @@ class NetEUReduce : public NetEUnary { NetEUReduce(char op, NetExpr*ex); ~NetEUReduce(); + virtual bool set_width(unsigned w); virtual NetNet* synthesize(Design*); virtual NetEConst* eval_tree(); @@ -2861,6 +2862,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.225 2001/11/19 04:26:46 steve + * Unary reduction operators are all 1-bit results. + * * Revision 1.224 2001/11/14 03:28:49 steve * DLL target support for force and release. * diff --git a/set_width.cc b/set_width.cc index de76c8d9b..b187c9c0e 100644 --- a/set_width.cc +++ b/set_width.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: set_width.cc,v 1.19 2001/07/27 04:51:44 steve Exp $" +#ident "$Id: set_width.cc,v 1.20 2001/11/19 04:26:46 steve Exp $" #endif # include "config.h" @@ -330,6 +330,8 @@ bool NetEUnary::set_width(unsigned w) flag = expr_->set_width(w); expr_width(w); break; + case '!': + return w == 1; default: flag = expr_width() == w; break; @@ -338,9 +340,21 @@ bool NetEUnary::set_width(unsigned w) return flag; } +/* + * Unary reduction operators allow its operand to have any width. The + * result is defined to be 1. + */ +bool NetEUReduce::set_width(unsigned w) +{ + return w == 1; +} + /* * $Log: set_width.cc,v $ + * Revision 1.20 2001/11/19 04:26:46 steve + * Unary reduction operators are all 1-bit results. + * * Revision 1.19 2001/07/27 04:51:44 steve * Handle part select expressions as variants of * NetESignal/IVL_EX_SIGNAL objects, instead of