Merge branch 'master' into verilog-ams
[sverilog.git] / acc_user.h
blob204baa3ab4e378deccc96edbc793ec8c6ccded7c
1 #ifndef __acc_user_H
2 #define __acc_user_H
3 /*
4 * Copyright (c) 2002 Stephen Williams (steve@icarus.com)
6 * This source code is free software; you can redistribute it
7 * and/or modify it in source code form under the terms of the GNU
8 * General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
10 * any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21 #ifdef HAVE_CVS_IDENT
22 #ident "$Id: acc_user.h,v 1.20 2003/12/17 15:45:07 steve Exp $"
23 #endif
26 * This header file contains the definitions and declarations needed
27 * by an Icarus Verilog user using acc_ routines.
29 * NOTE: Icarus Verilog does not support acc_ routines. This is just a
30 * stub. The functions that are implemented here are actually
31 * implemented using VPI routines.
35 #ifdef __cplusplus
36 # define EXTERN_C_START extern "C" {
37 # define EXTERN_C_END }
38 #else
39 # define EXTERN_C_START
40 # define EXTERN_C_END
41 # define bool int
42 #endif
44 EXTERN_C_START
46 # include "_pli_types.h"
49 * This is a declaration of the "handle" type that is compatible with
50 * the vpiHandle from vpi_user.h. The libveriuser library implements
51 * the acc handle type as a vpiHandle, to prevent useless indirection.
53 typedef struct __vpiHandle *handle;
55 /* OBJECT TYPES */
56 #define accModule 20
57 #define accScope 21
58 #define accNet 25
59 #define accReg 30
60 #define accIntegerParam 200
61 #define accRealParam 202
62 #define accStringParam 204
63 #define accParameter 220
64 #define accTopModule 224
65 #define accModuleInstance 226
66 #define accWire 260
67 #define accNamedEvent 280
68 #define accIntegerVar 281
69 #define accRealVar 282
70 #define accTimeVar 283
71 #define accIntVar accIntegerVar
72 #define accScalar 300
73 #define accVector 302
74 #define accUnknown 412
75 #define accConstant 600
77 /* type VALUES FOR t_setval_delay STRUCTURE */
78 #define accNoDelay 0
79 #define accInertialDelay 1
80 #define accTransportDelay 2
81 #define accPureTransportDelay 3
82 #define accForceFlag 4
83 #define accReleaseFlag 5
85 /* type VALUES FOR t_setval_value STRUCTURE */
86 #define accBinStrVal 1
87 #define accOctStrVal 2
88 #define accDecStrVal 3
89 #define accHexStrVal 4
90 #define accScalarVal 5
91 #define accIntVal 6
92 #define accRealVal 7
93 #define accStringVal 8
94 #define accVectorVal 9
96 /* Scalar values */
97 #define acc0 0
98 #define acc1 1
99 #define accX 2
100 #define accZ 3
102 /* type VALUES FOR t_acc_time STRUCTURE */
103 #define accTime 1
104 #define accSimTime 2
105 #define accRealTime 3
107 /* reason codes */
108 #define logic_value_change 1
109 #define strength_value_change 2
110 #define real_value_change 3
111 #define vector_value_change 4
112 #define event_value_change 5
113 #define integer_value_change 6
114 #define time_value_change 7
115 #define sregister_value_change 8
116 #define vregister_value_change 9
117 #define realtime_value_change 10
119 /* VCL strength values */
120 #define vclSupply 7
121 #define vclStrong 6
122 #define vclPull 5
123 #define vclLarge 4
124 #define vclWeak 3
125 #define vclMedium 2
126 #define vclSmall 1
127 #define vclHighZ 0
129 /* Constants used by acc_vcl_add */
130 #define vcl_verilog_logic 2
131 #define VCL_VERILOG_LOGIC vcl_verilog_logic
132 #define vcl_verilog_strength 3
133 #define VCL_VERILOG_STRENGTH vcl_verilog_strength
135 typedef struct t_acc_time {
136 int type;
137 int low, high;
138 double real;
139 } s_acc_time, *p_acc_time;
141 typedef struct t_setval_delay {
142 s_acc_time time;
143 int model;
144 } s_setval_delay, *p_setval_delay;
146 typedef struct t_acc_vecval {
147 int aval;
148 int bval;
149 } s_acc_vecval, *p_acc_vecval;
151 typedef struct t_setval_value {
152 int format;
153 union {
154 char*str;
155 int scalar;
156 int integer;
157 double real;
158 p_acc_vecval vector;
159 } value;
160 } s_setval_value, *p_setval_value, s_acc_value, *p_acc_value;
162 typedef struct t_strengths {
163 PLI_UBYTE8 logic_value;
164 PLI_UBYTE8 strength1;
165 PLI_UBYTE8 strength2;
166 } s_strengths, *p_strengths;
168 typedef struct t_vc_record {
169 PLI_INT32 vc_reason;
170 PLI_INT32 vc_hightime;
171 PLI_INT32 vc_lowtime;
172 void* user_data;
173 union {
174 PLI_UBYTE8 logic_value;
175 double real_value;
176 handle vector_handle;
177 s_strengths strengths_s;
178 } out_value;
179 } s_vc_record, *p_vc_record;
182 typedef struct t_location {
183 PLI_INT32 line_no;
184 const char*filename;
185 } s_location, *p_location;
187 extern int acc_error_flag;
189 extern int acc_initialize(void);
191 extern void acc_close(void);
194 * This is the acc_configure command, and the config_param
195 * codes that are accepted.
197 extern int acc_configure(PLI_INT32 config_param, const char*value);
198 #define accEnableArgs 6
199 #define accDevelopmentVersion 11
201 extern int acc_fetch_argc(void);
202 extern char**acc_fetch_argv(void);
204 extern PLI_INT32 acc_fetch_direction(handle obj);
205 /* XXXX FIXME: Values returned by acc_fetch_direction */
206 # define accInout 2
208 extern char* acc_fetch_fullname(handle obj);
210 extern int acc_fetch_location(p_location loc, handle obj);
212 extern char* acc_fetch_name(handle obj);
213 extern char* acc_fetch_defname(handle obj);
215 extern double acc_fetch_paramval(handle obj);
217 extern double acc_fetch_tfarg(PLI_INT32);
218 extern double acc_fetch_itfarg(PLI_INT32, handle);
219 extern PLI_INT32 acc_fetch_tfarg_int(PLI_INT32);
220 extern PLI_INT32 acc_fetch_itfarg_int(PLI_INT32, handle);
221 extern char* acc_fetch_tfarg_str(PLI_INT32);
222 extern char* acc_fetch_itfarg_str(PLI_INT32, handle);
224 typedef struct t_timescale_info {
225 PLI_INT16 unit;
226 PLI_INT16 precision;
227 } s_timescale_info, *p_timescale_info;
228 extern void acc_fetch_timescale_info(handle obj, p_timescale_info info);
230 extern PLI_INT32 acc_fetch_size(handle obj);
232 extern PLI_INT32 acc_fetch_type(handle obj);
233 extern PLI_INT32 acc_fetch_fulltype(handle obj);
234 extern PLI_INT32 acc_fetch_range(handle object, int *msb, int *lsb);
235 extern char* acc_fetch_type_str(PLI_INT32 type);
237 extern char* acc_fetch_value(handle obj, const char*fmt, s_acc_value*value);
239 extern handle acc_handle_by_name(const char*name, handle scope);
240 extern handle acc_handle_hiconn(handle port_ref_handle);
241 extern handle acc_handle_object(const char*name);
242 extern handle acc_handle_parent(handle obj);
243 extern handle acc_handle_scope(handle obj);
244 extern handle acc_handle_simulated_net(handle net);
246 extern handle acc_handle_tfarg(int n);
247 extern handle acc_handle_tfinst(void);
249 extern PLI_INT32 acc_compare_handles(handle, handle);
251 extern handle acc_next(PLI_INT32 *, handle, handle);
252 extern handle acc_next_bit(handle ref, handle bit);
253 extern handle acc_next_port(handle ref, handle bit);
254 extern handle acc_next_scope(handle, handle);
255 extern handle acc_next_topmod(handle prev_topmod);
257 extern int acc_object_in_typelist(handle object, PLI_INT32*typelist);
258 extern int acc_object_of_type(handle object, PLI_INT32 type);
260 extern char*acc_product_version(void);
262 extern char*acc_set_scope(handle ref, ...);
264 extern int acc_set_value(handle obj, p_setval_value value,
265 p_setval_delay delay);
267 extern void acc_vcl_add(handle obj, PLI_INT32(*consumer)(p_vc_record),
268 void*data, PLI_INT32 vcl_flag);
269 extern void acc_vcl_delete(handle obj, PLI_INT32(*consumer)(p_vc_record),
270 void*data, PLI_INT32 vcl_flag);
272 extern char* acc_version(void);
274 EXTERN_C_END
277 * $Log: acc_user.h,v $
278 * Revision 1.20 2003/12/17 15:45:07 steve
279 * Add acc_set_scope function.
281 * Revision 1.19 2003/10/10 02:57:45 steve
282 * Some PLI1 stubs.
284 * Revision 1.18 2003/06/13 19:23:41 steve
285 * Add a bunch more PLI1 routines.
287 * Revision 1.17 2003/06/04 01:56:20 steve
288 * 1) Adds configure logic to clean up compiler warnings
289 * 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
290 * tf_isetrealdelay, acc_handle_scope
291 * 3) makes acc_next reentrant
292 * 4) adds basic vpiWire type support
293 * 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
294 * 6) add vpiLeftRange/RigthRange to signals
296 * Revision 1.16 2003/05/30 04:18:31 steve
297 * Add acc_next function.
299 * Revision 1.15 2003/05/29 02:35:41 steve
300 * acc_fetch_type supports module.
302 * Revision 1.14 2003/05/29 02:21:45 steve
303 * Implement acc_fetch_defname and its infrastructure in vvp.
305 * Revision 1.13 2003/05/24 03:02:04 steve
306 * Add implementation of acc_handle_by_name.
308 * Revision 1.12 2003/05/18 00:16:35 steve
309 * Add PLI_TRACE tracing of PLI1 modules.
311 * Add tf_isetdelay and friends, and add
312 * callback return values for acc_vcl support.
314 * Revision 1.11 2003/04/24 18:57:05 steve
315 * Add acc_fetch_fulltype function.
317 * Revision 1.10 2003/04/20 02:48:39 steve
318 * Support value change callbacks.
320 * Revision 1.9 2003/04/12 18:57:13 steve
321 * More acc_ function stubs.
323 * Revision 1.8 2003/03/13 04:35:09 steve
324 * Add a bunch of new acc_ and tf_ functions.
326 * Revision 1.7 2003/02/17 06:39:47 steve
327 * Add at least minimal implementations for several
328 * acc_ functions. Add support for standard ACC
329 * string handling.
331 * Add the _pli_types.h header file to carry the
332 * IEEE1364-2001 standard PLI type declarations.
334 * Revision 1.6 2002/08/12 01:34:58 steve
335 * conditional ident string using autoconfig.
337 * Revision 1.5 2002/06/11 15:19:12 steve
338 * Add acc_fetch_argc/argv/version (mruff)
340 * Revision 1.4 2002/06/07 02:58:58 steve
341 * Add a bunch of acc/tf functions. (mruff)
343 * Revision 1.3 2002/06/02 19:03:29 steve
344 * Add acc_handle_tfarg and acc_next_topmode
346 * Revision 1.2 2002/05/30 02:06:05 steve
347 * Implement acc_product_version.
349 * Revision 1.1 2002/05/23 03:46:42 steve
350 * Add the acc_user.h header file.
354 #endif