返回介绍

附录I sv_vpi_user.h

发布于 2020-09-09 22:56:17 字数 18355 浏览 941 评论 0 收藏 0

sv_vpi_user.h

/***************************************************************************
* sv_vpi_user.h
*
* Accellera SystemVerilog VPI extensions.
*
* This file contains the constant definitions, structure definitions, and
* routine declarations used by the Verilog PLI procedural interface VPI
* access routines.
*
**************************************************************************/

/***************************************************************************
* NOTE: The constant values 600 through 999 are reserved for use in this
* sv_vpi_user.h file. The range 800 through 899 is reserved for the reader
* VPI
**************************************************************************/

#ifndef SV_VPI_USER_H
#define SV_VPI_USER_H

#include <vpi_user.h>

#ifdef __cplusplus
extern "C" {
#endif
}

/****************************** OBJECT TYPES ******************************/
#define vpiPackage                600
#define vpiInterface              601
#define vpiProgram                602
#define vpiInterfaceArray         603
#define vpiProgramArray           604
#define vpiTypespec               605
#define vpiModport                606
#define vpiInterfaceTfDecl        607
#define vpiRefObj                 608
#define vpiVarBitVar              vpiRegBit
#define vpiLongIntVar             609
#define vpiShortIntVar            610
#define vpiIntVar                 611
#define vpiShortRealVar           612
#define vpiByteVar                613
#define vpiClassVar               614
#define vpiStringVar              615
#define vpiEnumVar                616
#define vpiStructVar              617
#define vpiUnionVar               618
#define vpiBitVar                 619
#define vpiLogicVar               vpiRegVar
#define vpiArrayVar               vpiRegArray
#define vpiLongIntTypespec        620
#define vpiShortRealTypespec      621
#define vpiByteTypespec           622
#define vpiShortIntTypespec       623
#define vpiIntTypespec            624
#define vpiClassTypespec          625
#define vpiStringTypespec         626
#define vpiVarBitTypespec         627
#define vpiEnumTypespec           628
#define vpiEnumConst              629
#define vpiIntegerTypespec        630
#define vpiTimeTypespec           631
#define vpiRealTypespec           632
#define vpiStructTypespec         633
#define vpiUnionTypespec          634
#define vpiBitTypespec            635
#define vpiLogicTypespec          636
#define vpiArrayTypespec          637
#define vpiVoidTypespec           638
#define vpiMemberTypespec         639
#define vpiClockingBlock          640
#define vpiClockingIODecl         641
#define vpiClassDefn              642
#define vpiConstraint             643
#define vpiConstraintOrdering     644
#define vpiDistItem               645
#define vpiAliasStmt              646
#define vpiThread                 647
#define vpiMethodFuncCall         648
#define vpiMethodTaskCall         649
#define vpiAssertProperty         650
#define vpiAssumeProperty         651
#define vpiCoverProperty          652
#define vpiDisableCondition       653
#define vpiClockingEvent          654
#define vpiPropertyDecl           655
#define vpiPropertySpec           656
#define vpiPropertyExpr           657
#define vpiMulticlockSequenceExpr 658
#define vpiClockedSeq             659
#define vpiPropertyInst           660
#define vpiSequenceDecl           661
#define vpiSequenceSpec           662
#define vpiActualArgExpr          663
#define vpiSequenceInst           664
#define vpiImmediateAssert        665
#define vpiReturn                 666
#define vpiAnyPattern             667
#define vpiTaggedPattern          668
#define vpiStructPattern          669
#define vpiDoWhile                670
#define vpiOrderedWait            671
#define vpiWaitFork               672
#define vpiDisableFork            673
#define vpiExpectStmt             674
#define vpiForeachStmt            675
#define vpiFinal                  676
#define vpiExtend                 677
#define vpiDistribution           678
#define vpiIdentifier             679

/******************************** METHODS *********************************/
/************* methods used to traverse 1 to 1 relationships **************/
#define vpiActual                 680
#define vpiTypedefAlias           681
#define vpiIndexTypespec          682
#define vpiBaseTypespec           683
#define vpiElemTypespec           684
#define vpiDefInputSkew           685
#define vpiDefOutputSkew          686
#define vpiClockingSkew           687
#define vpiActualDefn             688
#define vpiLhs                    689
#define vpiRhs                    690
#define vpiOrigin                 691
#define vpiPrefix                 692
#define vpiWith                   693
#define vpiProperty               694
#define vpiValueRange             695
#define vpiPattern                696
#define vpiWeight                 697

