mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-22 05:47:31 +02:00
Add a bunch of new acc_ and tf_ functions.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
# 59 Temple Place - Suite 330
|
||||
# Boston, MA 02111-1307, USA
|
||||
#
|
||||
#ident "$Id: Makefile.in,v 1.18 2003/02/27 22:13:22 steve Exp $"
|
||||
#ident "$Id: Makefile.in,v 1.19 2003/03/13 04:35:09 steve Exp $"
|
||||
#
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
@@ -46,13 +46,14 @@ STRIP = @STRIP@
|
||||
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_tfarg.o a_fetch_type.o a_fetch_type_str.o \
|
||||
a_handle_tfarg.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_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 priv.o $A
|
||||
putp.o spname.o typep.o workarea.o veriusertfs.o priv.o $A
|
||||
|
||||
all: dep libveriuser.a
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Stephen Williams ([email protected])
|
||||
*
|
||||
* 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_param.c,v 1.1 2003/03/13 04:35:09 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <vpi_user.h>
|
||||
#include <acc_user.h>
|
||||
|
||||
double acc_fetch_paramval(handle object)
|
||||
{
|
||||
s_vpi_value val;
|
||||
|
||||
val.format = vpiObjTypeVal;
|
||||
vpi_get_value(object, &val);
|
||||
|
||||
switch (val.format) {
|
||||
|
||||
case vpiStringVal:
|
||||
return (double) (long)val.value.str;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_fetch_param.c,v $
|
||||
* Revision 1.1 2003/03/13 04:35:09 steve
|
||||
* Add a bunch of new acc_ and tf_ functions.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: a_fetch_tfarg.c,v 1.3 2003/02/17 06:39:47 steve Exp $"
|
||||
#ident "$Id: a_fetch_tfarg.c,v 1.4 2003/03/13 04:35:09 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <vpi_user.h>
|
||||
@@ -55,17 +55,20 @@ char *acc_fetch_tfarg_str(int n)
|
||||
vpiHandle sys_h, sys_i, arg_h = 0;
|
||||
s_vpi_value value;
|
||||
char *rtn;
|
||||
int idx = n;
|
||||
|
||||
sys_h = vpi_handle(vpiSysTfCall, 0);
|
||||
sys_i = vpi_iterate(vpiArgument, sys_h);
|
||||
|
||||
/* scan to nth argument */
|
||||
while (n > 0 && (arg_h = vpi_scan(sys_i))) n--;
|
||||
while (idx > 0 && (arg_h = vpi_scan(sys_i)))
|
||||
idx -= 1;
|
||||
|
||||
if (arg_h) {
|
||||
value.format=vpiStringVal;
|
||||
vpi_get_value(arg_h, &value);
|
||||
rtn = __acc_newstring(value.value.str);
|
||||
vpi_free_object(sys_i);
|
||||
} else {
|
||||
rtn = (char *) 0;
|
||||
}
|
||||
@@ -75,6 +78,9 @@ char *acc_fetch_tfarg_str(int n)
|
||||
|
||||
/*
|
||||
* $Log: a_fetch_tfarg.c,v $
|
||||
* Revision 1.4 2003/03/13 04:35:09 steve
|
||||
* Add a bunch of new acc_ and tf_ functions.
|
||||
*
|
||||
* Revision 1.3 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Stephen Williams ([email protected])
|
||||
*
|
||||
* 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_time.c,v 1.1 2003/03/13 04:35:09 steve Exp $"
|
||||
#endif
|
||||
|
||||
|
||||
#include <vpi_user.h>
|
||||
#include <acc_user.h>
|
||||
#include "priv.h"
|
||||
|
||||
void acc_fetch_timescale_info(handle obj, p_timescale_info info)
|
||||
{
|
||||
info->precision = vpi_get(vpiTimePrecision, 0);
|
||||
info->unit = vpi_get(vpiTimeUnit, obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_fetch_time.c,v $
|
||||
* Revision 1.1 2003/03/13 04:35:09 steve
|
||||
* Add a bunch of new acc_ and tf_ functions.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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.c,v 1.1 2003/02/17 06:39:47 steve Exp $"
|
||||
#ident "$Id: a_fetch_type.c,v 1.2 2003/03/13 04:35:09 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <acc_user.h>
|
||||
@@ -34,6 +34,9 @@ PLI_INT32 acc_fetch_type(handle obj)
|
||||
case vpiNet:
|
||||
return accNet;
|
||||
|
||||
case vpiParameter:
|
||||
return accParameter;
|
||||
|
||||
case vpiReg:
|
||||
return accReg;
|
||||
|
||||
@@ -48,6 +51,9 @@ PLI_INT32 acc_fetch_type(handle obj)
|
||||
|
||||
/*
|
||||
* $Log: a_fetch_type.c,v $
|
||||
* Revision 1.2 2003/03/13 04:35:09 steve
|
||||
* Add a bunch of new acc_ and tf_ functions.
|
||||
*
|
||||
* Revision 1.1 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
|
||||
@@ -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.2 2003/02/19 04:37:04 steve Exp $"
|
||||
#ident "$Id: a_fetch_type_str.c,v 1.3 2003/03/13 04:35:09 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
@@ -27,6 +27,9 @@
|
||||
char* acc_fetch_type_str(PLI_INT32 type)
|
||||
{
|
||||
switch (type) {
|
||||
case accReg:
|
||||
return "accReg";
|
||||
|
||||
case accParameter:
|
||||
return "accParameter";
|
||||
|
||||
@@ -43,6 +46,9 @@ char* acc_fetch_type_str(PLI_INT32 type)
|
||||
|
||||
/*
|
||||
* $Log: a_fetch_type_str.c,v $
|
||||
* Revision 1.3 2003/03/13 04:35:09 steve
|
||||
* Add a bunch of new acc_ and tf_ functions.
|
||||
*
|
||||
* Revision 1.2 2003/02/19 04:37:04 steve
|
||||
* fullname for accConstant.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Stephen Williams ([email protected])
|
||||
*
|
||||
* 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_handle_object.c,v 1.1 2003/03/13 04:35:09 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <vpi_user.h>
|
||||
#include <acc_user.h>
|
||||
#include "priv.h"
|
||||
|
||||
handle acc_handle_object(const char*name)
|
||||
{
|
||||
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
|
||||
vpiHandle scope = vpi_handle(vpiScope, sys);
|
||||
|
||||
vpiHandle res = vpi_handle_by_name(name, scope);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_handle_object.c,v $
|
||||
* Revision 1.1 2003/03/13 04:35:09 steve
|
||||
* Add a bunch of new acc_ and tf_ functions.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Stephen Williams ([email protected])
|
||||
*
|
||||
* 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_handle_parent.c,v 1.1 2003/03/13 04:35:09 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <vpi_user.h>
|
||||
#include <acc_user.h>
|
||||
#include "priv.h"
|
||||
|
||||
handle acc_handle_parent(handle obj)
|
||||
{
|
||||
vpiHandle scope = vpi_handle(vpiScope, obj);
|
||||
|
||||
while (scope && (vpi_get(vpiType, scope) != vpiModule))
|
||||
scope = vpi_handle(vpiScope, scope);
|
||||
|
||||
return scope;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_handle_parent.c,v $
|
||||
* Revision 1.1 2003/03/13 04:35:09 steve
|
||||
* Add a bunch of new acc_ and tf_ functions.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: getcstringp.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
|
||||
#ident "$Id: getcstringp.c,v 1.3 2003/03/13 04:35:09 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <veriuser.h>
|
||||
@@ -28,11 +28,15 @@
|
||||
*/
|
||||
char *tf_getcstringp(int n)
|
||||
{
|
||||
return acc_fetch_tfarg_str(n);
|
||||
char*res = acc_fetch_tfarg_str(n);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: getcstringp.c,v $
|
||||
* Revision 1.3 2003/03/13 04:35:09 steve
|
||||
* Add a bunch of new acc_ and tf_ functions.
|
||||
*
|
||||
* Revision 1.2 2002/08/12 01:35:02 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: getsimtime.c,v 1.3 2003/03/06 00:27:54 steve Exp $"
|
||||
#ident "$Id: getsimtime.c,v 1.4 2003/03/13 04:35:09 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <veriuser.h>
|
||||
#include <vpi_user.h>
|
||||
|
||||
/*
|
||||
@@ -38,8 +39,16 @@ int tf_getlongtime(int *hightime)
|
||||
int tf_getlongsimtime(int *hightime) \
|
||||
__attribute__ ((weak, alias ("tf_getlongtime")));
|
||||
|
||||
PLI_INT32 tf_igettimeprecision(void*obj)
|
||||
{
|
||||
return vpi_get(vpiTimePrecision, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: getsimtime.c,v $
|
||||
* Revision 1.4 2003/03/13 04:35:09 steve
|
||||
* Add a bunch of new acc_ and tf_ functions.
|
||||
*
|
||||
* Revision 1.3 2003/03/06 00:27:54 steve
|
||||
* Fill in required fields when getting time.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Stephen Williams ([email protected])
|
||||
*
|
||||
* 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: spname.c,v 1.1 2003/03/13 04:35:09 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <vpi_user.h>
|
||||
#include <veriuser.h>
|
||||
#include "priv.h"
|
||||
|
||||
char* tf_spname(void)
|
||||
{
|
||||
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
|
||||
vpiHandle scope = vpi_handle(vpiScope, sys);
|
||||
|
||||
return __acc_newstring(vpi_get_str(vpiFullName, scope));
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: spname.c,v $
|
||||
* Revision 1.1 2003/03/13 04:35:09 steve
|
||||
* Add a bunch of new acc_ and tf_ functions.
|
||||
*
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user