Check address is in range for set. (Stephan Boettcher)

This commit is contained in:
steve 2001-09-29 04:45:20 +00:00
parent bdf643ddb1
commit ff55af1e9e
1 changed files with 7 additions and 1 deletions

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: memory.cc,v 1.8 2001/09/15 18:27:05 steve Exp $"
#ident "$Id: memory.cc,v 1.9 2001/09/29 04:45:20 steve Exp $"
#endif
#include "memory.h"
@ -400,6 +400,9 @@ void vvp_memory_port_s::set(vvp_ipoint_t i, functor_t f, bool push)
void memory_set(vvp_memory_t mem, unsigned idx, unsigned char val)
{
if (idx/4 > (mem->size * mem->fwidth))
return;
if (!set_bit(mem->bits, idx, val))
return;
@ -410,6 +413,9 @@ void memory_set(vvp_memory_t mem, unsigned idx, unsigned char val)
unsigned memory_get(vvp_memory_t mem, unsigned idx)
{
if (idx/4 > (mem->size * mem->fwidth))
return 2;
return get_bit(mem->bits, idx);
}