Add acc_next function.
This commit is contained in:
parent
0555a5f182
commit
2b471d16f7
|
|
@ -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.15 2003/05/29 02:35:41 steve Exp $"
|
||||
#ident "$Id: acc_user.h,v 1.16 2003/05/30 04:18:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -226,6 +226,7 @@ extern handle acc_handle_parent(handle obj);
|
|||
extern handle acc_handle_tfarg(int n);
|
||||
extern handle acc_handle_tfinst(void);
|
||||
|
||||
extern handle acc_next(PLI_INT32 *, handle, handle);
|
||||
extern handle acc_next_topmod(handle prev_topmod);
|
||||
|
||||
extern int acc_object_in_typelist(handle object, PLI_INT32*typelist);
|
||||
|
|
@ -247,6 +248,9 @@ EXTERN_C_END
|
|||
|
||||
/*
|
||||
* $Log: acc_user.h,v $
|
||||
* Revision 1.16 2003/05/30 04:18:31 steve
|
||||
* Add acc_next function.
|
||||
*
|
||||
* Revision 1.15 2003/05/29 02:35:41 steve
|
||||
* acc_fetch_type supports module.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
# 59 Temple Place - Suite 330
|
||||
# Boston, MA 02111-1307, USA
|
||||
#
|
||||
#ident "$Id: Makefile.in,v 1.24 2003/05/24 03:02:04 steve Exp $"
|
||||
#ident "$Id: Makefile.in,v 1.25 2003/05/30 04:18:31 steve Exp $"
|
||||
#
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
|
|
@ -49,7 +49,8 @@ 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_fetch_value.o \
|
||||
a_handle_by_name.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_initialize.o a_next.o a_next_topmod.o a_object_of_type.o \
|
||||
a_product_version.o \
|
||||
a_set_value.o a_vcl.o a_version.o
|
||||
O = asynch.o delay.o finish.o getcstringp.o getinstance.o getlongp.o \
|
||||
getp.o getsimtime.o io_print.o math.o mc_scan_plusargs.o nump.o putlongp.o \
|
||||
|
|
|
|||
|
|
@ -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.5 2003/05/29 02:35:41 steve Exp $"
|
||||
#ident "$Id: a_fetch_type.c,v 1.6 2003/05/30 04:18:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <acc_user.h>
|
||||
|
|
@ -86,6 +86,9 @@ PLI_INT32 acc_fetch_fulltype(handle obj)
|
|||
return accModuleInstance;
|
||||
// FIXME accCellInstance
|
||||
|
||||
case vpiReg:
|
||||
return accReg;
|
||||
|
||||
default:
|
||||
vpi_printf("acc_fetch_fulltype: vpiType %d is what accType?\n",
|
||||
vpi_get(vpiType, obj));
|
||||
|
|
@ -95,6 +98,9 @@ PLI_INT32 acc_fetch_fulltype(handle obj)
|
|||
|
||||
/*
|
||||
* $Log: a_fetch_type.c,v $
|
||||
* Revision 1.6 2003/05/30 04:18:31 steve
|
||||
* Add acc_next function.
|
||||
*
|
||||
* Revision 1.5 2003/05/29 02:35:41 steve
|
||||
* acc_fetch_type supports module.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,104 @@
|
|||
/* vi:sw=6
|
||||
* Copyright (c) 2003 Michael Ruff (mruff at chiaro.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_next.c,v 1.1 2003/05/30 04:18:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <acc_user.h>
|
||||
#include <vpi_user.h>
|
||||
#include "priv.h"
|
||||
|
||||
/*
|
||||
* acc_next and friends implemented using VPI
|
||||
*/
|
||||
handle acc_next(PLI_INT32 *type, handle scope, handle prev)
|
||||
{
|
||||
vpiHandle hand;
|
||||
|
||||
/* preserved state */
|
||||
static vpiHandle pscope = 0;
|
||||
static vpiHandle iter = 0;
|
||||
static vpiHandle rtn = 0;
|
||||
|
||||
/* trace */
|
||||
if (pli_trace) {
|
||||
int *ip;
|
||||
fprintf(pli_trace, "acc_next(%p <", type);
|
||||
for (ip = type; *ip; ip++) {
|
||||
fprintf(pli_trace, "%s%d", ip != type ? "," : "", *ip);
|
||||
}
|
||||
fprintf(pli_trace, ">, %p", scope);
|
||||
if (scope)
|
||||
fprintf(pli_trace, " \"%s\"", vpi_get_str(vpiName, scope));
|
||||
fprintf(pli_trace, ", %p", prev);
|
||||
if (prev)
|
||||
fprintf(pli_trace, " \"%s\"", vpi_get_str(vpiName, prev));
|
||||
else
|
||||
fprintf(pli_trace, ")");
|
||||
fflush(pli_trace);
|
||||
}
|
||||
|
||||
/* initialize or reset if detect user dain bramaged */
|
||||
if (!prev || !*type || scope != pscope || prev != rtn) {
|
||||
/* if iterator still valid, free it */
|
||||
if (iter) vpi_free_object(iter);
|
||||
|
||||
/* iterate across all things in specified scope */
|
||||
if (!*type) {
|
||||
pscope = iter = rtn = 0;
|
||||
goto err;
|
||||
} else {
|
||||
pscope = scope;
|
||||
iter = vpi_iterate(vpiScope, pscope);
|
||||
}
|
||||
}
|
||||
|
||||
/* scan iterator */
|
||||
rtn = 0;
|
||||
while ((hand = vpi_scan(iter))) {
|
||||
if (acc_object_in_typelist(hand, type)) {
|
||||
rtn = hand;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we exhausted iterator, cleanup */
|
||||
if (!hand) { pscope = iter = 0; }
|
||||
|
||||
err:
|
||||
/* trace */
|
||||
if (pli_trace) {
|
||||
fprintf(pli_trace, " --> %p", rtn);
|
||||
if (rtn)
|
||||
fprintf(pli_trace, " \"%s\"\n", vpi_get_str(vpiName, rtn));
|
||||
else
|
||||
fprintf(pli_trace, "\n");
|
||||
|
||||
}
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: a_next.c,v $
|
||||
* Revision 1.1 2003/05/30 04:18:31 steve
|
||||
* Add acc_next function.
|
||||
*
|
||||
*/
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/* vi:sw=6
|
||||
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
|
||||
* Copyright (c) 2002, 2003 Michael Ruff (mruff at chiaro.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
|
||||
|
|
@ -17,21 +17,28 @@
|
|||
* 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.3 2003/02/17 06:39:47 steve Exp $"
|
||||
#ident "$Id: a_object_of_type.c,v 1.4 2003/05/30 04:18:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <vpi_user.h>
|
||||
#include <acc_user.h>
|
||||
#include "priv.h"
|
||||
|
||||
/*
|
||||
* acc_object_of_type implemented using VPI interface
|
||||
*/
|
||||
int acc_object_of_type(handle object, PLI_INT32 type)
|
||||
PLI_INT32 acc_object_of_type(handle object, PLI_INT32 type)
|
||||
{
|
||||
int vtype;
|
||||
int rtn = 0; /* false */
|
||||
|
||||
if (pli_trace) {
|
||||
fprintf(pli_trace, "acc_object_of_type(%p \"%s\", %d)",
|
||||
object, vpi_get_str(vpiName, object), type);
|
||||
fflush(pli_trace);
|
||||
}
|
||||
|
||||
/* get VPI type of object */
|
||||
vtype = vpi_get(vpiType, object);
|
||||
|
||||
|
|
@ -68,21 +75,21 @@ int acc_object_of_type(handle object, PLI_INT32 type)
|
|||
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);
|
||||
rtn = 0;
|
||||
}
|
||||
|
||||
if (pli_trace) fprintf(pli_trace, " --> %d\n", rtn);
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
int acc_object_in_typelist(handle object, PLI_INT32*typelist)
|
||||
PLI_INT32 acc_object_in_typelist(handle object, PLI_INT32*typelist)
|
||||
{
|
||||
while (typelist[0] != 0) {
|
||||
int rtn = acc_object_of_type(object, typelist[0]);
|
||||
|
|
@ -97,6 +104,9 @@ int acc_object_in_typelist(handle object, PLI_INT32*typelist)
|
|||
|
||||
/*
|
||||
* $Log: a_object_of_type.c,v $
|
||||
* Revision 1.4 2003/05/30 04:18:31 steve
|
||||
* Add acc_next function.
|
||||
*
|
||||
* Revision 1.3 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
|
|
|
|||
18
veriuser.h
18
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.29 2003/05/30 04:01:55 steve Exp $"
|
||||
#ident "$Id: veriuser.h,v 1.30 2003/05/30 04:18:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -162,11 +162,13 @@ extern void veriusertfs_register_table(p_tfcell vtable);
|
|||
|
||||
/* callback reasons */
|
||||
#define reason_checktf 1
|
||||
#define reason_calltf 3
|
||||
#define reason_calltf 3
|
||||
#define reason_paramvc 7
|
||||
#define reason_synch 8
|
||||
#define REASON_SYNCH reason_synch
|
||||
#define reason_finish 9
|
||||
#define reason_synch 8
|
||||
#define REASON_SYNCH reason_synch
|
||||
#define reason_finish 9
|
||||
#define reason_rosynch 11
|
||||
#define REASON_ROSYNCH reason_rosynch
|
||||
#define reason_endofcompile 16
|
||||
|
||||
/* These are values returned by tf_typep */
|
||||
|
|
@ -315,6 +317,9 @@ extern char* tf_imipname(void*);
|
|||
extern PLI_INT32 tf_synchronize(void);
|
||||
extern PLI_INT32 tf_isynchronize(void* sys);
|
||||
|
||||
extern PLI_INT32 tf_rosynchronize(void);
|
||||
extern PLI_INT32 tf_irosynchronize(void* sys);
|
||||
|
||||
extern PLI_INT32 tf_typep(PLI_INT32 narg);
|
||||
|
||||
extern void tf_warning(const char*, ...)
|
||||
|
|
@ -324,6 +329,9 @@ EXTERN_C_END
|
|||
|
||||
/*
|
||||
* $Log: veriuser.h,v $
|
||||
* Revision 1.30 2003/05/30 04:18:31 steve
|
||||
* Add acc_next function.
|
||||
*
|
||||
* Revision 1.29 2003/05/30 04:01:55 steve
|
||||
* Add tf_scale_longdelay.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue