diff --git a/vvp/part.cc b/vvp/part.cc index 54ccc6b31..dc9dbedcd 100644 --- a/vvp/part.cc +++ b/vvp/part.cc @@ -16,11 +16,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ident "$Id: part.cc,v 1.4 2005/05/08 23:40:14 steve Exp $" +#ident "$Id: part.cc,v 1.5 2005/05/09 00:36:58 steve Exp $" # include "compile.h" # include "vvp_net.h" # include +# include #ifdef HAVE_MALLOC_H # include #endif @@ -84,6 +85,7 @@ void vvp_fun_part_var::recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit) source_ = bit; break; case 1: + tmp = ULONG_MAX; vector4_to_value(bit, tmp); if (tmp == base_) return; base_ = tmp; @@ -103,7 +105,10 @@ void vvp_fun_part_var::recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit) res.set_bit(idx, source_.value(adr)); } - vvp_send_vec4(port.ptr()->out, res); + if (! ref_.eeq(res)) { + ref_ = res; + vvp_send_vec4(port.ptr()->out, res); + } } @@ -153,6 +158,9 @@ void compile_part_select_var(char*label, char*source, char*var, /* * $Log: part.cc,v $ + * Revision 1.5 2005/05/09 00:36:58 steve + * Force part base out of bounds if index is invalid. + * * Revision 1.4 2005/05/08 23:40:14 steve * Add support for variable part select. * diff --git a/vvp/vvp_net.h b/vvp/vvp_net.h index dc6b4df97..734786699 100644 --- a/vvp/vvp_net.h +++ b/vvp/vvp_net.h @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ident "$Id: vvp_net.h,v 1.26 2005/05/08 23:40:14 steve Exp $" +#ident "$Id: vvp_net.h,v 1.27 2005/05/09 00:36:58 steve Exp $" # include "config.h" # include @@ -548,6 +548,8 @@ class vvp_fun_part_var : public vvp_net_fun_t { unsigned base_; unsigned wid_; vvp_vector4_t source_; + // Save the last output, for detecting change. + vvp_vector4_t ref_; }; /* vvp_fun_signal @@ -719,6 +721,9 @@ class vvp_wide_fun_t : public vvp_net_fun_t { /* * $Log: vvp_net.h,v $ + * Revision 1.27 2005/05/09 00:36:58 steve + * Force part base out of bounds if index is invalid. + * * Revision 1.26 2005/05/08 23:40:14 steve * Add support for variable part select. *