Get vpiVectorVal from memory words.

This commit is contained in:
steve 2006-02-21 02:56:49 +00:00
parent 50ad415c0d
commit a721586acb
1 changed files with 34 additions and 33 deletions

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_memory.cc,v 1.29 2006/02/21 02:39:27 steve Exp $" #ident "$Id: vpi_memory.cc,v 1.30 2006/02/21 02:56:49 steve Exp $"
#endif #endif
# include "vpi_priv.h" # include "vpi_priv.h"
@ -453,42 +453,40 @@ static void memory_word_get_value(vpiHandle ref, s_vpi_value*vp)
} }
break; break;
#endif #endif
#if 0
case vpiVectorVal: { case vpiVectorVal: {
unsigned hwid = (width - 1)/32 + 1; unsigned hwid = (width - 1)/32 + 1;
rbuf = need_result_buf(hwid * sizeof(s_vpi_vecval), RBUF_VAL); rbuf = need_result_buf(hwid * sizeof(s_vpi_vecval), RBUF_VAL);
s_vpi_vecval *op = (p_vpi_vecval)rbuf; s_vpi_vecval *op = (p_vpi_vecval)rbuf;
vp->value.vector = op; vp->value.vector = op;
op->aval = op->bval = 0; op->aval = op->bval = 0;
for (unsigned idx = 0 ; idx < width ; idx += 1) { for (unsigned idx = 0 ; idx < width ; idx += 1) {
switch (memory_get(rfp->mem->mem, bidx+idx)) { switch (word_val.value(idx)) {
case 0: case BIT4_0:
op->aval &= ~(1 << idx % 32); op->aval &= ~(1 << idx % 32);
op->bval &= ~(1 << idx % 32); op->bval &= ~(1 << idx % 32);
break; break;
case 1: case BIT4_1:
op->aval |= (1 << idx % 32); op->aval |= (1 << idx % 32);
op->bval &= ~(1 << idx % 32); op->bval &= ~(1 << idx % 32);
break; break;
case 2: case BIT4_X:
op->aval |= (1 << idx % 32); op->aval |= (1 << idx % 32);
op->bval |= (1 << idx % 32); op->bval |= (1 << idx % 32);
break; break;
case 3: case BIT4_Z:
op->aval &= ~(1 << idx % 32); op->aval &= ~(1 << idx % 32);
op->bval |= (1 << idx % 32); op->bval |= (1 << idx % 32);
break; break;
} }
if (!((idx+1) % 32) && (idx+1 < width)) { if (!((idx+1) % 32) && (idx+1 < width)) {
op++; op++;
op->aval = op->bval = 0; op->aval = op->bval = 0;
} }
} }
break; break;
} }
#endif
} }
} }
@ -555,6 +553,9 @@ vpiHandle vpip_make_memory(vvp_memory_t mem, const char*name)
/* /*
* $Log: vpi_memory.cc,v $ * $Log: vpi_memory.cc,v $
* Revision 1.30 2006/02/21 02:56:49 steve
* Get vpiVectorVal from memory words.
*
* Revision 1.29 2006/02/21 02:39:27 steve * Revision 1.29 2006/02/21 02:39:27 steve
* Support string values for memory words. * Support string values for memory words.
* *