From 7d7beeecc1271f6f77491454eebd588adbaba72a Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 10 Feb 2001 21:20:38 +0000 Subject: [PATCH] Binary operators with operands of indefinite width has itself an indefinite width. --- netlist.cc | 11 ++++++++++- netlist.h | 18 ++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/netlist.cc b/netlist.cc index eeeb64ff3..8710ed0c3 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.156 2001/02/08 01:10:30 steve Exp $" +#ident "$Id: netlist.cc,v 1.157 2001/02/10 21:20:38 steve Exp $" #endif # include @@ -1882,6 +1882,11 @@ NetEBinary::~NetEBinary() delete right_; } +bool NetEBinary::has_width() const +{ + return left_->has_width() && right_->has_width(); +} + NetEBinary* NetEBinary::dup_expr() const { assert(0); @@ -2455,6 +2460,10 @@ bool NetUDP::sequ_glob_(string input, char output) /* * $Log: netlist.cc,v $ + * Revision 1.157 2001/02/10 21:20:38 steve + * Binary operators with operands of indefinite width + * has itself an indefinite width. + * * Revision 1.156 2001/02/08 01:10:30 steve * Remove dead code. * diff --git a/netlist.h b/netlist.h index 14c023722..21c0e0c61 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.197 2001/02/10 20:29:39 steve Exp $" +#ident "$Id: netlist.h,v 1.198 2001/02/10 21:20:38 steve Exp $" #endif /* @@ -843,9 +843,14 @@ class NetExpr : public LineInfo { // This returns true if the expression has a definite // width. This is generally true, but in some cases the // expression is amorphous and desires a width from its - // environment. + // environment. For example, 'd5 has indefinite width, but + // 5'd5 has a definite width. + + // This method is only really used within concatenation + // expressions to check validity. virtual bool has_width() const; + // This method evaluates the expression and returns an // equivilent expression that is reduced as far as compile // time knows how. Essentially, this is designed to fold @@ -2078,6 +2083,11 @@ class NetEBinary : public NetExpr { virtual bool set_width(unsigned w); + // A binary expression node only has a definite + // self-determinable width if the operands both have definite + // widths. + virtual bool has_width() const; + virtual NetEBinary* dup_expr() const; virtual void expr_scan(struct expr_scan_t*) const; @@ -2855,6 +2865,10 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.198 2001/02/10 21:20:38 steve + * Binary operators with operands of indefinite width + * has itself an indefinite width. + * * Revision 1.197 2001/02/10 20:29:39 steve * In the context of range declarations, use elab_and_eval instead * of the less robust eval_const methods.