/************ methods used to traverse 1 to many relationships ************/
#define vpiTypedef                698
#define vpiImport                 699
#define vpiDerivedClasses         700
#define vpiMethods                701
#define vpiSolveBefore            702
#define vpiSolveAfter             703
#define vpiWaitingProcesses       704
#define vpiMessages               705
#define vpiMembers                706
#define vpiLoopVars               707
#define vpiConcurrentAssertions   708
#define vpiMatchItem              709

/************ methods both 1-1 and 1-many relations ***********************/
#define vpiInstance               710

/************************ generic object properties ***********************/
#define vpiTop                    600
#define vpiUnit                   601
#define vpiAccessType             602
#define vpiForkJoinAcc            1
#define vpiExternAcc              2
#define vpiDPIExternAcc           3
#define vpiDPIImportAcc           4
#define vpiArrayType              603
#define vpiStaticArray            1
#define vpiDynamicArray           2
#define vpiAssocArray             3
#define vpiQueueArray             4
#define vpiIsRandomized           604
#define vpiRandType               605
#define vpiNotRand                1
#define vpiRand                   2
#define vpiRandC                  3
#define vpiConstantVariable       606
#define vpiMember                 607
#define vpiVisibility             608
#define vpiPublicVis              1
#define vpiProtectedVis           2
#define vpiLocalVis               3
#define vpiPacked                 609
#define vpiTagged                 610
#define vpiRef                    611
#define vpiDefaultSkew            612
#define vpiVirtual                613
#define vpiUserDefined            614
#define vpiIsConstraintEnabled    615
#define vpiClassType              616
#define vpiMailboxClass           1
#define vpiSemaphoreClass         2
#define vpiUserDefineClass        3
#define vpiMethod                 617
#define vpiValid                  618
#define vpiActive                 619
#define vpiIsClockInferred        620
#define vpiQualifier              621
#define vpiUniqueQualifier        1
#define vpiPriorityQualifier      2
#define vpiTaggedQualifier        3
#define vpiNullConst              622
#define vpiOneStepConst           623
#define vpiAlwaysType             624
#define vpiAlwaysComb             1
#define vpiAlwaysFF               2
#define vpiAlwaysLatch            3
#define vpiDistType               625
#define vpiEqualDist              1   /* constraint equal distribution */
#define vpiDivDist                2   /* constraint divided distribution */

/******************************** Operators *******************************/
#define vpiImplyOp                50  /* -> implication operator */
#define vpiNonOverlapImplyOp      51  /* |=> non-overlapped implication */
#define vpiOverlapImplyOp         52  /* |-> overlapped implication operator */
#define vpiUnaryCycleDelayOp      53  /* binary cycle delay (##) operator */
#define vpiCycleDelayOp           54  /* binary cycle delay (##) operator */
#define vpiIntersectOp            55  /* intersection operator */
#define vpiFirstMatchOp           56  /* first_match operator */
#define vpiThroughoutOp           57  /* throught operator */
#define vpiWithinOp               58  /* within operator */
#define vpiRepeatOp               59  /* [=] non-consecutive repetition */
#define vpiConsecutiveRepeatOp    60  /* [*] consecutive repetition */
#define vpiGotoRepeatOp           61  /* [->] goto repetition */
#define vpiPostIncOp              62  /* ++ post-increment */
#define vpiPreIncOp               63  /* ++ pre-increment */
#define vpiPostDecOp              64  /* -- post-decrement */
#define vpiPreDecOp               65  /* -- pre-decrement */
#define vpiMatchOp                66  /* match() operator */
#define vpiCastOp                 67  /* type‘() operator */
#define vpiIffOp                  68  /* iff operator */
#define vpiWildEqOp               69  /* =?= operator */
#define vpiWildNeqOp              70  /* !?= operator */
#define vpiStreamLROp             71  /* left-to-right streaming {>>} operator */
#define vpiStreamRLOp             72  /* right-to-left streaming {<<} operator */
#define vpiMatchedOp              73  /* the .matched sequence operation */
#define vpiEndedOp                74  /* the .ended sequence operation */

