Add vpi_put_userdata
This commit is contained in:
parent
e6eae5fd15
commit
6416f8b90e
12
vpi_user.h
12
vpi_user.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpi_user.h,v 1.15 2002/08/12 01:35:01 steve Exp $"
|
||||
#ident "$Id: vpi_user.h,v 1.16 2003/01/09 04:10:17 steve Exp $"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -323,6 +323,13 @@ extern vpiHandle vpi_put_value(vpiHandle obj, p_vpi_value value,
|
|||
extern int vpi_free_object(vpiHandle ref);
|
||||
extern int vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p);
|
||||
|
||||
/*
|
||||
* These functions support attaching user data to an instance of a
|
||||
* system task or function. These functions only apply to
|
||||
* vpiSysTaskCall or vpiSysFuncCall handles.
|
||||
*/
|
||||
extern int vpi_put_userdata(vpiHandle obj, void*data);
|
||||
extern void*vpi_get_userdata(vpiHandle obj);
|
||||
|
||||
/*
|
||||
* Support for handling errors.
|
||||
|
|
@ -359,6 +366,9 @@ EXTERN_C_END
|
|||
|
||||
/*
|
||||
* $Log: vpi_user.h,v $
|
||||
* Revision 1.16 2003/01/09 04:10:17 steve
|
||||
* Add vpi_put_userdata
|
||||
*
|
||||
* Revision 1.15 2002/08/12 01:35:01 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
|
|
|||
15
vpithunk.c
15
vpithunk.c
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpithunk.c,v 1.7 2002/12/11 23:55:22 steve Exp $"
|
||||
#ident "$Id: vpithunk.c,v 1.8 2003/01/09 04:10:17 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -235,8 +235,21 @@ extern int vpi_chk_error(p_vpi_error_info info)
|
|||
VPIT_CALL(vpi_chk_error, 0, (info));
|
||||
}
|
||||
|
||||
extern void* vpi_get_userdata(vpiHandle obj)
|
||||
{
|
||||
VPIT_CALL(vpi_get_userdata, 0, (obj));
|
||||
}
|
||||
|
||||
extern int vpi_put_userdata(vpiHandle obj, void*data)
|
||||
{
|
||||
VPIT_CALL(vpi_put_userdata, 0, (obj, data));
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: vpithunk.c,v $
|
||||
* Revision 1.8 2003/01/09 04:10:17 steve
|
||||
* Add vpi_put_userdata
|
||||
*
|
||||
* Revision 1.7 2002/12/11 23:55:22 steve
|
||||
* Add vpi_handle_by_name to the VPI interface,
|
||||
* and bump the vpithunk magic number.
|
||||
|
|
|
|||
16
vpithunk.h
16
vpithunk.h
|
|
@ -2,7 +2,7 @@
|
|||
#define _VPI_THUNK_H_ 1
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2002 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2003 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
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpithunk.h,v 1.5 2002/12/11 23:55:22 steve Exp $"
|
||||
#ident "$Id: vpithunk.h,v 1.6 2003/01/09 04:10:17 steve Exp $"
|
||||
#endif
|
||||
|
||||
/* These functions are actually defined in lieu of the vpi functions
|
||||
|
|
@ -70,6 +70,15 @@ typedef struct {
|
|||
int (*vpi_get_vlog_info)(p_vpi_vlog_info vlog_info_p);
|
||||
int (*vpi_chk_error)(p_vpi_error_info info);
|
||||
vpiHandle (*vpi_handle_by_name)(char *name, vpiHandle scope);
|
||||
|
||||
int (*vpi_put_userdata)(vpiHandle obj, void*data);
|
||||
void* (*vpi_get_userdata)(vpiHandle obj);
|
||||
|
||||
void*pad3;
|
||||
void*pad2;
|
||||
void*pad1;
|
||||
void*pad0;
|
||||
|
||||
} vpi_thunk, *p_vpi_thunk;
|
||||
|
||||
DLLEXPORT int vpi_register_sim(p_vpi_thunk tp);
|
||||
|
|
@ -78,6 +87,9 @@ DLLEXPORT int vpi_register_sim(p_vpi_thunk tp);
|
|||
|
||||
/*
|
||||
* $Log: vpithunk.h,v $
|
||||
* Revision 1.6 2003/01/09 04:10:17 steve
|
||||
* Add vpi_put_userdata
|
||||
*
|
||||
* Revision 1.5 2002/12/11 23:55:22 steve
|
||||
* Add vpi_handle_by_name to the VPI interface,
|
||||
* and bump the vpithunk magic number.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpi_priv.h,v 1.41 2002/12/21 00:55:58 steve Exp $"
|
||||
#ident "$Id: vpi_priv.h,v 1.42 2003/01/09 04:09:44 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_user.h"
|
||||
|
|
@ -240,7 +240,8 @@ struct __vpiSysTaskCall {
|
|||
struct __vpiUserSystf*defn;
|
||||
unsigned nargs;
|
||||
vpiHandle*args;
|
||||
|
||||
/* Support for vpi_get_userdata. */
|
||||
void*userdata;
|
||||
/* These represent where in the vthread to put the return value. */
|
||||
unsigned short vbit, vwid;
|
||||
};
|
||||
|
|
@ -384,6 +385,9 @@ extern char *need_result_buf(unsigned cnt, vpi_rbuf_t type);
|
|||
|
||||
/*
|
||||
* $Log: vpi_priv.h,v $
|
||||
* Revision 1.42 2003/01/09 04:09:44 steve
|
||||
* Add vpi_put_userdata
|
||||
*
|
||||
* Revision 1.41 2002/12/21 00:55:58 steve
|
||||
* The $time system task returns the integer time
|
||||
* scaled to the local units. Change the internal
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpi_tasks.cc,v 1.17 2002/12/21 00:55:58 steve Exp $"
|
||||
#ident "$Id: vpi_tasks.cc,v 1.18 2003/01/09 04:09:44 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -276,6 +276,7 @@ vpiHandle vpip_build_vpi_call(const char*name, unsigned vbit, unsigned vwid,
|
|||
obj->args = argv;
|
||||
obj->vbit = vbit;
|
||||
obj->vwid = vwid;
|
||||
obj->userdata = 0;
|
||||
|
||||
/* If there is a compiletf function, call it here. */
|
||||
if (obj->defn->info.compiletf) {
|
||||
|
|
@ -342,8 +343,31 @@ void vpi_register_systf(const struct t_vpi_systf_data*ss)
|
|||
cur->info.tfname = strdup(ss->tfname);
|
||||
}
|
||||
|
||||
int vpi_put_userdata(vpiHandle ref, void*data)
|
||||
{
|
||||
struct __vpiSysTaskCall*rfp = (struct __vpiSysTaskCall*)ref;
|
||||
assert((ref->vpi_type->type_code == vpiSysTaskCall)
|
||||
|| (ref->vpi_type->type_code == vpiSysFuncCall));
|
||||
|
||||
rfp->userdata = data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* vpi_get_userdata(vpiHandle ref)
|
||||
{
|
||||
struct __vpiSysTaskCall*rfp = (struct __vpiSysTaskCall*)ref;
|
||||
assert((ref->vpi_type->type_code == vpiSysTaskCall)
|
||||
|| (ref->vpi_type->type_code == vpiSysFuncCall));
|
||||
|
||||
return rfp->userdata;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: vpi_tasks.cc,v $
|
||||
* Revision 1.18 2003/01/09 04:09:44 steve
|
||||
* Add vpi_put_userdata
|
||||
*
|
||||
* Revision 1.17 2002/12/21 00:55:58 steve
|
||||
* The $time system task returns the integer time
|
||||
* scaled to the local units. Change the internal
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vvp_vpi.cc,v 1.6 2002/12/11 23:55:22 steve Exp $"
|
||||
#ident "$Id: vvp_vpi.cc,v 1.7 2003/01/09 04:09:44 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
|
@ -36,10 +36,15 @@ void vvp_vpi_init()
|
|||
vvpt.vpi_free_object= vpi_free_object;
|
||||
vvpt.vpi_get_vlog_info = vpi_get_vlog_info;
|
||||
vvpt.vpi_chk_error = vpi_chk_error;
|
||||
vvpt.vpi_get_userdata = vpi_get_userdata;
|
||||
vvpt.vpi_put_userdata = vpi_put_userdata;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: vvp_vpi.cc,v $
|
||||
* Revision 1.7 2003/01/09 04:09:44 steve
|
||||
* Add vpi_put_userdata
|
||||
*
|
||||
* Revision 1.6 2002/12/11 23:55:22 steve
|
||||
* Add vpi_handle_by_name to the VPI interface,
|
||||
* and bump the vpithunk magic number.
|
||||
|
|
|
|||
Loading…
Reference in New Issue