Add vpi_chk_error and vpi_control functions.
This commit is contained in:
parent
2fcfe9f2c3
commit
57aee7ca26
38
vpi_user.h
38
vpi_user.h
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -278,12 +278,15 @@ extern int vpi_remove_cb(vpiHandle ref);
|
||||||
* vpiReset -
|
* vpiReset -
|
||||||
* vpiSetInteractiveScope -
|
* vpiSetInteractiveScope -
|
||||||
*/
|
*/
|
||||||
extern void vpi_sim_control(int operation, ...);
|
extern void vpi_control(int operation, ...);
|
||||||
#define vpiStop 1
|
#define vpiStop 1
|
||||||
#define vpiFinish 2
|
#define vpiFinish 2
|
||||||
#define vpiReset 3
|
#define vpiReset 3
|
||||||
#define vpiSetInteractiveScope 4
|
#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_handle(int type, vpiHandle ref);
|
||||||
extern vpiHandle vpi_iterate(int type, vpiHandle ref);
|
extern vpiHandle vpi_iterate(int type, vpiHandle ref);
|
||||||
extern vpiHandle vpi_scan(vpiHandle iter);
|
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);
|
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. */
|
/* This is the table of startup routines included in each module. */
|
||||||
extern DLLEXPORT void (*vlog_startup_routines[])();
|
extern DLLEXPORT void (*vlog_startup_routines[])();
|
||||||
|
|
||||||
|
|
@ -328,6 +359,9 @@ EXTERN_C_END
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vpi_user.h,v $
|
* $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
|
* Revision 1.13 2002/07/17 05:13:43 steve
|
||||||
* Implementation of vpi_handle_by_name, and
|
* Implementation of vpi_handle_by_name, and
|
||||||
* add the vpiVariables iterator.
|
* add the vpiVariables iterator.
|
||||||
|
|
|
||||||
13
vpithunk.c
13
vpithunk.c
|
|
@ -138,6 +138,14 @@ extern void vpi_sim_control(int operation, ...)
|
||||||
va_end(ap); /* bad - never hit */
|
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)
|
extern vpiHandle vpi_handle(int type, vpiHandle ref)
|
||||||
{
|
{
|
||||||
VPIT_CALL(vpi_handle, 0, (type, 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));
|
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));
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ typedef struct {
|
||||||
p_vpi_time when, int flags);
|
p_vpi_time when, int flags);
|
||||||
int (*vpi_free_object)(vpiHandle ref);
|
int (*vpi_free_object)(vpiHandle ref);
|
||||||
int (*vpi_get_vlog_info)(p_vpi_vlog_info vlog_info_p);
|
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;
|
} vpi_thunk, *p_vpi_thunk;
|
||||||
|
|
||||||
DLLEXPORT int vpi_register_sim(p_vpi_thunk tp);
|
DLLEXPORT int vpi_register_sim(p_vpi_thunk tp);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#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
|
#endif
|
||||||
|
|
||||||
# include "vpi_priv.h"
|
# include "vpi_priv.h"
|
||||||
|
|
@ -33,6 +33,9 @@
|
||||||
|
|
||||||
vpi_mode_t vpi_mode_flag = VPI_MODE_NONE;
|
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
|
* The vpip_string function creates a constant string from the pass
|
||||||
* input. This constant string is permanently allocate from an
|
* input. This constant string is permanently allocate from an
|
||||||
|
|
@ -66,6 +69,22 @@ const char *vpip_string(const char*str)
|
||||||
return res;
|
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
|
* When a task is called, this value is set so that vpi_handle can
|
||||||
* fathom the vpi_handle(vpiSysTfCall,0) function.
|
* 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();
|
vp->low = schedule_simtime();
|
||||||
}
|
}
|
||||||
|
|
||||||
static s_vpi_vlog_info vpi_vlog_info;
|
|
||||||
|
|
||||||
int vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p)
|
int vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p)
|
||||||
{
|
{
|
||||||
if (vlog_info_p != 0) {
|
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 $
|
* $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
|
* Revision 1.21 2002/07/19 01:12:50 steve
|
||||||
* vpi_iterate returns 0 on error.
|
* vpi_iterate returns 0 on error.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,5 @@ void vvp_vpi_init()
|
||||||
vvpt.vpi_put_value = vpi_put_value;
|
vvpt.vpi_put_value = vpi_put_value;
|
||||||
vvpt.vpi_free_object= vpi_free_object;
|
vvpt.vpi_free_object= vpi_free_object;
|
||||||
vvpt.vpi_get_vlog_info = vpi_get_vlog_info;
|
vvpt.vpi_get_vlog_info = vpi_get_vlog_info;
|
||||||
|
vvpt.vpi_chk_error = vpi_chk_error;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue