From 3fca25181ad065f6b9cbe4d81343cde59cf09ce5 Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 28 Aug 2002 18:54:36 +0000 Subject: [PATCH] Evaluate nonblocking assign r-values. --- elaborate.cc | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index 98a161f06..b76de0021 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: elaborate.cc,v 1.262 2002/08/15 02:11:54 steve Exp $" +#ident "$Id: elaborate.cc,v 1.263 2002/08/28 18:54:36 steve Exp $" #endif # include "config.h" @@ -1107,11 +1107,22 @@ NetProc* PAssignNB::elaborate(Design*des, NetScope*scope) const assert(rval()); - /* Elaborate the r-value expression. This generates a - procedural expression that I attach to the assignment. */ - NetExpr*rv = rval()->elaborate_expr(des, scope); - if (rv == 0) + NetExpr*rv; + + /* Evaluate the rval expression if possible, otherwise just + elaborate it. */ + if (verinum*val = rval()->eval_const(des, scope)) { + rv = new NetEConst(*val); + delete val; + + } else if (rv = rval()->elaborate_expr(des, scope)) { + + /* OK, go on. */ + + } else { + /* Unable to elaborate expression. Retreat. */ return 0; + } assert(rv); @@ -2511,6 +2522,9 @@ Design* elaborate(listroots) /* * $Log: elaborate.cc,v $ + * Revision 1.263 2002/08/28 18:54:36 steve + * Evaluate nonblocking assign r-values. + * * Revision 1.262 2002/08/15 02:11:54 steve * Handle special case of empty system task argument list. *