diff --git a/vpi_user.h b/vpi_user.h index 92a89f339..744a19a78 100644 --- a/vpi_user.h +++ b/vpi_user.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_user.h,v 1.13 2002/07/17 05:13:43 steve Exp $" +#ident "$Id: vpi_user.h,v 1.14 2002/07/19 01:57:26 steve Exp $" #endif @@ -278,12 +278,15 @@ extern int vpi_remove_cb(vpiHandle ref); * vpiReset - * vpiSetInteractiveScope - */ -extern void vpi_sim_control(int operation, ...); +extern void vpi_control(int operation, ...); #define vpiStop 1 #define vpiFinish 2 #define vpiReset 3 #define vpiSetInteractiveScope 4 +/* vpi_sim_control is the incorrect name for vpi_control. */ +extern void vpi_sim_control(int operation, ...); + extern vpiHandle vpi_handle(int type, vpiHandle ref); extern vpiHandle vpi_iterate(int type, vpiHandle ref); extern vpiHandle vpi_scan(vpiHandle iter); @@ -321,6 +324,34 @@ extern int vpi_free_object(vpiHandle ref); extern int vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p); +/* + * Support for handling errors. + */ +typedef struct t_vpi_error_info { + int state; + int level; + char*message; + char*product; + char*code; + char*file; + int line; +} s_vpi_error_info, *p_vpi_error_info; + +/* error_info states */ +# define vpiCompile 1 +# define vpiPLI 2 +# define vpiRun 3 + +/* error_info levels */ +# define vpiNotice 1 +# define vpiWarning 2 +# define vpiError 3 +# define vpiSystem 4 +# define vpiInternal 5 + +extern int vpi_chk_error(p_vpi_error_info info); + + /* This is the table of startup routines included in each module. */ extern DLLEXPORT void (*vlog_startup_routines[])(); @@ -328,6 +359,9 @@ EXTERN_C_END /* * $Log: vpi_user.h,v $ + * Revision 1.14 2002/07/19 01:57:26 steve + * Add vpi_chk_error and vpi_control functions. + * * Revision 1.13 2002/07/17 05:13:43 steve * Implementation of vpi_handle_by_name, and * add the vpiVariables iterator. diff --git a/vpithunk.c b/vpithunk.c index ed90d7a04..a9ab292fc 100644 --- a/vpithunk.c +++ b/vpithunk.c @@ -138,6 +138,14 @@ extern void vpi_sim_control(int operation, ...) va_end(ap); /* bad - never hit */ } +extern void vpi_control(int operation, ...) +{ + va_list ap; + va_start(ap, operation); + VPITV_CALL(vpi_sim_vcontrol,(operation,ap)); + va_end(ap); /* bad - never hit */ +} + extern vpiHandle vpi_handle(int type, vpiHandle ref) { VPIT_CALL(vpi_handle, 0, (type, ref)); @@ -194,3 +202,8 @@ extern int vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p) { VPIT_CALL(vpi_get_vlog_info, 0, (vlog_info_p)); } + +extern int vpi_chk_error(p_vpi_error_info info) +{ + VPIT_CALL(vpi_chk_error, 0, (info)); +} diff --git a/vpithunk.h b/vpithunk.h index 163f5291a..d4f8cb60f 100644 --- a/vpithunk.h +++ b/vpithunk.h @@ -44,6 +44,7 @@ typedef struct { p_vpi_time when, int flags); int (*vpi_free_object)(vpiHandle ref); int (*vpi_get_vlog_info)(p_vpi_vlog_info vlog_info_p); + int (*vpi_chk_error)(p_vpi_error_info info); } vpi_thunk, *p_vpi_thunk; DLLEXPORT int vpi_register_sim(p_vpi_thunk tp); diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index a3888886c..e09e48af7 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vpi_priv.cc,v 1.21 2002/07/19 01:12:50 steve Exp $" +#ident "$Id: vpi_priv.cc,v 1.22 2002/07/19 01:57:26 steve Exp $" #endif # include "vpi_priv.h" @@ -33,6 +33,9 @@ vpi_mode_t vpi_mode_flag = VPI_MODE_NONE; +static s_vpi_vlog_info vpi_vlog_info; +static s_vpi_error_info vpip_last_error = { 0, 0, 0, 0, 0, 0, 0 }; + /* * The vpip_string function creates a constant string from the pass * input. This constant string is permanently allocate from an @@ -66,6 +69,22 @@ const char *vpip_string(const char*str) return res; } +int vpi_chk_error(p_vpi_error_info info) +{ + if (vpip_last_error.state = 0) + return 0; + + info->state = vpip_last_error.state; + info->level = vpip_last_error.level; + info->message = vpip_last_error.message; + info->product = vpi_vlog_info.product; + info->code = ""; + info->file = 0; + info->line = 0; + + return info->level; +} + /* * When a task is called, this value is set so that vpi_handle can * fathom the vpi_handle(vpiSysTfCall,0) function. @@ -131,8 +150,6 @@ void vpi_get_time(vpiHandle obj, s_vpi_time*vp) vp->low = schedule_simtime(); } -static s_vpi_vlog_info vpi_vlog_info; - int vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p) { if (vlog_info_p != 0) { @@ -346,6 +363,9 @@ extern "C" void vpi_sim_vcontrol(int operation, va_list ap) /* * $Log: vpi_priv.cc,v $ + * Revision 1.22 2002/07/19 01:57:26 steve + * Add vpi_chk_error and vpi_control functions. + * * Revision 1.21 2002/07/19 01:12:50 steve * vpi_iterate returns 0 on error. * diff --git a/vvp/vvp_vpi.cc b/vvp/vvp_vpi.cc index a64f8396d..2388a3f4c 100644 --- a/vvp/vvp_vpi.cc +++ b/vvp/vvp_vpi.cc @@ -30,4 +30,5 @@ void vvp_vpi_init() vvpt.vpi_put_value = vpi_put_value; vvpt.vpi_free_object= vpi_free_object; vvpt.vpi_get_vlog_info = vpi_get_vlog_info; + vvpt.vpi_chk_error = vpi_chk_error; }