Support for vpi_get_value of scaler values. (ravi@bluespec)

This commit is contained in:
steve 2007-04-12 04:45:52 +00:00
parent ff7625cd9c
commit fb7ce1d330
3 changed files with 51 additions and 3 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_const.cc,v 1.38 2007/04/12 04:25:58 steve Exp $"
#ident "$Id: vpi_const.cc,v 1.39 2007/04/12 04:45:52 steve Exp $"
#endif
# include "vpi_priv.h"
@ -319,6 +319,7 @@ static void binary_value(vpiHandle ref, p_vpi_value vp)
case vpiDecStrVal:
case vpiOctStrVal:
case vpiHexStrVal:
case vpiScalarVal:
case vpiIntVal:
case vpiVectorVal:
case vpiStringVal:
@ -617,6 +618,9 @@ vpiHandle vpip_make_real_const(double value)
/*
* $Log: vpi_const.cc,v $
* Revision 1.39 2007/04/12 04:45:52 steve
* Support for vpi_get_value of scaler values. (ravi@bluespec)
*
* Revision 1.38 2007/04/12 04:25:58 steve
* vpip_make_binary_const cannot free the string passed in to it.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_priv.cc,v 1.52 2007/03/07 00:38:16 steve Exp $"
#ident "$Id: vpi_priv.cc,v 1.53 2007/04/12 04:45:52 steve Exp $"
#endif
# include "vpi_priv.h"
@ -410,6 +410,25 @@ void vpip_vec4_get_value(const vvp_vector4_t&word_val, unsigned width,
break;
}
case vpiScalarVal: {
// scalars should be of size 1
assert(width == 1);
switch(word_val.value(0)) {
case BIT4_0:
vp->value.scalar = vpi0;
break;
case BIT4_1:
vp->value.scalar = vpi1;
break;
case BIT4_X:
vp->value.scalar = vpiX;
case BIT4_Z:
vp->value.scalar = vpiZ;
break;
}
break;
}
case vpiIntVal: {
long val = 0;
vvp_bit4_t pad = BIT4_0;
@ -848,6 +867,9 @@ extern "C" void vpi_control(PLI_INT32 operation, ...)
/*
* $Log: vpi_priv.cc,v $
* Revision 1.53 2007/04/12 04:45:52 steve
* Support for vpi_get_value of scaler values. (ravi@bluespec)
*
* Revision 1.52 2007/03/07 00:38:16 steve
* Lint fixes.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_tasks.cc,v 1.34 2007/04/12 04:33:39 steve Exp $"
#ident "$Id: vpi_tasks.cc,v 1.35 2007/04/12 04:45:53 steve Exp $"
#endif
/*
@ -292,6 +292,25 @@ static vpiHandle sysfunc_put_4net_value(vpiHandle ref, p_vpi_value vp)
switch (vp->format) {
case vpiScalarVal: {
switch(vp->value.scalar) {
case vpi0:
val.set_bit(0, BIT4_0);
break;
case vpi1:
val.set_bit(0, BIT4_1);
break;
case vpiX:
val.set_bit(0, BIT4_X);
break;
case vpiZ:
val.set_bit(0, BIT4_Z);
break;
default:
assert(0);
}
}
case vpiIntVal: {
long tmp = vp->value.integer;
for (unsigned idx = 0 ; idx < vwid ; idx += 1) {
@ -614,6 +633,9 @@ void* vpi_get_userdata(vpiHandle ref)
/*
* $Log: vpi_tasks.cc,v $
* Revision 1.35 2007/04/12 04:45:53 steve
* Support for vpi_get_value of scaler values. (ravi@bluespec)
*
* Revision 1.34 2007/04/12 04:33:39 steve
* Add support for vpiSize on system task handle. (ravi@bluespec.com)
*