From 074a6a44e3df630fded69cf36e34f5f3f987a35f Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 1 Feb 2007 03:14:33 +0000 Subject: [PATCH] Detect and report arrays without index in net contexts. --- design_dump.cc | 12 +++++++++--- elab_net.cc | 12 +++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/design_dump.cc b/design_dump.cc index 1d6bb90e8..a4db05df6 100644 --- a/design_dump.cc +++ b/design_dump.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: design_dump.cc,v 1.172 2007/01/16 05:44:14 steve Exp $" +#ident "$Id: design_dump.cc,v 1.173 2007/02/01 03:14:33 steve Exp $" #endif # include "config.h" @@ -30,6 +30,7 @@ # include # include "netlist.h" # include "compiler.h" +# include "ivl_assert.h" static ostream& operator<< (ostream&o, NetBlock::Type t) { @@ -735,8 +736,10 @@ void NetEvTrig::dump(ostream&o, unsigned ind) const void NetEvWait::dump(ostream&o, unsigned ind) const { - assert(nevents() > 0); - o << setw(ind) <<"" << "@(" << event(0)->full_name(); + o << setw(ind) <<"" << "@("; + + if (nevents() > 0) + o << event(0)->full_name(); for (unsigned idx = 1 ; idx < nevents() ; idx += 1) o << " or " << event(idx)->full_name(); @@ -1199,6 +1202,9 @@ void Design::dump(ostream&o) const /* * $Log: design_dump.cc,v $ + * Revision 1.173 2007/02/01 03:14:33 steve + * Detect and report arrays without index in net contexts. + * * Revision 1.172 2007/01/16 05:44:14 steve * Major rework of array handling. Memories are replaced with the * more general concept of arrays. The NetMemory and NetEMemory diff --git a/elab_net.cc b/elab_net.cc index fd945b54f..2208783bb 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: elab_net.cc,v 1.195 2007/01/31 04:21:10 steve Exp $" +#ident "$Id: elab_net.cc,v 1.196 2007/02/01 03:14:33 steve Exp $" #endif # include "config.h" @@ -1683,6 +1683,13 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope, /* Handle the case that this is an array elsewhere. */ if (sig->array_dimensions() > 0) { + if (idx_.size() == 0) { + cerr << get_line() << ": error: Array " << sig->name() + << " cannot be used here without an index." << endl; + des->errors += 1; + return 0; + } + return elaborate_net_array_(des, scope, sig, lwidth, rise, fall, decay, drive0, drive1); @@ -2895,6 +2902,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope, /* * $Log: elab_net.cc,v $ + * Revision 1.196 2007/02/01 03:14:33 steve + * Detect and report arrays without index in net contexts. + * * Revision 1.195 2007/01/31 04:21:10 steve * Add method to bind assertions to verilog source lines. *