From 9067c91656ce1895c83e640ec999e14a31c592e7 Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 20 Sep 2000 02:53:14 +0000 Subject: [PATCH] Correctly measure comples l-values of assignments. --- elaborate.cc | 9 ++++++--- net_assign.cc | 15 ++++++++++++++- netmisc.h | 13 ++++++++++++- t-vvm.cc | 13 +++++++++++-- 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index 22fbd1aca..a5713302e 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: elaborate.cc,v 1.189 2000/09/09 15:21:26 steve Exp $" +#ident "$Id: elaborate.cc,v 1.190 2000/09/20 02:53:14 steve Exp $" #endif /* @@ -903,7 +903,7 @@ NetProc* PAssign::elaborate(Design*des, const string&path) const return bl; } - { unsigned wid = lv->lwidth(); + { unsigned wid = count_lval_width(lv); rv->set_width(wid); rv = pad_to_width(rv, wid); assert(rv->expr_width() >= wid); @@ -984,7 +984,7 @@ NetProc* PAssignNB::elaborate(Design*des, const string&path) const assert(rv); - { unsigned wid = lv->lwidth(); + { unsigned wid = count_lval_width(lv); rv->set_width(wid); rv = pad_to_width(rv, wid); } @@ -2257,6 +2257,9 @@ Design* elaborate(const map&modules, /* * $Log: elaborate.cc,v $ + * Revision 1.190 2000/09/20 02:53:14 steve + * Correctly measure comples l-values of assignments. + * * Revision 1.189 2000/09/09 15:21:26 steve * move lval elaboration to PExpr virtual methods. * diff --git a/net_assign.cc b/net_assign.cc index 5ef81b182..9796c9933 100644 --- a/net_assign.cc +++ b/net_assign.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: net_assign.cc,v 1.4 2000/09/10 02:18:16 steve Exp $" +#ident "$Id: net_assign.cc,v 1.5 2000/09/20 02:53:15 steve Exp $" #endif # include "netlist.h" @@ -26,6 +26,16 @@ * NetAssign */ +unsigned count_lval_width(const NetAssign_*idx) +{ + unsigned wid = 0; + while (idx) { + wid += idx->lwidth(); + idx = idx->more; + } + return wid; +} + NetAssign_::NetAssign_(const string&n, unsigned w) : NetNode(n, w), bmux_(0) { @@ -151,6 +161,9 @@ NetAssignNB::~NetAssignNB() /* * $Log: net_assign.cc,v $ + * Revision 1.5 2000/09/20 02:53:15 steve + * Correctly measure comples l-values of assignments. + * * Revision 1.4 2000/09/10 02:18:16 steve * elaborate complex l-values * diff --git a/netmisc.h b/netmisc.h index 48eef6043..b4dda1062 100644 --- a/netmisc.h +++ b/netmisc.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: netmisc.h,v 1.8 2000/06/25 19:59:42 steve Exp $" +#ident "$Id: netmisc.h,v 1.9 2000/09/20 02:53:15 steve Exp $" #endif # include "netlist.h" @@ -55,8 +55,19 @@ extern bool link_drivers_constant(const Link&lnk); */ extern verinum::V driven_value(const Link&lnk); +/* + * In some cases the lval is accessible as a pointer to the head of + * a list of NetAssign_ objects. This function returns the width of + * the l-value represented by this list. + */ +extern unsigned count_lval_width(const class NetAssign_*first); + + /* * $Log: netmisc.h,v $ + * Revision 1.9 2000/09/20 02:53:15 steve + * Correctly measure comples l-values of assignments. + * * Revision 1.8 2000/06/25 19:59:42 steve * Redesign Links to include the Nexus class that * carries properties of the connected set of links. diff --git a/t-vvm.cc b/t-vvm.cc index 8a64448ae..5a08ca895 100644 --- a/t-vvm.cc +++ b/t-vvm.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-vvm.cc,v 1.175 2000/09/17 21:26:15 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.176 2000/09/20 02:53:15 steve Exp $" #endif # include @@ -2582,8 +2582,14 @@ void target_vvm::proc_assign_nb(const NetAssignNB*net) } - string rval; + if (net->lwidth() > net->rval()->expr_width()) { + cerr << net->get_line() << ": internal error: " + << "lvalue width is " << net->lwidth() << ", " + << "rvalue width is " << net->rval()->expr_width() + << "." << endl; + } + assert(net->lwidth() <= net->rval()->expr_width()); /* Handle another special case, that of an r-value that is a @@ -3385,6 +3391,9 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.176 2000/09/20 02:53:15 steve + * Correctly measure comples l-values of assignments. + * * Revision 1.175 2000/09/17 21:26:15 steve * Add support for modulus (Eric Aardoom) *