vpi_get_value should return an appropriate value during compiletf.

The vpi_get_value() function should not crash when called during
the compiletf phase. This patch fixes this by returning 'bx for
any vectors in thread space. It also fixes some other minor things
that my test code uncovered. Most of the other objects work as
expected.
This commit is contained in:
Cary R 2010-03-22 18:49:11 -07:00 committed by Stephen Williams
parent 9a94d55738
commit bc7a5a9725
2 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>
*
* This source code is free software; you can redistribute it
@ -109,7 +109,8 @@ static int vthr_vec_get(int code, vpiHandle ref)
static char* vthr_vec_get_str(int code, vpiHandle ref)
{
assert((ref->vpi_type->type_code==vpiNet)
|| (ref->vpi_type->type_code==vpiReg));
|| (ref->vpi_type->type_code==vpiReg)
|| (ref->vpi_type->type_code==vpiConstant));
struct __vpiVThrVec*rfp = (struct __vpiVThrVec*)ref;
@ -319,6 +320,8 @@ static void vthr_vec_get_value(vpiHandle ref, s_vpi_value*vp)
}
break;
case vpiObjTypeVal:
vp->format = vpiVectorVal;
case vpiVectorVal:
vp->value.vector = (s_vpi_vecval*)
need_result_buf((wid+31)/32*sizeof(s_vpi_vecval), RBUF_VAL);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -167,7 +167,8 @@ static inline void thr_clr_bit_(struct vthread_s*thr, unsigned addr)
vvp_bit4_t vthread_get_bit(struct vthread_s*thr, unsigned addr)
{
return thr_get_bit(thr, addr);
if (vpi_mode_flag == VPI_MODE_COMPILETF) return BIT4_X;
else return thr_get_bit(thr, addr);
}
void vthread_put_bit(struct vthread_s*thr, unsigned addr, vvp_bit4_t bit)