diff --git a/vpi/sys_display.c b/vpi/sys_display.c index 5ed2000ac..bebd2c235 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -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; diff --git a/vpi_user.h b/vpi_user.h index b767c9efd..dc601509a 100644 --- a/vpi_user.h +++ b/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 diff --git a/vvp/array.cc b/vvp/array.cc index 430c96e78..a798c920d 100644 --- a/vvp/array.cc +++ b/vvp/array.cc @@ -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 diff --git a/vvp/vpi_const.cc b/vvp/vpi_const.cc index 5e90851a5..8406fade9 100644 --- a/vvp/vpi_const.cc +++ b/vvp/vpi_const.cc @@ -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 diff --git a/vvp/vpi_priv.h b/vvp/vpi_priv.h index 69ce30444..a547e71c3 100644 --- a/vvp/vpi_priv.h +++ b/vvp/vpi_priv.h @@ -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 diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index eb8903d8c..86fb6eba5 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -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 diff --git a/vvp/vpi_vthr_vector.cc b/vvp/vpi_vthr_vector.cc index 335510e5e..f44a4dbc4 100644 --- a/vvp/vpi_vthr_vector.cc +++ b/vvp/vpi_vthr_vector.cc @@ -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