Stopgap fix for br916.
Currently, when a variable expression is passed to a system task, the expression value is stored in thread memory. Values stored in thread memory cannot safely be passed to $strobe or $monitor, because the thread memory may get reused or deallocated before the $strobe or $monitor task actually executes. As a temporary measure, we just trap this case and terminate with a "sorry" message. A proper fix would require the expression value to be calculated at the time the $strobe or $monitor executes, not at the time it is called.
This commit is contained in:
parent
1d314faf97
commit
e99d53b80b
|
|
@ -1042,6 +1042,10 @@ static char *get_display(unsigned int *rtnsz, const struct strobe_cb_info *info)
|
|||
return rtn;
|
||||
}
|
||||
|
||||
#ifdef BR916_STOPGAP_FIX
|
||||
static char br916_hint_issued = 0;
|
||||
#endif
|
||||
|
||||
static int sys_check_args(vpiHandle callh, vpiHandle argv, const PLI_BYTE8*name,
|
||||
int no_auto, int is_monitor)
|
||||
{
|
||||
|
|
@ -1085,6 +1089,31 @@ static int sys_check_args(vpiHandle callh, vpiHandle argv, const PLI_BYTE8*name,
|
|||
case vpiTimeVar:
|
||||
case vpiRealVar:
|
||||
case vpiStringVar:
|
||||
#ifdef BR916_STOPGAP_FIX
|
||||
// no_auto implies either $strobe or $monitor
|
||||
if (no_auto) {
|
||||
switch (vpi_get(_vpiFromThr, arg)) {
|
||||
case _vpiVThr:
|
||||
case _vpiWord:
|
||||
case _vpiString:
|
||||
vpi_printf("SORRY: %s:%d: ",
|
||||
vpi_get_str(vpiFile, callh),
|
||||
(int)vpi_get(vpiLineNo, callh));
|
||||
vpi_printf("currently only simple signals or constant "
|
||||
"expressions may be passed to %s.\n", name);
|
||||
if (!br916_hint_issued) {
|
||||
vpi_printf("NOTE: You can work round this by "
|
||||
"assigning the desired expression "
|
||||
"to an intermediate net (using a "
|
||||
"continuous assignment) and passing "
|
||||
"that net to %s.\n", name);
|
||||
}
|
||||
ret = 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
case vpiSysFuncCall:
|
||||
break;
|
||||
|
||||
|
|
|
|||
19
vpi_user.h
19
vpi_user.h
|
|
@ -633,6 +633,25 @@ extern void vpip_make_systf_system_defined(vpiHandle ref);
|
|||
extern void vpip_count_drivers(vpiHandle ref, unsigned idx,
|
||||
unsigned counts[4]);
|
||||
|
||||
/*
|
||||
* Stopgap fix for br916. We need to reject any attempt to pass a thread
|
||||
* variable to $strobe or $monitor. To do this, we use some private VPI
|
||||
* properties that are normally only used by the VVP thread cleanup code.
|
||||
* Normally the following definitions are provided by vvp/vpi_priv.h, but
|
||||
* for the stopgap fix we need to make them more widely available.
|
||||
*/
|
||||
#define BR916_STOPGAP_FIX
|
||||
#ifdef BR916_STOPGAP_FIX
|
||||
#define _vpiFromThr 0x1000001
|
||||
# define _vpiNoThr 0
|
||||
# define _vpiString 1
|
||||
# define _vpiVThr 2
|
||||
# define _vpiWord 3
|
||||
# define _vpi_at_PV 4
|
||||
# define _vpi_at_A 5
|
||||
# define _vpi_at_APV 6
|
||||
#endif
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -618,7 +618,7 @@ static int vpi_array_var_word_get(int code, vpiHandle ref)
|
|||
case vpiAutomatic:
|
||||
return (int) parent->scope->is_automatic;
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
|
||||
case _vpiFromThr:
|
||||
return _vpiNoThr;
|
||||
#endif
|
||||
|
|
@ -768,7 +768,7 @@ static int vpi_array_vthr_A_get(int code, vpiHandle ref)
|
|||
case vpiAutomatic:
|
||||
return (int) parent->scope->is_automatic;
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
|
||||
case _vpiFromThr:
|
||||
return _vpi_at_A;
|
||||
#endif
|
||||
|
|
@ -936,7 +936,7 @@ static int vpi_array_vthr_APV_get(int code, vpiHandle ref)
|
|||
case vpiAutomatic:
|
||||
return (int) parent->scope->is_automatic;
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
|
||||
case _vpiFromThr:
|
||||
return _vpi_at_APV;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ int __vpiStringConst::vpi_get(int code)
|
|||
case vpiAutomatic:
|
||||
return 0;
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
|
||||
case _vpiFromThr:
|
||||
return _vpiNoThr;
|
||||
#endif
|
||||
|
|
@ -356,7 +356,7 @@ int __vpiBinaryConst::vpi_get(int code)
|
|||
case vpiAutomatic:
|
||||
return 0;
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
|
||||
case _vpiFromThr:
|
||||
return _vpiNoThr;
|
||||
#endif
|
||||
|
|
@ -555,7 +555,7 @@ int __vpiDecConst::vpi_get(int code)
|
|||
case vpiAutomatic:
|
||||
return 0;
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
|
||||
case _vpiFromThr:
|
||||
return _vpiNoThr;
|
||||
#endif
|
||||
|
|
@ -643,7 +643,7 @@ int __vpiRealConst::vpi_get(int code)
|
|||
case vpiAutomatic:
|
||||
return 0;
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
|
||||
case _vpiFromThr:
|
||||
return _vpiNoThr;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ extern vpiHandle vpip_build_file_line(char*description,
|
|||
/*
|
||||
* Private VPI properties that are only used in the cleanup code.
|
||||
*/
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) && !defined(BR916_STOPGAP_FIX)
|
||||
#define _vpiFromThr 0x1000001
|
||||
# define _vpiNoThr 0
|
||||
# define _vpiString 1
|
||||
|
|
|
|||
|
|
@ -570,6 +570,11 @@ static int signal_get(int code, vpiHandle ref)
|
|||
case vpiAutomatic:
|
||||
return (int) vpip_scope(rfp)->is_automatic;
|
||||
|
||||
#ifdef BR916_STOPGAP_FIX
|
||||
case _vpiFromThr:
|
||||
return _vpiNoThr;
|
||||
#endif
|
||||
|
||||
// This private property must return zero when undefined.
|
||||
case _vpiNexusId:
|
||||
if (rfp->msb == rfp->lsb)
|
||||
|
|
@ -1196,7 +1201,7 @@ static int PV_get(int code, vpiHandle ref)
|
|||
case vpiAutomatic:
|
||||
return vpi_get(vpiAutomatic, rfp->parent);
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
|
||||
case _vpiFromThr:
|
||||
return _vpi_at_PV;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ static int vthr_vec_get(int code, vpiHandle ref)
|
|||
case vpiSize:
|
||||
return rfp->wid;
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
|
||||
case _vpiFromThr:
|
||||
return _vpiVThr;
|
||||
#endif
|
||||
|
|
@ -508,7 +508,7 @@ static int vthr_word_get(int code, vpiHandle ref)
|
|||
case vpiConstType:
|
||||
return rfp->subtype;
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
|
||||
case _vpiFromThr:
|
||||
return _vpiWord;
|
||||
#endif
|
||||
|
|
@ -660,7 +660,7 @@ int __vpiVThrStrStack::vpi_get(int code)
|
|||
switch (code) {
|
||||
case vpiConstType:
|
||||
return vpiStringConst;
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
|
||||
case _vpiFromThr:
|
||||
return _vpiString;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue