Add at least minimal implementations for several
acc_ functions. Add support for standard ACC string handling. Add the _pli_types.h header file to carry the IEEE1364-2001 standard PLI type declarations.
This commit is contained in:
parent
ec48049a69
commit
d3de1d9c33
|
|
@ -16,7 +16,7 @@
|
|||
# 59 Temple Place - Suite 330
|
||||
# Boston, MA 02111-1307, USA
|
||||
#
|
||||
#ident "$Id: Makefile.in,v 1.144 2003/02/08 19:49:21 steve Exp $"
|
||||
#ident "$Id: Makefile.in,v 1.145 2003/02/17 06:39:47 steve Exp $"
|
||||
#
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
|
|
@ -212,7 +212,7 @@ else
|
|||
WIN32_INSTALL = $(bindir)/iverilog-vpi
|
||||
endif
|
||||
|
||||
install: all installdirs $(libdir)/ivl/ivl@EXEEXT@ $(libdir)/ivl/iverilog.conf $(includedir)/ivl_target.h $(includedir)/vpi_user.h $(includedir)/acc_user.h $(includedir)/veriuser.h $(WIN32_INSTALL) $(INSTALL_DOC)
|
||||
install: all installdirs $(libdir)/ivl/ivl@EXEEXT@ $(libdir)/ivl/iverilog.conf $(includedir)/ivl_target.h $(includedir)/_pli_types.h $(includedir)/vpi_user.h $(includedir)/acc_user.h $(includedir)/veriuser.h $(WIN32_INSTALL) $(INSTALL_DOC)
|
||||
cd vpi ; $(MAKE) install
|
||||
cd ivlpp ; $(MAKE) install
|
||||
cd driver ; $(MAKE) install
|
||||
|
|
@ -235,6 +235,9 @@ $(libdir)/ivl/iverilog.conf: $(libdir)/ivl/ivl@EXEEXT@
|
|||
$(includedir)/ivl_target.h: $(srcdir)/ivl_target.h
|
||||
$(INSTALL_DATA) $(srcdir)/ivl_target.h $(includedir)/ivl_target.h
|
||||
|
||||
$(includedir)/_pli_types.h: $(srcdir)/_pli_types.h
|
||||
$(INSTALL_DATA) $(srcdir)/_pli_types.h $(includedir)/_pli_types.h
|
||||
|
||||
$(includedir)/vpi_user.h: $(srcdir)/vpi_user.h
|
||||
$(INSTALL_DATA) $(srcdir)/vpi_user.h $(includedir)/vpi_user.h
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
#ifndef PLI_TYPES
|
||||
#define PLI_TYPES
|
||||
/*
|
||||
* 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: _pli_types.h,v 1.1 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
typedef signed int PLI_INT32;
|
||||
typedef unsigned int PLI_UINT32;
|
||||
typedef signed short PLI_INT16;
|
||||
typedef unsigned short PLI_UINT12;
|
||||
typedef signed char PLI_BYTE8;
|
||||
typedef unsigned char PLI_UBYTE8;
|
||||
|
||||
/*
|
||||
* $Log: _pli_types.h,v $
|
||||
* Revision 1.1 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
*/
|
||||
#endif
|
||||
44
acc_user.h
44
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.6 2002/08/12 01:34:58 steve Exp $"
|
||||
#ident "$Id: acc_user.h,v 1.7 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
* implemented using VPI routines.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define EXTERN_C_START extern "C" {
|
||||
# define EXTERN_C_END }
|
||||
|
|
@ -42,16 +43,24 @@
|
|||
|
||||
EXTERN_C_START
|
||||
|
||||
# include "_pli_types.h"
|
||||
|
||||
/*
|
||||
* This is a declaration of the "handle" type that is compatible with
|
||||
* the vpiHandle from vpi_user.h.
|
||||
* the vpiHandle from vpi_user.h. The libveriuser library implements
|
||||
* the acc handle type as a vpiHandle, to prevent useless indirection.
|
||||
*/
|
||||
typedef struct __vpiHandle *handle;
|
||||
|
||||
/* OBJECT TYPES */
|
||||
#define accModule 20
|
||||
#define accScope 21
|
||||
#define accNet 25
|
||||
#define accReg 30
|
||||
#define accParameter 220
|
||||
#define accScalar 300
|
||||
#define accVector 302
|
||||
#define accConstant 600
|
||||
|
||||
/* type VALUES FOR t_setval_delay STRUCTURE */
|
||||
#define accNoDelay 0
|
||||
|
|
@ -105,25 +114,46 @@ typedef struct t_setval_value {
|
|||
} value;
|
||||
} s_setval_value, *p_setval_value, s_acc_value, *p_acc_value;
|
||||
|
||||
typedef struct t_location {
|
||||
PLI_INT32 line_no;
|
||||
const char*filename;
|
||||
} s_location, *p_location;
|
||||
|
||||
extern int acc_error_flag;
|
||||
|
||||
extern int acc_initialize(void);
|
||||
|
||||
extern void acc_close(void);
|
||||
|
||||
/*
|
||||
* This is the acc_configure command, and the config_param
|
||||
* codes that are accepted.
|
||||
*/
|
||||
extern int acc_configure(PLI_INT32 config_param, const char*value);
|
||||
#define accDevelopmentVersion 11
|
||||
|
||||
extern int acc_fetch_argc(void);
|
||||
extern char**acc_fetch_argv(void);
|
||||
|
||||
extern char* acc_fetch_fullname(handle obj);
|
||||
|
||||
extern int acc_fetch_location(p_location loc, handle obj);
|
||||
|
||||
extern char* acc_fetch_name(handle obj);
|
||||
|
||||
extern int acc_fetch_tfarg_int(int n);
|
||||
extern char* acc_fetch_tfarg_str(int n);
|
||||
|
||||
extern PLI_INT32 acc_fetch_type(handle obj);
|
||||
extern char* acc_fetch_type_str(PLI_INT32 type);
|
||||
|
||||
extern handle acc_handle_tfarg(int n);
|
||||
extern handle acc_handle_tfinst(void);
|
||||
|
||||
extern handle acc_next_topmod(handle prev_topmod);
|
||||
|
||||
extern int acc_object_of_type(handle object, int type);
|
||||
extern int acc_object_in_typelist(handle object, PLI_INT32*typelist);
|
||||
extern int acc_object_of_type(handle object, PLI_INT32 type);
|
||||
|
||||
extern char*acc_product_version(void);
|
||||
|
||||
|
|
@ -136,6 +166,14 @@ EXTERN_C_END
|
|||
|
||||
/*
|
||||
* $Log: acc_user.h,v $
|
||||
* Revision 1.7 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
* Revision 1.6 2002/08/12 01:34:58 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
# 59 Temple Place - Suite 330
|
||||
# Boston, MA 02111-1307, USA
|
||||
#
|
||||
#ident "$Id: Makefile.in,v 1.15 2002/12/19 21:37:04 steve Exp $"
|
||||
#ident "$Id: Makefile.in,v 1.16 2003/02/17 06:39:47 steve Exp $"
|
||||
#
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
|
|
@ -44,13 +44,14 @@ CFLAGS = @CFLAGS@
|
|||
LDFLAGS = @LDFLAGS@
|
||||
STRIP = @STRIP@
|
||||
|
||||
A = a_close.o a_fetch_argc.o a_fetch_argv.o a_fetch_fullname.o \
|
||||
a_fetch_tfarg.o a_handle_tfarg.o \
|
||||
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_tfarg.o a_fetch_type.o a_fetch_type_str.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
|
||||
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 typep.o workarea.o veriusertfs.o $A
|
||||
putp.o typep.o workarea.o veriusertfs.o priv.o $A
|
||||
|
||||
all: libveriuser.a
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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_configure.c,v 1.1 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <acc_user.h>
|
||||
#include <vpi_user.h>
|
||||
|
||||
int acc_configure(PLI_INT32 config_param, const char*value)
|
||||
{
|
||||
int rc;
|
||||
switch (config_param) {
|
||||
case accDevelopmentVersion:
|
||||
vpi_printf("Request PLI Development Version %s\n", value);
|
||||
rc = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
vpi_printf("XXXX acc_configure(%d, %s)\n", config_param, value);
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_configure.c,v $
|
||||
* Revision 1.1 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: a_fetch_fullname.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
|
||||
#ident "$Id: a_fetch_fullname.c,v 1.3 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <vpi_user.h>
|
||||
|
|
@ -28,11 +28,24 @@
|
|||
*/
|
||||
char *acc_fetch_fullname(handle object)
|
||||
{
|
||||
return vpi_get_str(vpiFullName, object);
|
||||
return __acc_newstring(vpi_get_str(vpiFullName, object));
|
||||
}
|
||||
|
||||
char* acc_fetch_name(handle object)
|
||||
{
|
||||
return __acc_newstring(vpi_get_str(vpiName, object));
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_fetch_fullname.c,v $
|
||||
* Revision 1.3 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
* Revision 1.2 2002/08/12 01:35:02 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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_location.c,v 1.1 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <acc_user.h>
|
||||
#include <vpi_user.h>
|
||||
|
||||
int acc_fetch_location(p_location loc, handle obj)
|
||||
{
|
||||
loc->line_no = 0;
|
||||
loc->filename = "<filename>";
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_fetch_location.c,v $
|
||||
* Revision 1.1 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -17,11 +17,12 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: a_fetch_tfarg.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
|
||||
#ident "$Id: a_fetch_tfarg.c,v 1.3 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <vpi_user.h>
|
||||
#include <acc_user.h>
|
||||
#include "priv.h"
|
||||
|
||||
/*
|
||||
* acc_fetch_tfarg routines implemented using VPI interface
|
||||
|
|
@ -64,7 +65,7 @@ char *acc_fetch_tfarg_str(int n)
|
|||
if (arg_h) {
|
||||
value.format=vpiStringVal;
|
||||
vpi_get_value(arg_h, &value);
|
||||
rtn = value.value.str;
|
||||
rtn = __acc_newstring(value.value.str);
|
||||
} else {
|
||||
rtn = (char *) 0;
|
||||
}
|
||||
|
|
@ -74,6 +75,14 @@ char *acc_fetch_tfarg_str(int n)
|
|||
|
||||
/*
|
||||
* $Log: a_fetch_tfarg.c,v $
|
||||
* Revision 1.3 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
* Revision 1.2 2002/08/12 01:35:02 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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_type.c,v 1.1 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <acc_user.h>
|
||||
# include <vpi_user.h>
|
||||
# include <assert.h>
|
||||
|
||||
PLI_INT32 acc_fetch_type(handle obj)
|
||||
{
|
||||
switch (vpi_get(vpiType, obj)) {
|
||||
|
||||
case vpiConstant:
|
||||
return accConstant;
|
||||
|
||||
case vpiNet:
|
||||
return accNet;
|
||||
|
||||
case vpiReg:
|
||||
return accReg;
|
||||
|
||||
default:
|
||||
vpi_printf("XXXX acc_fetch_type(%d) returns what?\n",
|
||||
vpi_get(vpiType, obj));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_fetch_type.c,v $
|
||||
* Revision 1.1 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* 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_type_str.c,v 1.1 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <acc_user.h>
|
||||
|
||||
|
||||
char* acc_fetch_type_str(PLI_INT32 type)
|
||||
{
|
||||
switch (type) {
|
||||
case accParameter:
|
||||
return "accParameter";
|
||||
|
||||
default:
|
||||
vpi_printf("XXXX acc_fetch_type_str(%d);\n", type);
|
||||
return "acc_fetch_type_str(unknown)";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_fetch_type_str.c,v $
|
||||
* Revision 1.1 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: a_handle_tfarg.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
|
||||
#ident "$Id: a_handle_tfarg.c,v 1.3 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <acc_user.h>
|
||||
|
|
@ -46,8 +46,21 @@ handle acc_handle_tfarg(int n)
|
|||
return rtn_h;
|
||||
}
|
||||
|
||||
handle acc_handle_tfinst(void)
|
||||
{
|
||||
return vpi_handle(vpiSysTfCall, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_handle_tfarg.c,v $
|
||||
* Revision 1.3 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
* Revision 1.2 2002/08/12 01:35:02 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: a_object_of_type.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
|
||||
#ident "$Id: a_object_of_type.c,v 1.3 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
/*
|
||||
* acc_object_of_type implemented using VPI interface
|
||||
*/
|
||||
int acc_object_of_type(handle object, int type)
|
||||
int acc_object_of_type(handle object, PLI_INT32 type)
|
||||
{
|
||||
int vtype;
|
||||
int rtn = 0; /* false */
|
||||
|
|
@ -36,19 +36,44 @@ int acc_object_of_type(handle object, int type)
|
|||
vtype = vpi_get(vpiType, object);
|
||||
|
||||
switch (type) {
|
||||
case accModule:
|
||||
if (vtype == vpiModule)
|
||||
rtn = 1;
|
||||
break;
|
||||
|
||||
case accScope:
|
||||
if (vtype == vpiModule || vtype == vpiNamedBegin ||
|
||||
vtype == vpiNamedFork || vtype == vpiTask ||
|
||||
vtype == vpiFunction) rtn = 1;
|
||||
break;
|
||||
|
||||
case accNet:
|
||||
if (vtype == vpiNet)
|
||||
rtn = 1;
|
||||
break;
|
||||
|
||||
case accReg:
|
||||
if (vtype == vpiReg)
|
||||
rtn = 1;
|
||||
break;
|
||||
|
||||
case accScalar:
|
||||
if (vtype == vpiReg || vtype == vpiNet)
|
||||
rtn = vpi_get(vpiSize, object) == 1;
|
||||
break;
|
||||
|
||||
case accVector:
|
||||
if (vtype == vpiReg || vtype == vpiNet)
|
||||
rtn = vpi_get(vpiSize, object) > 1;
|
||||
break;
|
||||
|
||||
case accParameter:
|
||||
#ifdef vpiParameter
|
||||
if (vtype == vpiParameter)
|
||||
rtn = 1;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
vpi_printf("acc_object_of_type: Unknown type %d\n", type);
|
||||
assert(0);
|
||||
|
|
@ -57,8 +82,29 @@ int acc_object_of_type(handle object, int type)
|
|||
return rtn;
|
||||
}
|
||||
|
||||
int acc_object_in_typelist(handle object, PLI_INT32*typelist)
|
||||
{
|
||||
while (typelist[0] != 0) {
|
||||
int rtn = acc_object_of_type(object, typelist[0]);
|
||||
if (rtn)
|
||||
return rtn;
|
||||
|
||||
typelist += 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_object_of_type.c,v $
|
||||
* Revision 1.3 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
* Revision 1.2 2002/08/12 01:35:02 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* 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: priv.c,v 1.1 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "priv.h"
|
||||
# include <string.h>
|
||||
# include <assert.h>
|
||||
|
||||
static char string_buffer[8192];
|
||||
static unsigned string_fill = 0;
|
||||
|
||||
static buffer_reset(void)
|
||||
{
|
||||
string_fill = 0;
|
||||
}
|
||||
|
||||
char* __acc_newstring(const char*txt)
|
||||
{
|
||||
char*res;
|
||||
unsigned len;
|
||||
|
||||
if (txt == 0)
|
||||
return 0;
|
||||
|
||||
len = strlen(txt);
|
||||
assert(len < sizeof string_buffer);
|
||||
|
||||
if ((string_fill + len + 1) >= sizeof string_buffer)
|
||||
buffer_reset();
|
||||
|
||||
res = string_buffer + string_fill;
|
||||
strcpy(string_buffer + string_fill, txt);
|
||||
|
||||
string_fill += len + 1;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: priv.c,v $
|
||||
* Revision 1.1 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#ifndef __priv_H
|
||||
#define __priv_H
|
||||
/*
|
||||
* 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: priv.h,v 1.1 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function implements the acc_ string buffer, by adding the
|
||||
* input string to the buffer, and returning a pointer to the first
|
||||
* character of the new string.
|
||||
*/
|
||||
extern char* __acc_newstring(const char*txt);
|
||||
|
||||
/*
|
||||
* $Log: priv.h,v $
|
||||
* Revision 1.1 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
*/
|
||||
#endif
|
||||
21
veriuser.h
21
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.19 2003/02/16 02:23:22 steve Exp $"
|
||||
#ident "$Id: veriuser.h,v 1.20 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -41,6 +41,7 @@
|
|||
* This API is provided by Icarus Verilog only to support legacy software.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define EXTERN_C_START extern "C" {
|
||||
# define EXTERN_C_END }
|
||||
|
|
@ -56,15 +57,7 @@
|
|||
|
||||
EXTERN_C_START
|
||||
|
||||
#ifndef PLI_TYPES
|
||||
#define PLI_TYPES
|
||||
typedef signed int PLI_INT32;
|
||||
typedef unsigned int PLI_UINT32;
|
||||
typedef signed short PLI_INT16;
|
||||
typedef unsigned short PLI_UINT12;
|
||||
typedef signed char PLI_BYTE8;
|
||||
typedef unsigned char PLI_UBYTE8;
|
||||
#endif
|
||||
# include "_pli_types.h"
|
||||
|
||||
/*
|
||||
* defines for tf_message
|
||||
|
|
@ -258,6 +251,14 @@ EXTERN_C_END
|
|||
|
||||
/*
|
||||
* $Log: veriuser.h,v $
|
||||
* Revision 1.20 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
* Revision 1.19 2003/02/16 02:23:22 steve
|
||||
* Change the IV veriusertfs_register to accept table pointers.
|
||||
*
|
||||
|
|
|
|||
11
vpi_user.h
11
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.18 2003/02/01 05:50:27 steve Exp $"
|
||||
#ident "$Id: vpi_user.h,v 1.19 2003/02/17 06:39:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -45,6 +45,7 @@
|
|||
EXTERN_C_START
|
||||
|
||||
# include <stdarg.h>
|
||||
# include "_pli_types.h"
|
||||
|
||||
typedef struct __vpiHandle *vpiHandle;
|
||||
|
||||
|
|
@ -371,6 +372,14 @@ EXTERN_C_END
|
|||
|
||||
/*
|
||||
* $Log: vpi_user.h,v $
|
||||
* Revision 1.19 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
* string handling.
|
||||
*
|
||||
* Add the _pli_types.h header file to carry the
|
||||
* IEEE1364-2001 standard PLI type declarations.
|
||||
*
|
||||
* Revision 1.18 2003/02/01 05:50:27 steve
|
||||
* Make $time and $realtime available to $display uniquely.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue