Constant expressions are not l-values for task ports.

This commit is contained in:
steve 2002-03-09 04:02:26 +00:00
parent b7c2bd4f72
commit 3d646aa92c
3 changed files with 41 additions and 7 deletions

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: PExpr.h,v 1.55 2002/03/09 02:10:22 steve Exp $"
#ident "$Id: PExpr.h,v 1.56 2002/03/09 04:02:26 steve Exp $"
#endif
# include <string>
@ -275,6 +275,8 @@ class PENumber : public PExpr {
Link::strength_t drive1) const;
virtual NetEConst*elaborate_expr(Design*des, NetScope*) const;
virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const;
virtual NetAssign_* elaborate_lval(Design*des, NetScope*scope) const;
virtual verinum* eval_const(const Design*des, const NetScope*sc) const;
virtual verireal*eval_rconst(const Design*, const NetScope*) const;
@ -473,6 +475,9 @@ class PECallFunction : public PExpr {
/*
* $Log: PExpr.h,v $
* Revision 1.56 2002/03/09 04:02:26 steve
* Constant expressions are not l-values for task ports.
*
* Revision 1.55 2002/03/09 02:10:22 steve
* Add the NetUserFunc netlist node.
*

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: elab_lval.cc,v 1.17 2001/12/03 04:47:14 steve Exp $"
#ident "$Id: elab_lval.cc,v 1.18 2002/03/09 04:02:26 steve Exp $"
#endif
# include "config.h"
@ -67,7 +67,7 @@
*/
NetAssign_* PExpr::elaborate_lval(Design*des, NetScope*scope) const
{
NetNet*ll = elaborate_net(des, scope, 0, 0, 0, 0);
NetNet*ll = 0; //XXXXelaborate_net(des, scope, 0, 0, 0, 0);
if (ll == 0) {
cerr << get_line() << ": Assignment l-value too complex."
<< endl;
@ -275,8 +275,19 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const
return lv;
}
NetAssign_* PENumber::elaborate_lval(Design*des, NetScope*) const
{
cerr << get_line() << ": error: Constant values not allowed "
<< "in l-value expressions." << endl;
des->errors += 1;
return 0;
}
/*
* $Log: elab_lval.cc,v $
* Revision 1.18 2002/03/09 04:02:26 steve
* Constant expressions are not l-values for task ports.
*
* Revision 1.17 2001/12/03 04:47:14 steve
* Parser and pform use hierarchical names as hname_t
* objects instead of encoded strings.

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.240 2002/01/23 05:56:22 steve Exp $"
#ident "$Id: elaborate.cc,v 1.241 2002/03/09 04:02:26 steve Exp $"
#endif
# include "config.h"
@ -1487,9 +1487,24 @@ NetProc* PCallTask::elaborate_usr(Design*des, NetScope*scope) const
}
NetAssign_*lv = parms_[idx]
? parms_[idx]->elaborate_lval(des, scope)
: 0;
/* Elaborate an l-value version of the port expression
for output and inout ports. If the expression does
not exist then quietly skip it, but if the expression
is not a valid l-value print an error message. Note
that the elaborate_lval method already printed a
detailed message. */
NetAssign_*lv;
if (parms_[idx]) {
lv = parms_[idx]->elaborate_lval(des, scope);
if (lv == 0) {
cerr << parms_[idx]->get_line() << ": error: "
<< "I give up on task port " << (idx+1)
<< " expression: " << *parms_[idx] << endl;
}
} else {
lv = 0;
}
if (lv == 0)
continue;
@ -2408,6 +2423,9 @@ Design* elaborate(list<const char*>roots)
/*
* $Log: elaborate.cc,v $
* Revision 1.241 2002/03/09 04:02:26 steve
* Constant expressions are not l-values for task ports.
*
* Revision 1.240 2002/01/23 05:56:22 steve
* elaborate deassign lval as done for assign.
*