Detect indefinite widths where definite widths are required.
This commit is contained in:
parent
8b581cef46
commit
79b1c51e68
14
elab_expr.cc
14
elab_expr.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: elab_expr.cc,v 1.28 2000/09/24 17:41:13 steve Exp $"
|
||||
#ident "$Id: elab_expr.cc,v 1.29 2000/09/26 05:05:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -240,7 +240,16 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope) const
|
|||
assert(parms_[idx]);
|
||||
NetExpr*ex = parms_[idx]->elaborate_expr(des, scope);
|
||||
if (ex == 0) continue;
|
||||
|
||||
ex->set_line(*parms_[idx]);
|
||||
|
||||
if (! ex->has_width()) {
|
||||
cerr << ex->get_line() << ": error: operand of "
|
||||
<< "concatenation has indefinite width: "
|
||||
<< *ex << endl;
|
||||
des->errors += 1;
|
||||
}
|
||||
|
||||
tmp->set(idx, ex);
|
||||
}
|
||||
|
||||
|
|
@ -507,6 +516,9 @@ NetEUnary* PEUnary::elaborate_expr(Design*des, NetScope*scope) const
|
|||
|
||||
/*
|
||||
* $Log: elab_expr.cc,v $
|
||||
* Revision 1.29 2000/09/26 05:05:58 steve
|
||||
* Detect indefinite widths where definite widths are required.
|
||||
*
|
||||
* Revision 1.28 2000/09/24 17:41:13 steve
|
||||
* fix null pointer when elaborating undefined task.
|
||||
*
|
||||
|
|
|
|||
23
elab_net.cc
23
elab_net.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: elab_net.cc,v 1.47 2000/09/17 21:26:15 steve Exp $"
|
||||
#ident "$Id: elab_net.cc,v 1.48 2000/09/26 05:05:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "PExpr.h"
|
||||
|
|
@ -943,6 +943,21 @@ NetNet* PEConcat::elaborate_net(Design*des, const string&path,
|
|||
|
||||
/* Elaborate the operands of the concatenation. */
|
||||
for (unsigned idx = 0 ; idx < nets.count() ; idx += 1) {
|
||||
|
||||
/* Look for the special case of an unsized number in a
|
||||
concatenation expression. Mark this as an error, but
|
||||
allow elaboration to continue to see if I can find
|
||||
more errors. */
|
||||
|
||||
if (PENumber*tmp = dynamic_cast<PENumber*>(parms_[idx])) {
|
||||
if (tmp->value().has_len() == false) {
|
||||
cerr << get_line() << ": error: Number "
|
||||
<< tmp->value() << " with indefinite size"
|
||||
<< " in concatenation." << endl;
|
||||
errors += 1;
|
||||
}
|
||||
}
|
||||
|
||||
nets[idx] = parms_[idx]->elaborate_net(des, path, 0,
|
||||
rise,fall,decay);
|
||||
if (nets[idx] == 0)
|
||||
|
|
@ -1427,6 +1442,9 @@ NetNet* PENumber::elaborate_net(Design*des, const string&path,
|
|||
return net;
|
||||
}
|
||||
|
||||
cerr << get_line() << ": warning: Number with indefinite size "
|
||||
<< "in self-determined context." << endl;
|
||||
|
||||
/* None of the above tight constraints are present, so make a
|
||||
plausible choice for the width. Try to reduce the width as
|
||||
much as possible by eliminating high zeros of unsigned
|
||||
|
|
@ -1746,6 +1764,9 @@ NetNet* PEUnary::elaborate_net(Design*des, const string&path,
|
|||
|
||||
/*
|
||||
* $Log: elab_net.cc,v $
|
||||
* Revision 1.48 2000/09/26 05:05:58 steve
|
||||
* Detect indefinite widths where definite widths are required.
|
||||
*
|
||||
* Revision 1.47 2000/09/17 21:26:15 steve
|
||||
* Add support for modulus (Eric Aardoom)
|
||||
*
|
||||
|
|
|
|||
30
netlist.cc
30
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.138 2000/09/26 01:35:42 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.139 2000/09/26 05:05:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <cassert>
|
||||
|
|
@ -1719,6 +1719,16 @@ NetExpr::~NetExpr()
|
|||
{
|
||||
}
|
||||
|
||||
bool NetExpr::has_sign() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NetExpr::has_width() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
NetEBAdd::NetEBAdd(char op, NetExpr*l, NetExpr*r)
|
||||
: NetEBinary(op, l, r)
|
||||
{
|
||||
|
|
@ -1938,6 +1948,21 @@ NetEConst::~NetEConst()
|
|||
{
|
||||
}
|
||||
|
||||
const verinum& NetEConst::value() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
bool NetEConst::has_sign() const
|
||||
{
|
||||
return value_.has_sign();
|
||||
}
|
||||
|
||||
bool NetEConst::has_width() const
|
||||
{
|
||||
return value_.has_len();
|
||||
}
|
||||
|
||||
NetEConst* NetEConst::dup_expr() const
|
||||
{
|
||||
NetEConst*tmp = new NetEConst(value_);
|
||||
|
|
@ -2395,6 +2420,9 @@ bool NetUDP::sequ_glob_(string input, char output)
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.139 2000/09/26 05:05:58 steve
|
||||
* Detect indefinite widths where definite widths are required.
|
||||
*
|
||||
* Revision 1.138 2000/09/26 01:35:42 steve
|
||||
* Remove the obsolete NetEIdent class.
|
||||
*
|
||||
|
|
|
|||
21
netlist.h
21
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.167 2000/09/26 01:35:42 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.168 2000/09/26 05:05:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -810,6 +810,16 @@ class NetExpr : public LineInfo {
|
|||
// coersion works, then return true. Otherwise, return false.
|
||||
virtual bool set_width(unsigned);
|
||||
|
||||
// This method returns true if the expression is
|
||||
// signed. Unsigned expressions return false.
|
||||
virtual bool has_sign() const;
|
||||
|
||||
// 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.
|
||||
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
|
||||
|
|
@ -847,9 +857,13 @@ class NetEConst : public NetExpr {
|
|||
explicit NetEConst(const verinum&val);
|
||||
~NetEConst();
|
||||
|
||||
const verinum&value() const { return value_; }
|
||||
const verinum&value() const;
|
||||
|
||||
virtual bool set_width(unsigned w);
|
||||
|
||||
virtual bool has_sign() const;
|
||||
virtual bool has_width() const;
|
||||
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
virtual void dump(ostream&) const;
|
||||
|
||||
|
|
@ -2781,6 +2795,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.168 2000/09/26 05:05:58 steve
|
||||
* Detect indefinite widths where definite widths are required.
|
||||
*
|
||||
* Revision 1.167 2000/09/26 01:35:42 steve
|
||||
* Remove the obsolete NetEIdent class.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue