Get base address from word ranges that VPI user passed.

This commit is contained in:
steve 2005-03-05 05:43:03 +00:00
parent 4ccbb4f0b2
commit 75af32bd3c
1 changed files with 12 additions and 1 deletions

View File

@ -28,7 +28,7 @@
* Picture Elements, Inc., 777 Panoramic Way, Berkeley, CA 94704. * Picture Elements, Inc., 777 Panoramic Way, Berkeley, CA 94704.
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_memory.cc,v 1.24 2005/03/03 04:33:10 steve Exp $" #ident "$Id: vpi_memory.cc,v 1.25 2005/03/05 05:43:03 steve Exp $"
#endif #endif
# include "vpi_priv.h" # include "vpi_priv.h"
@ -246,6 +246,14 @@ static vpiHandle memory_word_put(vpiHandle ref, p_vpi_value val)
unsigned width = memory_word_width(rfp->mem->mem); unsigned width = memory_word_width(rfp->mem->mem);
unsigned word_addr = rfp->index.value; unsigned word_addr = rfp->index.value;
/* Addresses are converted to canonical form by offsetting the
address by the lowest index. */
unsigned addr_off = memory_left_range(rfp->mem->mem, 0);
if (memory_right_range(rfp->mem->mem, 0) < addr_off)
addr_off = memory_right_range(rfp->mem->mem, 0);
word_addr -= addr_off;
/* Build up the word value from whatever format the user /* Build up the word value from whatever format the user
supplies. */ supplies. */
vvp_vector4_t put_val (width); vvp_vector4_t put_val (width);
@ -606,6 +614,9 @@ vpiHandle vpip_make_memory(vvp_memory_t mem, const char*name)
/* /*
* $Log: vpi_memory.cc,v $ * $Log: vpi_memory.cc,v $
* Revision 1.25 2005/03/05 05:43:03 steve
* Get base address from word ranges that VPI user passed.
*
* Revision 1.24 2005/03/03 04:33:10 steve * Revision 1.24 2005/03/03 04:33:10 steve
* Rearrange how memories are supported as vvp_vector4 arrays. * Rearrange how memories are supported as vvp_vector4 arrays.
* *