Force part base out of bounds if index is invalid.
This commit is contained in:
parent
7dd0d255a6
commit
ed78c5b677
12
vvp/part.cc
12
vvp/part.cc
|
|
@ -16,11 +16,12 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* 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 "compile.h"
|
||||||
# include "vvp_net.h"
|
# include "vvp_net.h"
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
|
# include <limits.h>
|
||||||
#ifdef HAVE_MALLOC_H
|
#ifdef HAVE_MALLOC_H
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -84,6 +85,7 @@ void vvp_fun_part_var::recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit)
|
||||||
source_ = bit;
|
source_ = bit;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
tmp = ULONG_MAX;
|
||||||
vector4_to_value(bit, tmp);
|
vector4_to_value(bit, tmp);
|
||||||
if (tmp == base_) return;
|
if (tmp == base_) return;
|
||||||
base_ = tmp;
|
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));
|
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 $
|
* $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
|
* Revision 1.4 2005/05/08 23:40:14 steve
|
||||||
* Add support for variable part select.
|
* Add support for variable part select.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* 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 "config.h"
|
||||||
# include <assert.h>
|
# include <assert.h>
|
||||||
|
|
@ -548,6 +548,8 @@ class vvp_fun_part_var : public vvp_net_fun_t {
|
||||||
unsigned base_;
|
unsigned base_;
|
||||||
unsigned wid_;
|
unsigned wid_;
|
||||||
vvp_vector4_t source_;
|
vvp_vector4_t source_;
|
||||||
|
// Save the last output, for detecting change.
|
||||||
|
vvp_vector4_t ref_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* vvp_fun_signal
|
/* vvp_fun_signal
|
||||||
|
|
@ -719,6 +721,9 @@ class vvp_wide_fun_t : public vvp_net_fun_t {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vvp_net.h,v $
|
* $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
|
* Revision 1.26 2005/05/08 23:40:14 steve
|
||||||
* Add support for variable part select.
|
* Add support for variable part select.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue