diff --git a/vpi/vpi_user.h b/vpi/vpi_user.h index 12cfd38d6..9f02f1290 100644 --- a/vpi/vpi_user.h +++ b/vpi/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.19 2000/07/26 03:53:12 steve Exp $" +#ident "$Id: vpi_user.h,v 1.20 2000/08/08 01:47:52 steve Exp $" #endif #ifdef __cplusplus @@ -47,6 +47,14 @@ typedef struct t_vpi_systf_data { #define vpiSysTask 1 #define vpiSysFunc 2 +typedef struct t_vpi_vlog_info +{ + int argc; + char **argv; + char *product; + char *version; +} s_vpi_vlog_info, *p_vpi_vlog_info; + typedef struct t_vpi_time { int type; @@ -237,6 +245,7 @@ extern vpiHandle vpi_put_value(vpiHandle obj, p_vpi_value value, p_vpi_time when, int flags); extern int vpi_free_object(vpiHandle ref); +extern int vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p); /* This is the table of startup routines included in each module. */ @@ -248,6 +257,9 @@ extern void (*vlog_startup_routines[])(); /* * $Log: vpi_user.h,v $ + * Revision 1.20 2000/08/08 01:47:52 steve + * Add vpi_vlog_info support from Adrian + * * Revision 1.19 2000/07/26 03:53:12 steve * Make simulation precision available to VPI. * diff --git a/vvm/Makefile.in b/vvm/Makefile.in index 188eaa2e8..39a97fce4 100644 --- a/vvm/Makefile.in +++ b/vvm/Makefile.in @@ -18,7 +18,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.31 2000/05/19 04:22:55 steve Exp $" +#ident "$Id: Makefile.in,v 1.32 2000/08/08 01:47:40 steve Exp $" # # SHELL = /bin/sh @@ -66,7 +66,7 @@ vvm_nexus.o vvm_pevent.o vvm_signal.o vvm_thread.o vvm_udp.o vpip.o P = vpi_bit.o vpi_callback.o \ vpi_const.o vpi_iter.o vpi_memory.o vpi_null.o \ vpi_priv.o vpi_scope.o vpi_signal.o vpi_simulation.o vpi_systask.o vpi_time.o \ -vpi_mcd.o +vpi_mcd.o vpi_vlog_info.o libvvm.a: $O rm -f $@ diff --git a/vvm/vpi_const.c b/vvm/vpi_const.c index 5e4bf19c0..09ec3d78a 100644 --- a/vvm/vpi_const.c +++ b/vvm/vpi_const.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_const.c,v 1.10 2000/07/08 22:40:07 steve Exp $" +#ident "$Id: vpi_const.c,v 1.11 2000/08/08 01:47:40 steve Exp $" #endif # include "vpi_priv.h" @@ -33,12 +33,13 @@ void vpip_bits_get_value(vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) { static char buff[1024]; - char*cp; + static s_vpi_vecval vect[64]; + char* cp = buff; unsigned val; unsigned idx; int isx; - cp = buff; + vp->value.str = buff; switch (vp->format) { case vpiObjTypeVal: @@ -55,7 +56,6 @@ void vpip_bits_get_value(vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) } vp->format = vpiBinStrVal; *cp++ = 0; - vp->value.str = buff; break; case vpiDecStrVal: @@ -68,7 +68,6 @@ void vpip_bits_get_value(vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) sprintf(cp, "%u", val); cp += strlen(cp); *cp++ = 0; - vp->value.str = buff; break; case vpiOctStrVal: @@ -129,7 +128,6 @@ void vpip_bits_get_value(vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) *cp++ = "01234567"[v]; } *cp++ = 0; - vp->value.str = buff; break; case vpiHexStrVal: @@ -192,7 +190,6 @@ void vpip_bits_get_value(vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) *cp++ = "0123456789abcdef"[v]; } *cp++ = 0; - vp->value.str = buff; break; case vpiIntVal: @@ -211,14 +208,28 @@ void vpip_bits_get_value(vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) vp->value.integer = val; break; + case vpiVectorVal: + vp->value.vector = vect; + for (idx = 0 ; idx < nbits ; idx += 1) { + int major = idx/32; + int minor = idx%32; + + vect[major].aval &= (1<format = vpiStringVal; - vp->value.str = buff; - break; } } @@ -382,6 +393,9 @@ vpiHandle vpip_make_number_const(struct __vpiNumberConst*ref, /* * $Log: vpi_const.c,v $ + * Revision 1.11 2000/08/08 01:47:40 steve + * Add vpi_vlog_info support from Adrian + * * Revision 1.10 2000/07/08 22:40:07 steve * Allow set vpiIntVal on bitset type objects. * diff --git a/vvm/vpi_vlog_info.c b/vvm/vpi_vlog_info.c new file mode 100644 index 000000000..5f9e02b9a --- /dev/null +++ b/vvm/vpi_vlog_info.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2000 Adrian Lewis (indproj@yahoo.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 + */ +#if !defined(WINNT) && !defined(macintosh) +#ident "$Id: vpi_vlog_info.c,v 1.1 2000/08/08 01:47:40 steve Exp $" +#endif + +#include + +// STORAGE FOR COMMAND LINE ARGUMENTS + +static int vpip_argc; +static char** vpip_argv; + +// ROUTINE: vpi_get_vlog_info +// +// ARGUMENT: vlog_info_p +// Pointer to a structure containing simulation information. +// +// RETURNS: +// Boolean: true on success and false on failure. +// +// DESCRIPTION: +// Retrieve information about Verilog simulation execution. + +int +vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p) +{ + // AUTOMATICALLY UPDATING THE VERSION NUMBER WOULD BE A GOOD IDEA + + static char* version = "20000805"; + static char* product = "Icarus Verilog"; + + // CHECK THAT THE USER DIDN'T PASS A NULL POINTER + + if (vlog_info_p != 0) + { + // FILL IN INFORMATION FIELDS + + vlog_info_p->product = product; + vlog_info_p->version = version; + vlog_info_p->argc = vpip_argc; + vlog_info_p->argv = vpip_argv; + + return 1==1; + } + else + return 1==0; +} + +// ROUTINE: vpip_set_vlog_info +// +// ARGUMENTS: argc, argv +// Standard command line arguments. +// +// DESCRIPTION: +// Saves command line arguments to retrieval by vpi_get_vlog_info. + +void +vpip_set_vlog_info(int argc, char** argv) +{ + // SAVE COMMAND LINE ARGUMENTS IN STATIC VARIABLES + + vpip_argc = argc; + vpip_argv = argv; +}