/************************** STRUCTURE DEFINITIONS *************************/
/***************************** structure *****************************/
/**************************** CALLBACK REASONS ****************************/
#define cbStartOfThread           600 /* callback on thread creation */
#define cbEndOfThread             601 /* callback on thread termination */
#define cbEnterThread             602 /* callback on re-entering thread */
#define cbStartOfFrame            603 /* callback on frame creation */
#define cbEndOfFrame              604 /* callback on frame exit */
#define cbTypeChange              605 /* callback on variable type/size change */

/************************* FUNCTION DECLARATIONS **************************/
/**************************************************************************/
/**************************************************************************/
/*************************** Coverage VPI *********************************/
/* coverage control */
#define vpiCoverageStart          711
#define vpiCoverageStop           712
#define vpiCoverageReset          713
#define vpiCoverageCheck          714
#define vpiCoverageMerge          715
#define vpiCoverageSave           716

/* coverage type properties */
#define vpiAssertCoverage         717
#define vpiFsmStateCoverage       718
#define vpiStatementCoverage      719
#define vpiToggleCoverage         720

/* Coverage status properties */
#define vpiCovered                721
#define vpiCoverMax               722
#define vpiCoveredCount           723

/* Assertion-specific coverage status properties */
#define vpiAssertAttemptCovered   724
#define vpiAssertSuccessCovered   725
#define vpiAssertFailureCovered   726

/* FSM-specific coverage status properties */
#define vpiFsmStates              727
#define vpiFsmStateExpression     728

/* FSM handle types */
#define vpiFsm                    729
#define vpiFsmHandle              730

/***************************************************************************/
/***************************************************************************/
/***************************** Assertion VPI *******************************/
/* assertion types */
#define vpiSequenceType           731
#define vpiAssertType             732
#define vpiCoverType              733
#define vpiPropertyType           734
#define vpiImmediateAssertType    735

/* assertion callback types */
#define cbAssertionStart          606
#define cbAssertionSuccess        607
#define cbAssertionFailure        608
#define cbAssertionStepSuccess    609
#define cbAssertionStepFailure    610
#define cbAssertionDisable        611
#define cbAssertionEnable         612
#define cbAssertionReset          613
#define cbAssertionKill           614
#define cbAssertionSysInitialized 615
#define cbAssertionSysStart       616
#define cbAssertionSysStop        617
#define cbAssertionSysEnd         618
#define cbAssertionSysReset       619

/* Assertion control constants */
#define vpiAssertionDisable       620
#define vpiAssertionEnable        621
#define vpiAssertionReset         622
#define vpiAssertionKill          623
#define vpiAssertionEnableStep    624
#define vpiAssertionDisableStep   625
#define vpiAssertionClockSteps    626
#define vpiAssertionSysStart      627
#define vpiAssertionSysStop       628
#define vpiAssertionSysEnd        629
#define vpiAssertionSysReset      630

/* Assertion related structs and types */
typedef struct t_vpi_source_info {
    PLI_BYTE8 *fileName;
    PLI_INT32 startLine;
    PLI_INT32 startColumn;
    PLI_INT32 endLine;
    PLI_INT32 endColumn;
} s_vpi_source_info, *p_vpi_source_info;

typedef struct t_vpi_assertion_info {
    PLI_BYTE8 *assertName;   /* name of assertion */
    vpiHandle instance;      /* instance containing assertion */
    PLI_BYTE8 defname;       /* name of module/interface containing the assertion */
    vpiHandle clock;         /* clocking expression */
    PLI_INT32 assertionType; /* vpiSequenceType, vpiAssertType,
                                vpiCoverType, vpiPropertyType,
                                vpiImmediateAssertType */
    s_vpi_source_info sourceInfo;
} s_vpi_assertion_info, *p_vpi_assertion_info;

typedef struct t_vpi_assertion_step_info {
    PLI_INT32 matched_expression_count;
    vpiHandle *matched_exprs;             /* array of expressions */
    p_vpi_source_info *exprs_source_info; /* array of source info */
    PLI_INT32 stateFrom, stateTo;         /* identify transition */
} s_vpi_assertion_step_info, *p_vpi_assertion_step_info;

