Correctly measure comples l-values of assignments.

This commit is contained in:
steve 2000-09-20 02:53:14 +00:00
parent 13c1378666
commit 9067c91656
4 changed files with 43 additions and 7 deletions

View File

@ -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<string,Module*>&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.
*

View File

@ -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
*

View File

@ -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.

View File

@ -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 <iostream>
@ -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)
*