2 * Copyright (c) 2002, 2003 Michael Ruff (mruff at chiaro.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 #ident "$Id: a_object_of_type.c,v 1.6 2004/02/18 02:51:59 steve Exp $"
29 * acc_object_of_type implemented using VPI interface
31 int acc_object_of_type(handle object
, PLI_INT32 type
)
34 int rtn
= 0; /* false */
37 fprintf(pli_trace
, "acc_object_of_type(%p \"%s\", %d)",
38 object
, vpi_get_str(vpiName
, object
), type
);
42 /* get VPI type of object */
43 vtype
= vpi_get(vpiType
, object
);
46 case accModule
: rtn
= vtype
== vpiModule
; break;
49 if (vtype
== vpiModule
|| vtype
== vpiNamedBegin
||
50 vtype
== vpiNamedFork
|| vtype
== vpiTask
||
51 vtype
== vpiFunction
) rtn
= 1;
54 case accNet
: rtn
= vtype
== vpiNet
; break;
55 case accReg
: rtn
= vtype
== vpiReg
; break;
58 if (vtype
== vpiNamedEvent
&&
59 vpi_get(vpiConstType
, object
) == vpiRealConst
)
63 case accParameter
: rtn
= vtype
== vpiParameter
; break;
64 case accNamedEvent
: rtn
= vtype
== vpiNamedEvent
; break;
65 case accIntegerVar
: rtn
= vtype
== vpiIntegerVar
; break;
66 case accRealVar
: rtn
= vtype
== vpiRealVar
; break;
67 case accTimeVar
: rtn
= vtype
== vpiTimeVar
; break;
70 if (vtype
== vpiReg
|| vtype
== vpiNet
)
71 rtn
= vpi_get(vpiSize
, object
) == 1;
75 if (vtype
== vpiReg
|| vtype
== vpiNet
)
76 rtn
= vpi_get(vpiSize
, object
) > 1;
80 vpi_printf("acc_object_of_type: Unknown type %d\n", type
);
84 if (pli_trace
) fprintf(pli_trace
, " --> %d\n", rtn
);
89 int acc_object_in_typelist(handle object
, PLI_INT32
*typelist
)
91 while (typelist
[0] != 0) {
92 int rtn
= acc_object_of_type(object
, typelist
[0]);
103 * $Log: a_object_of_type.c,v $
104 * Revision 1.6 2004/02/18 02:51:59 steve
105 * Fix type mismatches of various VPI functions.
107 * Revision 1.5 2003/06/04 01:56:20 steve
108 * 1) Adds configure logic to clean up compiler warnings
109 * 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
110 * tf_isetrealdelay, acc_handle_scope
111 * 3) makes acc_next reentrant
112 * 4) adds basic vpiWire type support
113 * 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
114 * 6) add vpiLeftRange/RigthRange to signals
116 * Revision 1.4 2003/05/30 04:18:31 steve
117 * Add acc_next function.
119 * Revision 1.3 2003/02/17 06:39:47 steve
120 * Add at least minimal implementations for several
121 * acc_ functions. Add support for standard ACC
124 * Add the _pli_types.h header file to carry the
125 * IEEE1364-2001 standard PLI type declarations.
127 * Revision 1.2 2002/08/12 01:35:02 steve
128 * conditional ident string using autoconfig.
130 * Revision 1.1 2002/06/07 02:58:58 steve
131 * Add a bunch of acc/tf functions. (mruff)