Detect part select out of range in nets. (PR#138)

This commit is contained in:
steve 2001-02-09 20:18:15 +00:00
parent 7ef3b44ab1
commit 2b903f5d0e
1 changed files with 14 additions and 4 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_net.cc,v 1.62 2001/02/08 01:10:30 steve Exp $" #ident "$Id: elab_net.cc,v 1.63 2001/02/09 20:18:15 steve Exp $"
#endif #endif
# include "PExpr.h" # include "PExpr.h"
@ -1136,9 +1136,16 @@ NetNet* PEIdent::elaborate_net(Design*des, const string&path,
NetNet*tmp = new NetNet(scope, des->local_symbol(path), NetNet*tmp = new NetNet(scope, des->local_symbol(path),
sig->type(), midx-lidx+1); sig->type(), midx-lidx+1);
tmp->local_flag(true); tmp->local_flag(true);
if (tmp->pin_count() > sig->pin_count()) {
cerr << get_line() << ": bit select out of " /* Check that the bit or part select of the signal is
<< "range for " << sig->name() << endl; within the range of the part. The lidx is the
normalized index of the LSB, so that plus the desired
width must be <= the width of the references signal. */
if ((lidx + tmp->pin_count()) > sig->pin_count()) {
cerr << get_line() << ": error: bit/part select ["
<< mval->as_long() << ":" << lval->as_long()
<< "] out of range for " << sig->name() << endl;
des->errors += 1;
return sig; return sig;
} }
@ -1896,6 +1903,9 @@ NetNet* PEUnary::elaborate_net(Design*des, const string&path,
/* /*
* $Log: elab_net.cc,v $ * $Log: elab_net.cc,v $
* Revision 1.63 2001/02/09 20:18:15 steve
* Detect part select out of range in nets. (PR#138)
*
* Revision 1.62 2001/02/08 01:10:30 steve * Revision 1.62 2001/02/08 01:10:30 steve
* Remove dead code. * Remove dead code.
* *