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