From 5530aea6a34ccc6f67937aa13b882380a616b4db Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 25 Oct 2007 18:59:57 -0700 Subject: [PATCH] v0_8: print an error message for an invalid bit selection. This code may be used for more than just a bit select so the error message is fairly generic. Though it should help in tracking down the real problem (invalid Verilog code). --- vvp/fvectors.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vvp/fvectors.cc b/vvp/fvectors.cc index ef57e5450..87739da1f 100644 --- a/vvp/fvectors.cc +++ b/vvp/fvectors.cc @@ -27,6 +27,7 @@ #ifdef HAVE_MALLOC_H # include #endif +# include # include # include @@ -50,7 +51,11 @@ vvp_ipoint_t vvp_fvector_get(vvp_fvector_t v, unsigned i) { if (!v->size) return ipoint_index(v->cont.iptr, i); - assert(i < v->size); + if (v->size >= i) { + fprintf(stderr, "ERROR: index value (%d) must be less than " + "element size (%d).\n", i, v->size); + assert(0); + } return v->iptrs[i]; }