typedef struct t_vpi_attempt_info {
    union {
        vpiHandle failExpr;
        p_vpi_assertion_step_info step;
    } detail;
    s_vpi_time attemptStartTime; /* Time attempt triggered */
} s_vpi_attempt_info, *p_vpi_attempt_info;

/* typedef for vpi_register_assertion_cb callback function */
typedef PLI_INT32 (vpi_assertion_callback_func)(
    PLI_INT32 reason,        /* callback reason */
    p_vpi_time cb_time,      /* callback time */
    vpiHandle assertion,     /* handle to assertion */
    p_vpi_attempt_info info, /* attempt related information */
    PLI_BYTE8 *user_data     /* user data entered upon registration */
);

/* assertion specific VPI functions */
PLI_INT32 vpi_get_assertion_info (assert_handle, p_vpi_assertion_info);

vpiHandle vpi_register_assertion_cb(
    vpiHandle assertion, /* handle to assertion */
    PLI_INT32 reason,    /* reason for which callbacks needed */
    vpi_assertion_callback_func *cb_rtn,
    PLI_BYTE8 *user_data /* user data to be supplied to cb */
);

/***************************************************************************/
/***************************************************************************/
/*************** Reader VPI ***********************/
/* reader VPI has been assigned the numeric range 800-899 */
/********** Reader types ***********/
#define vpiTrvsObj                800 /* Data traverse object */
#define vpiCollection             810 /* Collection of VPI handle */
#define vpiObjCollection          811 /* Collection of traversable design objs */
#define vpiTrvsCollection         812 /* Collection of vpiTrvsObjs */

/********* Reader methods *********/
/* Check */
#define vpiIsLoaded               820 /* Object data is loaded check */
#define vpiHasDataVC              821 /* Traverse object has at least one VC
                                       * at some point in time in the
                                       * database check */
#define vpiHasVC                  822 /* Has VC at specific time check */
#define vpiHasNoValue             823 /* Has no value at specific time check */
#define vpiBelong                 824 /* Belongs to extension check */

/* Access */
#define vpiAccessLimitedInteractive 830 /* Interactive access */
#define vpiAccessInteractive        831 /* interactive with history access */
#define vpiAccessPostProcess        832 /* Database access */

/* Member of a collection */
#define vpiMember                   840 /* Member of a collection */

/* Iteration on instances for loaded */
#define vpiDataLoaded               850 /* Use in vpi_iterate() */

/* Control Traverse/Check Time */
#define vpiMinTime                  860 /* Min time */
#define vpiMaxTime                  864 /* Max time */
#define vpiPrevVC                   868 /* Previous Value Change (VC) */
#define vpiNextVC                   870 /* Next Value Change (VC) */
#define vpiTime                     874 /* Time jump */

/********** routines **********/

/* general form of the vpi extension loading function is:
* PLI_INT32 vpi_load_extension PROTO_PARAMS((PLI_BYTE8 *extension_name, ...))
*/

/********** Reader routines **********/
/* load extension form for the reader extension */
PLI_INT32 vpi_load_extension PROTO_PARAMS((PLI_BYTE8 *extension_name,
                                           PLI_BYTE8 *name,
                                           vpiType mode, ...))

PLI_INT32 vpi_close PROTO_PARAMS((PLI_INT32 tool,
                                  vpiType prop,
                                  PLI_BYTE8* name));

PLI_INT32 vpi_load_init PROTO_PARAMS((vpiHandle objCollection,
                                      vpiHandle scope,
                                      PLI_INT32 level));

PLI_INT32 vpi_load PROTO_PARAMS((vpiHandle h));

PLI_INT32 vpi_unload PROTO_PARAMS((vpiHandle h));

vpiHandle vpi_create PROTO_PARAMS((vpiType prop,
                                   vpiHandle h,
                                   vpiHandle obj));

vpiHandle vpi_goto PROTO_PARAMS((vpiType prop,
                                 vpiHandle obj,
                                 p_vpi_time time_p,
                                 PLI_INT32 *ret_code));

vpiHandle vpi_filter PROTO_PARAMS((vpiHandle h,
                                   PLI_INT32 ft,
                                   PLI_INT32 flag));

#ifdef __cplusplus
}
#endif

#endif

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文