From 07b7bf3084755d94b260133fd2b3a157c1fd0567 Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 12 Apr 2003 18:57:13 +0000 Subject: [PATCH] More acc_ function stubs. --- acc_user.h | 33 ++++++++++++- libveriuser/Makefile.in | 8 +-- libveriuser/a_fetch_type.c | 18 ++++++- libveriuser/a_fetch_type_str.c | 8 ++- libveriuser/a_fetch_value.c | 89 ++++++++++++++++++++++++++++++++++ libveriuser/a_vcl.c | 46 ++++++++++++++++++ libveriuser/getsimtime.c | 13 ++++- veriuser.h | 7 ++- 8 files changed, 212 insertions(+), 10 deletions(-) create mode 100644 libveriuser/a_fetch_value.c create mode 100644 libveriuser/a_vcl.c diff --git a/acc_user.h b/acc_user.h index 10312cd5e..6806911ca 100644 --- a/acc_user.h +++ b/acc_user.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: acc_user.h,v 1.8 2003/03/13 04:35:09 steve Exp $" +#ident "$Id: acc_user.h,v 1.9 2003/04/12 18:57:13 steve Exp $" #endif /* @@ -114,6 +114,25 @@ typedef struct t_setval_value { } value; } s_setval_value, *p_setval_value, s_acc_value, *p_acc_value; +typedef struct t_strengths { + PLI_UBYTE8 logic_value; + PLI_UBYTE8 strength1; + PLI_UBYTE8 strength2; +} s_strengths, *p_strengths; + +typedef struct t_vc_record { + PLI_INT32 vc_reason; + PLI_INT32 vc_hightime; + PLI_INT32 vc_lowtime; + void* user_data; + union { + PLI_UBYTE8 logic_value; + double real_value; + handle vector_handle; + s_strengths strengths_s; + } out_value; +} s_vc_record, *p_vc_record; + typedef struct t_location { PLI_INT32 line_no; const char*filename; @@ -152,9 +171,13 @@ typedef struct t_timescale_info { } s_timescale_info, *p_timescale_info; extern void acc_fetch_timescale_info(handle obj, p_timescale_info info); +extern PLI_INT32 acc_fetch_size(handle obj); + extern PLI_INT32 acc_fetch_type(handle obj); extern char* acc_fetch_type_str(PLI_INT32 type); +extern char* acc_fetch_value(handle obj, const char*fmt, s_acc_value*value); + extern handle acc_handle_object(const char*name); extern handle acc_handle_parent(handle obj); @@ -171,12 +194,20 @@ extern char*acc_product_version(void); extern int acc_set_value(handle obj, p_setval_value value, p_setval_delay delay); +extern void acc_vcl_add(handle obj, PLI_INT32(*consumer)(p_vc_record), + void*data, PLI_INT32 vcl_flag); +extern void acc_vcl_delete(handle obj, PLI_INT32(*consumer)(p_vc_record), + void*data, PLI_INT32 vcl_flag); + extern char* acc_version(void); EXTERN_C_END /* * $Log: acc_user.h,v $ + * Revision 1.9 2003/04/12 18:57:13 steve + * More acc_ function stubs. + * * Revision 1.8 2003/03/13 04:35:09 steve * Add a bunch of new acc_ and tf_ functions. * diff --git a/libveriuser/Makefile.in b/libveriuser/Makefile.in index 234335cb8..0aa7eab5a 100644 --- a/libveriuser/Makefile.in +++ b/libveriuser/Makefile.in @@ -16,7 +16,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.19 2003/03/13 04:35:09 steve Exp $" +#ident "$Id: Makefile.in,v 1.20 2003/04/12 18:57:14 steve Exp $" # # SHELL = /bin/sh @@ -47,10 +47,10 @@ RANLIB = @RANLIB@ A = a_close.o a_configure.o a_fetch_argc.o a_fetch_argv.o a_fetch_fullname.o \ a_fetch_location.o a_fetch_param.o a_fetch_tfarg.o a_fetch_time.o \ -a_fetch_type.o \ -a_fetch_type_str.o a_handle_object.o a_handle_parent.o a_handle_tfarg.o \ +a_fetch_type.o a_fetch_type_str.o a_fetch_value.o \ +a_handle_object.o a_handle_parent.o a_handle_tfarg.o \ a_initialize.o a_next_topmod.o a_object_of_type.o a_product_version.o \ -a_set_value.o a_version.o +a_set_value.o a_vcl.o a_version.o O = asynch.o finish.o getcstringp.o getinstance.o getlongp.o \ getp.o getsimtime.o io_print.o mc_scan_plusargs.o nump.o putlongp.o \ putp.o spname.o typep.o workarea.o veriusertfs.o priv.o $A diff --git a/libveriuser/a_fetch_type.c b/libveriuser/a_fetch_type.c index 483196e6f..6b73829a6 100644 --- a/libveriuser/a_fetch_type.c +++ b/libveriuser/a_fetch_type.c @@ -17,19 +17,30 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: a_fetch_type.c,v 1.2 2003/03/13 04:35:09 steve Exp $" +#ident "$Id: a_fetch_type.c,v 1.3 2003/04/12 18:57:14 steve Exp $" #endif # include # include # include +PLI_INT32 acc_fetch_size(handle obj) +{ + return vpi_get(vpiSize, obj); +} + PLI_INT32 acc_fetch_type(handle obj) { switch (vpi_get(vpiType, obj)) { case vpiConstant: - return accConstant; + /*XXXX SWIFT PLI tasks seem to assume that string + constants show up an accParameter, instead of + accConstant. */ + if (vpi_get(vpiConstType, obj) == vpiStringConst) + return accParameter; + else + return accConstant; case vpiNet: return accNet; @@ -51,6 +62,9 @@ PLI_INT32 acc_fetch_type(handle obj) /* * $Log: a_fetch_type.c,v $ + * Revision 1.3 2003/04/12 18:57:14 steve + * More acc_ function stubs. + * * Revision 1.2 2003/03/13 04:35:09 steve * Add a bunch of new acc_ and tf_ functions. * diff --git a/libveriuser/a_fetch_type_str.c b/libveriuser/a_fetch_type_str.c index e63774fc0..1cad80e9a 100644 --- a/libveriuser/a_fetch_type_str.c +++ b/libveriuser/a_fetch_type_str.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: a_fetch_type_str.c,v 1.4 2003/03/13 05:07:46 steve Exp $" +#ident "$Id: a_fetch_type_str.c,v 1.5 2003/04/12 18:57:14 steve Exp $" #endif #include @@ -28,6 +28,9 @@ char* acc_fetch_type_str(PLI_INT32 type) { switch (type) { + case accNet: + return "accNet"; + case accReg: return "accReg"; @@ -47,6 +50,9 @@ char* acc_fetch_type_str(PLI_INT32 type) /* * $Log: a_fetch_type_str.c,v $ + * Revision 1.5 2003/04/12 18:57:14 steve + * More acc_ function stubs. + * * Revision 1.4 2003/03/13 05:07:46 steve * Declaration warnings. * diff --git a/libveriuser/a_fetch_value.c b/libveriuser/a_fetch_value.c new file mode 100644 index 000000000..52b91c4dd --- /dev/null +++ b/libveriuser/a_fetch_value.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 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 + * General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#ifdef HAVE_CVS_IDENT +#ident "$Id: a_fetch_value.c,v 1.1 2003/04/12 18:57:14 steve Exp $" +#endif + +# include +# include +# include "priv.h" +# include + +static char* fetch_struct_value(handle obj, s_acc_value*value) +{ + struct t_vpi_value val; + + switch (value->format) { + + case accScalarVal: + val.format = vpiScalarVal; + vpi_get_value(obj, &val); + value->value.scalar = val.value.scalar; + break; + + case accIntVal: + val.format = vpiIntVal; + vpi_get_value(obj, &val); + value->value.integer = val.value.integer; + break; + + case accRealVal: + val.format = vpiRealVal; + vpi_get_value(obj, &val); + value->value.real = val.value.real; + break; + + default: + vpi_printf("XXXX acc_fetch_value(..., \"%%%%\", <%d>);\n", + value->format); + value->value.str = ""; + break; + } + + return 0; +} + +static char* fetch_strength_value(handle obj) +{ + struct t_vpi_value val; + + val.format = vpiStrengthVal; + vpi_get_value(obj, &val); + + vpi_printf("XXXX acc_fetch_value(..., \"%%v\")\n"); + return __acc_newstring("StX"); +} + +char* acc_fetch_value(handle obj, const char*fmt, s_acc_value*value) +{ + if (strcmp(fmt, "%%") == 0) + return fetch_struct_value(obj, value); + + vpi_printf("XXXX acc_fetch_value(..., \"%s\", ...)\n", fmt); + return ""; +} + + +/* + * $Log: a_fetch_value.c,v $ + * Revision 1.1 2003/04/12 18:57:14 steve + * More acc_ function stubs. + * + */ + diff --git a/libveriuser/a_vcl.c b/libveriuser/a_vcl.c new file mode 100644 index 000000000..378d6c141 --- /dev/null +++ b/libveriuser/a_vcl.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 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 + * General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#ifdef HAVE_CVS_IDENT +#ident "$Id: a_vcl.c,v 1.1 2003/04/12 18:57:14 steve Exp $" +#endif + +#include +#include +#include "priv.h" + +void acc_vcl_add(handle obj, PLI_INT32(*consumer)(p_vc_record), + void*data, PLI_INT32 vcl_flag) +{ + vpi_printf("XXXX Call acc_vcl_add\n"); +} + +void acc_vcl_delete(handle obj, PLI_INT32(*consumer)(p_vc_record), + void*data, PLI_INT32 vcl_flag) +{ + vpi_printf("XXXX Call acc_vcl_delete\n"); +} + + +/* + * $Log: a_vcl.c,v $ + * Revision 1.1 2003/04/12 18:57:14 steve + * More acc_ function stubs. + * + */ + diff --git a/libveriuser/getsimtime.c b/libveriuser/getsimtime.c index 7d2c2cbaf..6201c210d 100644 --- a/libveriuser/getsimtime.c +++ b/libveriuser/getsimtime.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: getsimtime.c,v 1.4 2003/03/13 04:35:09 steve Exp $" +#ident "$Id: getsimtime.c,v 1.5 2003/04/12 18:57:14 steve Exp $" #endif #include @@ -44,8 +44,19 @@ PLI_INT32 tf_igettimeprecision(void*obj) return vpi_get(vpiTimePrecision, 0); } +PLI_INT32 tf_gettime(void) +{ + s_vpi_time time; + time.type = vpiSimTime; + vpi_get_time (0 /* NULL */, &time); + return time.low; +} + /* * $Log: getsimtime.c,v $ + * Revision 1.5 2003/04/12 18:57:14 steve + * More acc_ function stubs. + * * Revision 1.4 2003/03/13 04:35:09 steve * Add a bunch of new acc_ and tf_ functions. * diff --git a/veriuser.h b/veriuser.h index 030358aaa..1976f3c63 100644 --- a/veriuser.h +++ b/veriuser.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: veriuser.h,v 1.22 2003/03/13 04:35:09 steve Exp $" +#ident "$Id: veriuser.h,v 1.23 2003/04/12 18:57:13 steve Exp $" #endif /* @@ -251,6 +251,8 @@ extern int tf_getlongtime(int*high_bits); extern int tf_getp(int pnum); +extern PLI_INT32 tf_gettime(void); + extern PLI_INT32 tf_gettimeprecision(void); extern PLI_INT32 tf_igettimeprecision(void*); @@ -288,6 +290,9 @@ EXTERN_C_END /* * $Log: veriuser.h,v $ + * Revision 1.23 2003/04/12 18:57:13 steve + * More acc_ function stubs. + * * Revision 1.22 2003/03/13 04:35:09 steve * Add a bunch of new acc_ and tf_ functions. *