More complete bit range internal error message,
Better test of part select ranges on non-zero signal ranges.
This commit is contained in:
parent
8df9bb3840
commit
76295ac873
38
elab_net.cc
38
elab_net.cc
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: elab_net.cc,v 1.112 2003/04/11 05:18:08 steve Exp $"
|
#ident "$Id: elab_net.cc,v 1.113 2003/05/01 01:13:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -1370,8 +1370,23 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
|
||||||
|
|
||||||
assert(mval);
|
assert(mval);
|
||||||
assert(lval);
|
assert(lval);
|
||||||
unsigned midx = sig->sb_to_idx(mval->as_long());
|
|
||||||
unsigned lidx = sig->sb_to_idx(lval->as_long());
|
long mbit = mval->as_long();
|
||||||
|
long lbit = lval->as_long();
|
||||||
|
|
||||||
|
/* Check that the part select is valid. Both ends of the
|
||||||
|
constant part select must be within the range of the
|
||||||
|
signal for the part select to be correct. */
|
||||||
|
if (! (sig->sb_is_valid(mbit) && sig->sb_is_valid(lbit))) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned midx = sig->sb_to_idx(mbit);
|
||||||
|
unsigned lidx = sig->sb_to_idx(lbit);
|
||||||
|
|
||||||
/* This is a part select, create a new NetNet object
|
/* This is a part select, create a new NetNet object
|
||||||
that connects to just the desired parts of the
|
that connects to just the desired parts of the
|
||||||
|
|
@ -1397,18 +1412,6 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
|
||||||
|
|
||||||
unsigned part_count = midx-lidx+1;
|
unsigned part_count = midx-lidx+1;
|
||||||
|
|
||||||
/* Check that the bit or part select of the signal is
|
|
||||||
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 + part_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;
|
|
||||||
}
|
|
||||||
|
|
||||||
NetSubnet*tmp = new NetSubnet(sig, lidx, part_count);
|
NetSubnet*tmp = new NetSubnet(sig, lidx, part_count);
|
||||||
|
|
||||||
sig = tmp;
|
sig = tmp;
|
||||||
|
|
@ -2324,6 +2327,11 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: elab_net.cc,v $
|
* $Log: elab_net.cc,v $
|
||||||
|
* Revision 1.113 2003/05/01 01:13:57 steve
|
||||||
|
* More complete bit range internal error message,
|
||||||
|
* Better test of part select ranges on non-zero
|
||||||
|
* signal ranges.
|
||||||
|
*
|
||||||
* Revision 1.112 2003/04/11 05:18:08 steve
|
* Revision 1.112 2003/04/11 05:18:08 steve
|
||||||
* Handle signed magnitude compare all the
|
* Handle signed magnitude compare all the
|
||||||
* way through to the vvp code generator.
|
* way through to the vvp code generator.
|
||||||
|
|
|
||||||
126
netlist.cc
126
netlist.cc
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: netlist.cc,v 1.214 2003/04/27 16:33:16 steve Exp $"
|
#ident "$Id: netlist.cc,v 1.215 2003/05/01 01:13:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -192,6 +192,13 @@ const NetScope* NetObj::scope() const
|
||||||
|
|
||||||
Link& NetObj::pin(unsigned idx)
|
Link& NetObj::pin(unsigned idx)
|
||||||
{
|
{
|
||||||
|
if (idx >= npins_) {
|
||||||
|
cerr << get_line() << ": internal error: pin("<<idx<<")"
|
||||||
|
<< " out of bounds("<<npins_<<")" << endl;
|
||||||
|
cerr << get_line() << ": : typeid="
|
||||||
|
<< typeid(*this).name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
assert(idx < npins_);
|
assert(idx < npins_);
|
||||||
return pins_[idx];
|
return pins_[idx];
|
||||||
}
|
}
|
||||||
|
|
@ -395,6 +402,14 @@ long NetNet::msb() const
|
||||||
return msb_;
|
return msb_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NetNet::sb_is_valid(long sb) const
|
||||||
|
{
|
||||||
|
if (msb_ >= lsb_)
|
||||||
|
return (sb <= msb_) && (sb >= lsb_);
|
||||||
|
else
|
||||||
|
return (sb <= lsb_) && (sb >= msb_);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned NetNet::sb_to_idx(long sb) const
|
unsigned NetNet::sb_to_idx(long sb) const
|
||||||
{
|
{
|
||||||
if (msb_ >= lsb_)
|
if (msb_ >= lsb_)
|
||||||
|
|
@ -2183,6 +2198,11 @@ const NetProc*NetTaskDef::proc() const
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: netlist.cc,v $
|
* $Log: netlist.cc,v $
|
||||||
|
* Revision 1.215 2003/05/01 01:13:57 steve
|
||||||
|
* More complete bit range internal error message,
|
||||||
|
* Better test of part select ranges on non-zero
|
||||||
|
* signal ranges.
|
||||||
|
*
|
||||||
* Revision 1.214 2003/04/27 16:33:16 steve
|
* Revision 1.214 2003/04/27 16:33:16 steve
|
||||||
* Better guess of defualt ternary width.
|
* Better guess of defualt ternary width.
|
||||||
*
|
*
|
||||||
|
|
@ -2201,109 +2221,5 @@ const NetProc*NetTaskDef::proc() const
|
||||||
*
|
*
|
||||||
* Revision 1.209 2003/03/15 18:08:43 steve
|
* Revision 1.209 2003/03/15 18:08:43 steve
|
||||||
* Comparison operators do have defined width.
|
* Comparison operators do have defined width.
|
||||||
*
|
|
||||||
* Revision 1.208 2003/03/10 23:40:53 steve
|
|
||||||
* Keep parameter constants for the ivl_target API.
|
|
||||||
*
|
|
||||||
* Revision 1.207 2003/03/06 00:28:42 steve
|
|
||||||
* All NetObj objects have lex_string base names.
|
|
||||||
*
|
|
||||||
* Revision 1.206 2003/03/01 06:25:30 steve
|
|
||||||
* Add the lex_strings string handler, and put
|
|
||||||
* scope names and system task/function names
|
|
||||||
* into this table. Also, permallocate event
|
|
||||||
* names from the beginning.
|
|
||||||
*
|
|
||||||
* Revision 1.205 2003/01/27 00:14:37 steve
|
|
||||||
* Support in various contexts the $realtime
|
|
||||||
* system task.
|
|
||||||
*
|
|
||||||
* Revision 1.204 2003/01/26 21:15:59 steve
|
|
||||||
* Rework expression parsing and elaboration to
|
|
||||||
* accommodate real/realtime values and expressions.
|
|
||||||
*
|
|
||||||
* Revision 1.203 2002/11/09 00:25:27 steve
|
|
||||||
* Add dup_expr for user defined function calls.
|
|
||||||
*
|
|
||||||
* Revision 1.202 2002/11/06 02:25:13 steve
|
|
||||||
* No need to keep excess width from an
|
|
||||||
* unsigned constant value, if it can
|
|
||||||
* be trimmed safely.
|
|
||||||
*
|
|
||||||
* Revision 1.201 2002/10/23 01:47:17 steve
|
|
||||||
* Fix synth2 handling of aset/aclr signals where
|
|
||||||
* flip-flops are split by begin-end blocks.
|
|
||||||
*
|
|
||||||
* Revision 1.200 2002/09/26 03:18:04 steve
|
|
||||||
* Generate vvp code for asynch set/reset of NetFF.
|
|
||||||
*
|
|
||||||
* Revision 1.199 2002/09/01 03:01:48 steve
|
|
||||||
* Properly cast signedness of parameters with ranges.
|
|
||||||
*
|
|
||||||
* Revision 1.198 2002/08/19 00:06:12 steve
|
|
||||||
* Allow release to handle removal of target net.
|
|
||||||
*
|
|
||||||
* Revision 1.197 2002/08/12 01:34:59 steve
|
|
||||||
* conditional ident string using autoconfig.
|
|
||||||
*
|
|
||||||
* Revision 1.196 2002/08/04 18:28:15 steve
|
|
||||||
* Do not use hierarchical names of memories to
|
|
||||||
* generate vvp labels. -tdll target does not
|
|
||||||
* used hierarchical name string to look up the
|
|
||||||
* memory objects in the design.
|
|
||||||
*
|
|
||||||
* Revision 1.195 2002/07/28 23:58:44 steve
|
|
||||||
* Fix NetBlock destructor to delete substatements.
|
|
||||||
*
|
|
||||||
* Revision 1.194 2002/07/24 16:24:45 steve
|
|
||||||
* Rewrite find_similar_event to support doing
|
|
||||||
* all event matching and replacement in one
|
|
||||||
* shot, saving time in the scans.
|
|
||||||
*
|
|
||||||
* Revision 1.193 2002/07/02 03:02:57 steve
|
|
||||||
* Change the signal to a net when assignments go away.
|
|
||||||
*
|
|
||||||
* Revision 1.192 2002/06/21 04:59:35 steve
|
|
||||||
* Carry integerness throughout the compilation.
|
|
||||||
*
|
|
||||||
* Revision 1.191 2002/06/19 04:20:03 steve
|
|
||||||
* Remove NetTmp and add NetSubnet class.
|
|
||||||
*
|
|
||||||
* Revision 1.190 2002/06/05 03:44:25 steve
|
|
||||||
* Add support for memory words in l-value of
|
|
||||||
* non-blocking assignments, and remove the special
|
|
||||||
* NetAssignMem_ and NetAssignMemNB classes.
|
|
||||||
*
|
|
||||||
* Revision 1.189 2002/06/04 05:38:44 steve
|
|
||||||
* Add support for memory words in l-value of
|
|
||||||
* blocking assignments, and remove the special
|
|
||||||
* NetAssignMem class.
|
|
||||||
*
|
|
||||||
* Revision 1.188 2002/05/27 00:08:45 steve
|
|
||||||
* Support carrying the scope of named begin-end
|
|
||||||
* blocks down to the code generator, and have
|
|
||||||
* the vvp code generator use that to support disable.
|
|
||||||
*
|
|
||||||
* Revision 1.187 2002/05/26 01:39:02 steve
|
|
||||||
* Carry Verilog 2001 attributes with processes,
|
|
||||||
* all the way through to the ivl_target API.
|
|
||||||
*
|
|
||||||
* Divide signal reference counts between rval
|
|
||||||
* and lval references.
|
|
||||||
*
|
|
||||||
* Revision 1.186 2002/05/23 03:08:51 steve
|
|
||||||
* Add language support for Verilog-2001 attribute
|
|
||||||
* syntax. Hook this support into existing $attribute
|
|
||||||
* handling, and add number and void value types.
|
|
||||||
*
|
|
||||||
* Add to the ivl_target API new functions for access
|
|
||||||
* of complex attributes attached to gates.
|
|
||||||
*
|
|
||||||
* Revision 1.185 2002/05/05 21:11:50 steve
|
|
||||||
* Put off evaluation of concatenation repeat expresions
|
|
||||||
* until after parameters are defined. This allows parms
|
|
||||||
* to be used in repeat expresions.
|
|
||||||
*
|
|
||||||
* Add the builtin $signed system function.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
18
netlist.h
18
netlist.h
|
|
@ -19,7 +19,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
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
#ifdef HAVE_CVS_IDENT
|
||||||
#ident "$Id: netlist.h,v 1.286 2003/04/22 04:48:30 steve Exp $"
|
#ident "$Id: netlist.h,v 1.287 2003/05/01 01:13:57 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -82,7 +82,7 @@ struct functor_t;
|
||||||
* interpretation of the rise/fall/decay times is typically left to
|
* interpretation of the rise/fall/decay times is typically left to
|
||||||
* the target to properly interpret.
|
* the target to properly interpret.
|
||||||
*/
|
*/
|
||||||
class NetObj : public Attrib {
|
class NetObj : public Attrib, public virtual LineInfo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
public:
|
public:
|
||||||
|
|
@ -359,7 +359,7 @@ class NetNode : public NetObj {
|
||||||
* anything and they are not a data sink, per se. The pins follow the
|
* anything and they are not a data sink, per se. The pins follow the
|
||||||
* values on the nexus.
|
* values on the nexus.
|
||||||
*/
|
*/
|
||||||
class NetNet : public NetObj, public LineInfo {
|
class NetNet : public NetObj {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Type { IMPLICIT, IMPLICIT_REG, INTEGER, WIRE, TRI, TRI1, SUPPLY0,
|
enum Type { IMPLICIT, IMPLICIT_REG, INTEGER, WIRE, TRI, TRI1, SUPPLY0,
|
||||||
|
|
@ -401,6 +401,11 @@ class NetNet : public NetObj, public LineInfo {
|
||||||
for variation in the definition of the reg/wire/whatever. */
|
for variation in the definition of the reg/wire/whatever. */
|
||||||
unsigned sb_to_idx(long sb) const;
|
unsigned sb_to_idx(long sb) const;
|
||||||
|
|
||||||
|
/* This method checks that the signed index is valid for this
|
||||||
|
signal. If it is, the above sb_to_idx can be used to get
|
||||||
|
the pin# from the index. */
|
||||||
|
bool sb_is_valid(long sb) const;
|
||||||
|
|
||||||
bool local_flag() const { return local_flag_; }
|
bool local_flag() const { return local_flag_; }
|
||||||
void local_flag(bool f) { local_flag_ = f; }
|
void local_flag(bool f) { local_flag_ = f; }
|
||||||
|
|
||||||
|
|
@ -1272,7 +1277,7 @@ class NetUDP : public NetNode {
|
||||||
* linked into the netlist. However, elaborating a process may cause
|
* linked into the netlist. However, elaborating a process may cause
|
||||||
* special nodes to be created to handle things like events.
|
* special nodes to be created to handle things like events.
|
||||||
*/
|
*/
|
||||||
class NetProc : public LineInfo {
|
class NetProc : public virtual LineInfo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NetProc();
|
explicit NetProc();
|
||||||
|
|
@ -3275,6 +3280,11 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: netlist.h,v $
|
* $Log: netlist.h,v $
|
||||||
|
* Revision 1.287 2003/05/01 01:13:57 steve
|
||||||
|
* More complete bit range internal error message,
|
||||||
|
* Better test of part select ranges on non-zero
|
||||||
|
* signal ranges.
|
||||||
|
*
|
||||||
* Revision 1.286 2003/04/22 04:48:30 steve
|
* Revision 1.286 2003/04/22 04:48:30 steve
|
||||||
* Support event names as expressions elements.
|
* Support event names as expressions elements.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue