Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / pli / acc_user.h
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: acc_user.h
5* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
6* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
7*
8* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9*
10* This program is free software; you can redistribute it and/or modify
11* it under the terms of the GNU General Public License as published by
12* the Free Software Foundation; version 2 of the License.
13*
14* This program is distributed in the hope that it will be useful,
15* but WITHOUT ANY WARRANTY; without even the implied warranty of
16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17* GNU General Public License for more details.
18*
19* You should have received a copy of the GNU General Public License
20* along with this program; if not, write to the Free Software
21* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*
23* For the avoidance of doubt, and except that if any non-GPL license
24* choice is available it will apply instead, Sun elects to use only
25* the General Public License version 2 (GPLv2) at this time for any
26* software where a choice of GPL license versions is made
27* available with the language indicating that GPLv2 or any later version
28* may be used, or where a choice of which version of the GPL is applied is
29* otherwise unspecified.
30*
31* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
32* CA 95054 USA or visit www.sun.com if you need additional information or
33* have any questions.
34*
35*
36* ========== Copyright Header End ============================================
37*/
38#ifndef ACC_USER_H
39#define ACC_USER_H
40
41/*---------------------------------------------------------------------------*/
42/*------------------------------- definitions -------------------------------*/
43/*---------------------------------------------------------------------------*/
44
45#if defined(__cplusplus)
46extern "C" {
47#endif
48
49/*----------------------------- general defines -----------------------------*/
50
51#if !defined(ACCH)
52#ifndef WIN32
53typedef int *HANDLE;
54#endif
55typedef int *handle;
56#endif /* !defined(ACCH) */
57
58#ifndef PLI_EXTRAS
59#define PLI_EXTRAS 1
60#define bool int
61#define true 1
62#define TRUE 1
63#define false 0
64#define FALSE 0
65#endif /* PLI_EXTRAS */
66
67#define global extern
68#define exfunc
69#define local static
70#define null 0L
71
72/*------------------------------- object types ------------------------------*/
73#define accModule 20
74#define accScope 21
75#define accNet 25
76#define accReg 30
77#define accRegister accReg
78#define accPort 35
79#define accTerminal 45
80#define accInputTerminal 46
81#define accOutputTerminal 47
82#define accInoutTerminal 48
83#define accCombPrim 140
84#define accSeqPrim 142
85#define accAndGate 144
86#define accNandGate 146
87#define accNorGate 148
88#define accOrGate 150
89#define accXorGate 152
90#define accXnorGate 154
91#define accBufGate 156
92#define accNotGate 158
93#define accBufif0Gate 160
94#define accBufif1Gate 162
95#define accNotif0Gate 164
96#define accNotif1Gate 166
97#define accNmosGate 168
98#define accPmosGate 170
99#define accCmosGate 172
100#define accRnmosGate 174
101#define accRpmosGate 176
102#define accRcmosGate 178
103#define accRtranGate 180
104#define accRtranif0Gate 182
105#define accRtranif1Gate 184
106#define accTranGate 186
107#define accTranif0Gate 188
108#define accTranif1Gate 190
109#define accPullupGate 192
110#define accPulldownGate 194
111#define accIntegerParam 200
112#define accIntParam accIntegerParam
113#define accRealParam 202
114#define accStringParam 204
115#define accTchk 208
116#define accPrimitive 210
117#define accBit 212
118#define accPortBit 214
119#define accNetBit 216
120#define accRegBit 218
121#define accParameter 220
122#define accSpecparam 222
123#define accTopModule 224
124#define accModuleInstance 226
125#define accCellInstance 228
126#define accModPath 230
127#define accWirePath 234
128#define accInterModPath 236
129#define accScalarPort 250
130#define accBitSelectPort 252
131#define accPartSelectPort 254
132#define accVectorPort 256
133#define accConcatPort 258
134#define accWire 260
135#define accWand 261
136#define accWor 262
137#define accTri 263
138#define accTriand 264
139#define accTrior 265
140#define accTri0 266
141#define accTri1 267
142#define accTrireg 268
143#define accSupply0 269
144#define accSupply1 270
145#define accNamedEvent 280
146#define accEventVar accNamedEvent
147#define accIntegerVar 281
148#define accIntVar 281
149#define accRealVar 282
150#define accTimeVar 283
151#define accScalar 300
152#define accVector 302
153#define accExpandedVector 306
154#define accUnExpandedVector 307
155#define accProtected 308
156#define accSetup 366
157#define accHold 367
158#define accWidth 368
159#define accPeriod 369
160#define accRecovery 370
161#define accSkew 371
162#define accNochange 376
163#define accNoChange accNochange
164#define accSetuphold 377
165#define accInput 402
166#define accOutput 404
167#define accPassByRef 405
168#define accInout 406
169#define accMixedIo 407
170#define accPositive 408
171#define accNegative 410
172#define accUnknown 412
173#define accPathTerminal 420
174#define accPathInput 422
175#define accPathOutput 424
176#define accDataPath 426
177#define accTchkTerminal 428
178#define accBitSelect 500
179#define accPartSelect 502
180#define accTask 504
181#define accFunction 506
182#define accStatement 508
183#define accTaskCall 510
184#define accFunctionCall 512
185#define accSystemTask 514
186#define accSystemFunction 516
187#define accSystemRealFunction 518
188#define accUserTask 520
189#define accUserFunction 522
190#define accUserRealFunction 524
191#define accConstant 600
192#define accConcat 610
193#define accOperator 620
194#define accMinTypMax 696
195
196
197/*------------------ parameter values for acc_configure() -------------------*/
198#define accPathDelayCount 1
199#define accPathDelimStr 2
200#define accDisplayErrors 3
201#define accDefaultAttr0 4
202#define accToHiZDelay 5
203#define accEnableArgs 6
204#define accDisplayWarnings 8
205#define accDevelopmentVersion 11
206#define accMapToMipd 17
207#define accMinTypMaxDelays 19
208
209/*------------ edge information used by acc_handle_tchk(), etc. ------------*/
210#define accNoedge 0
211#define accNoEdge 0
212#define accEdge01 1
213#define accEdge10 2
214#define accEdge0x 4
215#define accEdgex1 8
216#define accEdge1x 16
217#define accEdgex0 32
218#define accPosedge 13
219#define accPosEdge accPosedge
220#define accNegedge 50
221#define accNegEdge accNegedge
222
223/*------------------------------- delay modes -------------------------------*/
224#define accDelayModeNone 0
225#define accDelayModePath 1
226#define accDelayModeDistrib 2
227#define accDelayModeUnit 3
228#define accDelayModeZero 4
229#define accDelayModeMTM 5
230
231/*------------ values for type field in t_setval_delay structure ------------*/
232#define accNoDelay 0
233#define accInertialDelay 1
234#define accTransportDelay 2
235#define accPureTransportDelay 3
236#define accForceFlag 4
237#define accReleaseFlag 5
238#define accAssignFlag 6
239#define accDeassignFlag 7
240
241/*------------ values for type field in t_setval_value structure ------------*/
242#define accBinStrVal 1
243#define accOctStrVal 2
244#define accDecStrVal 3
245#define accHexStrVal 4
246#define accScalarVal 5
247#define accIntVal 6
248#define accRealVal 7
249#define accStringVal 8
250#define accVectorVal 10
251
252/*------------------------------ scalar values ------------------------------*/
253#define acc0 0
254#define acc1 1
255#define accX 2
256#define accZ 3
257
258/*---------------------------- VCL scalar values ----------------------------*/
259#define vcl0 acc0
260#define vcl1 acc1
261#define vclX accX
262#define vclx accX
263#define vclZ accZ
264#define vclz accZ
265
266/*----------- values for vc_reason field in t_vc_record structure -----------*/
267#define logic_value_change 1
268#define strength_value_change 2
269#define real_value_change 3
270#define vector_value_change 4
271#define event_value_change 5
272#define integer_value_change 6
273#define time_value_change 7
274#define sregister_value_change 8
275#define vregister_value_change 9
276#define realtime_value_change 10
277#define compact_value_change 11
278
279/*--------------------------- VCL strength values ---------------------------*/
280#define vclSupply 7
281#define vclStrong 6
282#define vclPull 5
283#define vclLarge 4
284#define vclWeak 3
285#define vclMedium 2
286#define vclSmall 1
287#define vclHighZ 0
288
289/*----------------------- flags used with acc_vcl_add -----------------------*/
290
291#define vcl_verilog_logic 2
292#define VCL_VERILOG_LOGIC vcl_verilog_logic
293#define vcl_verilog_strength 3
294#define VCL_VERILOG_STRENGTH vcl_verilog_strength
295
296/*---------------------- flags used with acc_vcl_delete ---------------------*/
297
298#define vcl_verilog vcl_verilog_logic
299#define VCL_VERILOG vcl_verilog
300
301/*---------- values for the type field in the t_acc_time structure --------- */
302#define accTime 1
303#define accSimTime 2
304#define accRealTime 3
305
306/*------------------------------ product types ------------------------------*/
307#define accSimulator 1
308#define accTimingAnalyzer 2
309#define accFaultSimulator 3
310#define accOther 4
311
312
313/*---------------------------------------------------------------------------*/
314/*----------------------- global variable definitions -----------------------*/
315/*---------------------------------------------------------------------------*/
316
317#ifndef DLL_IMPORT
318# if defined(_MSC_VER)
319# define DLL_IMPORT __declspec(dllimport)
320# else
321# define DLL_IMPORT
322# endif
323#endif /* DLL_IMPORT */
324
325extern DLL_IMPORT bool acc_error_flag;
326typedef int (*consumer_function)();
327
328/*---------------------------------------------------------------------------*/
329/*-------------------------- structure definitions --------------------------*/
330/*---------------------------------------------------------------------------*/
331
332/*----------------- data structure used with acc_set_value() ----------------*/
333typedef struct t_acc_time
334{
335 int type;
336 int low,
337 high;
338 double real;
339} s_acc_time, *p_acc_time;
340
341/*----------------- data structure used with acc_set_value() ----------------*/
342typedef struct t_setval_delay
343{
344 s_acc_time time;
345 int model;
346} s_setval_delay, *p_setval_delay;
347
348/*--------------------- data structure of vector values ---------------------*/
349typedef struct t_acc_vecval
350{
351 int aval;
352 int bval;
353} s_acc_vecval, *p_acc_vecval;
354
355/*------ data structure used with acc_set_value() and acc_fetch_value() -----*/
356typedef struct t_setval_value
357{
358 int format;
359 union {
360 char *str;
361 int scalar;
362 int integer;
363 double real;
364 p_acc_vecval vector;
365 } value;
366} s_setval_value, *p_setval_value, s_acc_value, *p_acc_value;
367
368/*----------------------- structure for VCL strengths -----------------------*/
369typedef struct t_strengths
370{
371 unsigned char logic_value;
372 unsigned char strength1;
373 unsigned char strength2;
374} s_strengths, *p_strengths;
375
376/*--------------- structure passed to callback routine for VCL --------------*/
377typedef struct t_vc_record
378{
379 int vc_reason;
380 int vc_hightime;
381 int vc_lowtime;
382 char *user_data;
383 union {
384 unsigned char logic_value;
385 double real_value;
386 handle vector_handle;
387 s_strengths strengths_s;
388 } out_value;
389} s_vc_record, *p_vc_record;
390
391/*------------- structure used with acc_fetch_location() routine ------------*/
392typedef struct t_location
393{
394 int line_no;
395 char *filename;
396} s_location, *p_location;
397
398/*---------- structure used with acc_fetch_timescale_info() routine ---------*/
399typedef struct t_timescale_info
400{
401 short unit;
402 short precision;
403} s_timescale_info, *p_timescale_info;
404
405/*---------------------------------------------------------------------------*/
406/*-------------------------- routine declarations ---------------------------*/
407/*---------------------------------------------------------------------------*/
408
409#if defined(__STDC__) || defined(__cplusplus) || defined(_AIX)
410
411#ifndef PROTO_PARAMS
412#define PROTO_PARAMS(params) params
413#define DEFINED_PROTO_PARAMS
414#endif
415#ifndef EXTERN
416#define EXTERN
417#define DEFINED_EXTERN
418#endif
419
420#else
421
422#ifndef PROTO_PARAMS
423#define PROTO_PARAMS(params) (/* nothing */)
424#define DEFINED_PROTO_PARAMS
425#endif
426#ifndef EXTERN
427#define EXTERN extern
428#define DEFINED_EXTERN
429#endif
430
431#endif /* __STDC__ */
432
433EXTERN bool acc_append_delays PROTO_PARAMS((handle object, ...));
434EXTERN bool acc_append_pulsere PROTO_PARAMS((handle object, double val1r, double val1x, ...));
435EXTERN void acc_close PROTO_PARAMS((void));
436EXTERN handle *acc_collect PROTO_PARAMS((handle (*p_next_routine)(), handle scope_object, int *aof_count));
437EXTERN bool acc_compare_handles PROTO_PARAMS((handle h1, handle h2));
438EXTERN bool acc_configure PROTO_PARAMS((int item, char *value));
439EXTERN int acc_count PROTO_PARAMS((handle (*next_func)(), handle object_handle));
440EXTERN int acc_fetch_argc PROTO_PARAMS((void));
441EXTERN char **acc_fetch_argv PROTO_PARAMS((void));
442EXTERN double acc_fetch_attribute PROTO_PARAMS((handle object, ...));
443EXTERN int acc_fetch_attribute_int PROTO_PARAMS((handle object, ...));
444EXTERN char *acc_fetch_attribute_str PROTO_PARAMS((handle object, ...));
445EXTERN char *acc_fetch_defname PROTO_PARAMS((handle object_handle));
446EXTERN int acc_fetch_delay_mode PROTO_PARAMS((handle object_p));
447EXTERN bool acc_fetch_delays PROTO_PARAMS((handle object, ...));
448EXTERN int acc_fetch_direction PROTO_PARAMS((handle object_handle));
449EXTERN int acc_fetch_edge PROTO_PARAMS((handle acc_obj));
450EXTERN char *acc_fetch_fullname PROTO_PARAMS((handle object_handle));
451EXTERN int acc_fetch_fulltype PROTO_PARAMS((handle object_h));
452EXTERN int acc_fetch_index PROTO_PARAMS((handle object_handle));
453EXTERN double acc_fetch_itfarg PROTO_PARAMS((int n, handle tfinst));
454EXTERN int acc_fetch_itfarg_int PROTO_PARAMS((int n, handle tfinst));
455EXTERN char *acc_fetch_itfarg_str PROTO_PARAMS((int n, handle tfinst));
456EXTERN int acc_fetch_location PROTO_PARAMS((p_location location_p, handle object));
457EXTERN char *acc_fetch_name PROTO_PARAMS((handle object_handle));
458EXTERN int acc_fetch_paramtype PROTO_PARAMS((handle param_p));
459EXTERN double acc_fetch_paramval PROTO_PARAMS((handle param));
460EXTERN int acc_fetch_polarity PROTO_PARAMS((handle path));
461EXTERN int acc_fetch_precision PROTO_PARAMS((void));
462EXTERN bool acc_fetch_pulsere PROTO_PARAMS((handle path_p, double *val1r, double *val1e, ...));
463EXTERN int acc_fetch_range PROTO_PARAMS((handle node, int *msb, int *lsb));
464EXTERN int acc_fetch_size PROTO_PARAMS((handle obj_h));
465EXTERN double acc_fetch_tfarg PROTO_PARAMS((int n));
466EXTERN int acc_fetch_tfarg_int PROTO_PARAMS((int n));
467EXTERN char *acc_fetch_tfarg_str PROTO_PARAMS((int n));
468EXTERN void acc_fetch_timescale_info PROTO_PARAMS((handle obj, p_timescale_info aof_timescale_info));
469EXTERN int acc_fetch_type PROTO_PARAMS((handle object_handle));
470EXTERN char *acc_fetch_type_str PROTO_PARAMS((int type));
471EXTERN char *acc_fetch_value PROTO_PARAMS((handle object_handle, char *format_str, p_acc_value acc_value_p));
472EXTERN void acc_free PROTO_PARAMS((handle *array_ptr));
473EXTERN handle acc_handle_by_name PROTO_PARAMS((char *inst_name, handle scope_p));
474EXTERN handle acc_handle_condition PROTO_PARAMS((handle obj));
475EXTERN handle acc_handle_conn PROTO_PARAMS((handle term_p));
476EXTERN handle acc_handle_datapath PROTO_PARAMS((handle path));
477EXTERN handle acc_handle_hiconn PROTO_PARAMS((handle port_ref));
478EXTERN handle acc_handle_interactive_scope PROTO_PARAMS((void));
479EXTERN handle acc_handle_itfarg PROTO_PARAMS((int n, void *suena_inst));
480EXTERN handle acc_handle_loconn PROTO_PARAMS((handle port_ref));
481EXTERN handle acc_handle_modpath PROTO_PARAMS((handle mod_p, char *pathin_name, char *pathout_name, ...));
482EXTERN handle acc_handle_notifier PROTO_PARAMS((handle tchk));
483EXTERN handle acc_handle_object PROTO_PARAMS((char *inst_name, ...));
484EXTERN handle acc_handle_parent PROTO_PARAMS((handle object_p));
485EXTERN handle acc_handle_path PROTO_PARAMS((handle source, handle destination));
486EXTERN handle acc_handle_pathin PROTO_PARAMS((handle path_p));
487EXTERN handle acc_handle_pathout PROTO_PARAMS((handle path_p));
488EXTERN handle acc_handle_port PROTO_PARAMS((handle mod_handle, int port_num, ...));
489EXTERN handle acc_handle_scope PROTO_PARAMS((handle object));
490EXTERN handle acc_handle_simulated_net PROTO_PARAMS((handle net_h));
491EXTERN handle acc_handle_tchk PROTO_PARAMS((handle mod_p, int tchk_type, char *arg1_conn_name, int arg1_edgetype, ...));
492EXTERN handle acc_handle_tchkarg1 PROTO_PARAMS((handle tchk));
493EXTERN handle acc_handle_tchkarg2 PROTO_PARAMS((handle tchk));
494EXTERN handle acc_handle_terminal PROTO_PARAMS((handle gate_handle, int terminal_index));
495EXTERN handle acc_handle_tfarg PROTO_PARAMS((int n));
496EXTERN handle acc_handle_tfinst PROTO_PARAMS((void));
497EXTERN bool acc_initialize PROTO_PARAMS((void));
498EXTERN handle acc_next PROTO_PARAMS((int *type_list, handle h_scope, handle h_object));
499EXTERN handle acc_next_bit PROTO_PARAMS ((handle vector, handle bit));
500EXTERN handle acc_next_cell PROTO_PARAMS((handle scope, handle cell));
501EXTERN handle acc_next_cell_load PROTO_PARAMS((handle net_handle, handle load));
502EXTERN handle acc_next_child PROTO_PARAMS((handle mod_handle, handle child));
503EXTERN handle acc_next_driver PROTO_PARAMS((handle net, handle driver));
504EXTERN handle acc_next_hiconn PROTO_PARAMS((handle port, handle hiconn));
505EXTERN handle acc_next_input PROTO_PARAMS((handle path, handle pathin));
506EXTERN handle acc_next_load PROTO_PARAMS((handle net, handle load));
507EXTERN handle acc_next_loconn PROTO_PARAMS((handle port, handle loconn));
508EXTERN handle acc_next_modpath PROTO_PARAMS((handle mod_p, handle path));
509EXTERN handle acc_next_net PROTO_PARAMS((handle mod_handle, handle net));
510EXTERN handle acc_next_output PROTO_PARAMS((handle path, handle pathout));
511EXTERN handle acc_next_parameter PROTO_PARAMS((handle module_p, handle param));
512EXTERN handle acc_next_port PROTO_PARAMS((handle ref_obj_p, handle port));
513EXTERN handle acc_next_portout PROTO_PARAMS((handle mod_p, handle port));
514EXTERN handle acc_next_primitive PROTO_PARAMS((handle mod_handle, handle prim));
515EXTERN handle acc_next_scope PROTO_PARAMS((handle ref_scope_p, handle scope));
516EXTERN handle acc_next_specparam PROTO_PARAMS((handle module_p, handle sparam));
517EXTERN handle acc_next_tchk PROTO_PARAMS((handle mod_p, handle tchk));
518EXTERN handle acc_next_terminal PROTO_PARAMS((handle gate_handle, handle term));
519EXTERN handle acc_next_topmod PROTO_PARAMS((handle topmod));
520EXTERN bool acc_object_of_type PROTO_PARAMS((handle object, int type));
521EXTERN bool acc_object_in_typelist PROTO_PARAMS((handle object, int *type_list));
522EXTERN int acc_product_type PROTO_PARAMS((void));
523EXTERN char *acc_product_version PROTO_PARAMS((void));
524EXTERN int acc_release_object PROTO_PARAMS((handle obj));
525EXTERN bool acc_replace_delays PROTO_PARAMS((handle object, ...));
526EXTERN bool acc_replace_pulsere PROTO_PARAMS((handle object, double val1r, double val1x, ...));
527EXTERN void acc_reset_buffer PROTO_PARAMS((void));
528EXTERN bool acc_set_interactive_scope PROTO_PARAMS((handle scope, int callback_flag));
529EXTERN bool acc_set_pulsere PROTO_PARAMS((handle path_p, double val1r, double val1e));
530EXTERN char *acc_set_scope PROTO_PARAMS((handle object, ...));
531EXTERN int acc_set_value PROTO_PARAMS((handle obj, p_setval_value setval_p, p_setval_delay delay_p));
532EXTERN void acc_vcl_add PROTO_PARAMS((handle object_p, int (*consumer)(), char *user_data, int vcl_flags));
533EXTERN void acc_vcl_delete PROTO_PARAMS((handle object_p, int (*consumer)(), char *user_data, int vcl_flags));
534EXTERN char *acc_version PROTO_PARAMS((void));
535
536#ifdef DEFINED_PROTO_PARAMS
537# undef DEFINED_PROTO_PARAMS
538# undef PROTO_PARAMS
539#endif
540
541#ifdef DEFINED_EXTERN
542# undef DEFINED_EXTERN
543# undef EXTERN
544#endif
545
546/*---------------------------------------------------------------------------*/
547/*---------------------------- macro definitions ----------------------------*/
548/*---------------------------------------------------------------------------*/
549
550#define acc_handle_calling_mod_m acc_handle_parent((handle)tf_getinstance())
551
552
553#if defined(__cplusplus)
554} /* extern "C" */
555#endif
556
557#endif /* ACC_USER_H */