- 第一章 SystemVerilog导论
- 第二章 文本值
- 第三章 数据类型
- 第四章 数组
- 第五章 数据声明
- 第六章 属性
- 第七章 操作符与表达式
- 第八章 过程语句和控制流
- 第九章 进程
- 第十章 任务与函数
- 第十一章 类
- 第十二章 随机约束
- 第十三章 进程间的同步与通信
- 第十四章 调度语义
- 第十五章 时钟控制块
- 第十六章 程序块
- 第十七章 断言
- 第十八章 层次
- 第十九章 接口
- 第二十章 覆盖
- 第二十一章 参数
- 第二十二章 配置库
- 第二十三章 系统任务与系统函数
- 23.1 简介(一般信息)
- 23.2 确立时的typeof函数
- 23.3 typename函数
- 23.4 表达式尺寸系统函数
- 23.5 范围系统函数
- 23.6 Shortreal转换
- 23.7 数组查询系统函数
- 23.8 断言严重性系统任务
- 23.9 断言控制系统任务
- 23.10 断言系统函数
- 23.11 随机数系统函数
- 23.12 程序控制
- 23.13 覆盖系统函数
- 23.14 对Verilog-2001系统任务的增强
- 23.15 $readmemb与$readmemh
- 23.16 $writememb and $writememh
- 23.17 File format considerations for multi-dimensional unpacked arrays
- 23.18 System task arguments for multi-dimensional unpacked arrays
- 第二十四章 VCD数据
- 第二十五章 编译器指令
- 第二十六章 考虑从SystemVerilog中删除的功能
- 第二十七章 直接编程接口(DPI)
- 27.1 概述
- 27.2 Two layers of the DPI
- 27.3 Global name space of imported and exported functions
- 27.4 导入的任务和函数
- 27.5 Calling imported functions
- 27.6 Exported functions
- 27.7 Exported tasks
- 27.8 Disabling DPI tasks and functions
- 第二十八章 SystemVerilog断言API
- 第二十九章 SystemVerilog覆盖API
- 29.1 需求
- 29.2 SystemVerilog real-time coverage access
- 29.3 FSM recognition
- 29.3.1 Specifying the signal that holds the current state
- 29.3.2 Specifying the part-select that holds the current state
- 29.3.3 Specifying the concatenation that holds the current state
- 29.3.4 Specifying the signal that holds the next state
- 29.3.5 Specifying the current and next state signals in the same declaration
- 29.3.6 Specifying the possible states of the FSM
- 29.3.7 Pragmas in one-line comments
- 29.3.8 Example
- 29.4 VPI coverage extensions
- 第三十章 SystemVerilog数据读API
- 30.1 简介(一般信息)
- 30.2 需求
- 30.3 Extensions to VPI enumerations
- 30.4 VPI object type additions
- 30.5 Object model diagrams
- 30.6 Usage extensions to VPI routines
- 30.7 VPI routines added in SystemVerilog
- 30.8 Reading data
- 30.9 Optionally unloading the data
- 30.10 Reading data from multiple databases and/or different read library providers
- 30.11 VPI routines extended in SystemVerilog
- 30.12 VPI routines added in SystemVerilog
- 30.12.1 VPI reader routines
- 第三十一章 SystemVerilog VPI Object Model
- 31.1 简介(一般信息)
- 31.2 Instance
- 31.3 Interface
- 31.4 Program
- 31.5 Module (supersedes IEEE 1364-2001 26.6.1)
- 31.6 Modport
- 31.7 Interface tf decl
- 31.8 Ports (supersedes IEEE 1364-2001 26.6.5)
- 31.9 Ref Obj
- 31.9.1 Examples
- 31.10 Variables (supersedes IEEE 1364-2001 section 26.6.8)
- 31.11 Var Select (supersedes IEEE 1364-2001 26.6.8)
- 31.12 Typespec
- 31.13 Variable Drivers and Loads (supersedes IEEE 1364-2001 26.6.23)
- 31.14 Instance Arrays (supersedes IEEE 1364-2001 26.6.2)
- 31.15 Scope (supersedes IEEE 1364-2001 26.6.3)
- 31.16 IO Declaration (supersedes IEEE 1364-2001 26.6.4)
- 31.17 Clocking Block
- 31.18 Class Object Definition
- 31.19 Constraint, constraint ordering, distribution,
- 31.20 Constraint expression
- 31.21 Class Variables
- 31.22 Structure/Union
- 31.23 Named Events (supersedes IEEE 1364-2001 26.6.11)
- 31.24 Task, Function Declaration (supersedes IEEE 1364-2001 26.6.18)
- 31.25 Alias Statement
- 31.25.1 Examples
- 31.26 Frames (supersedes IEEE 1364-2001 26.6.20)
- 31.27 Threads
- 31.28 tf call (supersedes IEEE 1364-2001 26.6.19)
- 31.29 Module path, path term (supersedes IEEE 1364-2001 26.6.15)
- 31.30 Concurrent assertions
- 31.31 Property Decl
- 31.32 Property Specification
- 31.33 Multiclock Sequence Expression
- 31.34 Sequence Declaration
- 31.35 Sequence Expression
- 31.36 Attribute (supersedes IEEE 1364-2001 26.6.42)
- 31.37 Atomic Statement (supersedes IEEE 1364-2001 26.6.27)
- 31.38 If, if else, return, case, do while (supersedes IEEE 1364-2001 26.6.35, 26.6.36)
- 31.39 waits, disables, expect, foreach (supersedes IEEE 1364 26.6.38)
- 31.40 Simple expressions (supersedes IEEE 1364-2001 26.6.25)
- 31.41 Expressions (supersedes IEEE 1364-2001 26.6.26)
- 31.42 Event control (supersedes IEEE 1364-2001 26.6.30)
- 31.43 Event stmt (supersedes IEEE 1364-2001 26.6.27)
- 31.44 Process (supersedes IEEE 1364-2001 26.6.27)
- 31.45 Assignment (supersedes IEEE 1364-2001 26.6.28)
- 附录A 形式语法
- A.1 源文本
- A.2 声明
- A.3 Primitive instances
- A.4 Module, interface and generated instantiation
- A.5 UDP declaration and instantiation
- A.6 Behavioral statements
- A.6.1 Continuous assignment and net alias statements
- A.6.2 Procedural blocks and assignments
- A.6.3 Parallel and sequential blocks
- A.6.4 Statements
- A.6.5 Timing control statements
- A.6.6 Conditional statements
- A.6.7 Case statements
- A.6.8 Looping statements
- A.6.9 Subroutine call statements
- A.6.10 Assertion statements
- A.6.11 Clocking block
- A.6.12 Randsequence
- A.7 Specify section
- A.8 Expressions
- A.9 General
- A.10 Footnotes (normative)
- 附录B 关键字
- 附录C 标准包
- 附录D 链表
- 附录E DPI C-layer
- E.1 概述
- E.2 Naming conventions
- E.3 Portability
- E.4 Include files
- E.5 Semantic constraints
- E.6 Data types
- E.7 Argument passing modes
- E.8 Context tasks and functions
- E.9 Include files
- E.10 Arrays
- E.11 Open arrays
- E.11.1 Actual ranges
- E.11.2 Array querying functions
- E.11.3 Access functions
- E.11.4 Access to the actual representation
- E.11.5 Access to elements via canonical representation
- E.11.6 Access to scalar elements (bit and logic)
- E.11.7 Access to array elements of other types
- E.11.8 Example 4— two-dimensional open array
- E.11.9 Example 5 — open array
- E.11.10 Example 6 — access to packed arrays
- E.11.11 Example 7 — binary compatible calls of exported functions
- 附录F 包含文件
- 附录G 包含外部语言代码
- 附录H 并发断言的形式语义
- 附录I svvpiuser.h
- 附录J 术语表
- 附录K 参考书目
- 其他
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
F.1 Binary-level compatibility include file svdpi.h
/* canonical representation */ #define sv_0 0 #define sv_1 1 #define sv_z 2 /* representation of 4-st scalar z */ #define sv_x 3 /* representation of 4-st scalar x */ /* common type for ’bit’ and ’logic’ scalars. */ typedef unsigned char svScalar; typedef svScalar svBit; /* scalar */ typedef svScalar svLogic; /* scalar */ /* Canonical representation of packed arrays */ /* 2-state and 4-state vectors, modelled upon PLI’s avalue/bvalue */ #define SV_CANONICAL_SIZE(WIDTH) (((WIDTH)+31)>>5) typedef unsigned int svBitVec32; /* (a chunk of) packed bit array */ typedef struct { unsigned int c; unsigned int d;} svLogicVec32; /* (a chunk of) packed logic array */ /* Since the contents of the unused bits is undetermined, the following macros can be handy */ #define SV_MASK(N) (~(-1<<(N))) #define SV_GET_UNSIGNED_BITS(VALUE,N)\ ((N)==32?(VALUE):((VALUE)&SV_MASK(N))) #define SV_GET_SIGNED_BITS(VALUE,N)\ ((N)==32?(VALUE):\ (((VALUE)&(1<<((N)1)))?((VALUE)|~SV_MASK(N)):((VALUE)&SV_MASK(N)))) /* implementation-dependent representation */ /* a handle to a scope (an instance of a module or interface) */ typedef void* svScope; /* a handle to a generic object (actually, unsized array) */ typedef void* svOpenArrayHandle; /* reference to a standalone packed array */ typedef void* svBitPackedArrRef; typedef void* svLogicPackedArrRef; /* total size in bytes of the simulator’s representation of a packed array */ /* width in bits */ int svSizeOfBitPackedArr(int width); int svSizeOfLogicPackedArr(int width); /* Translation between the actual representation and canonical representation */ /* functions for translation between the representation actually used by simulator and the canonical representation */ /* s=source, d=destination, w=width */ /* actual <-- canonical */ void svPutBitVec32 (svBitPackedArrRef d, const svBitVec32* s, int w); void svPutLogicVec32 (svLogicPackedArrRef d, const svLogicVec32* s, int w); /* canonical <-- actual */ void svGetBitVec32 (svBitVec32* d, const svBitPackedArrRef s, int w); void svGetLogicVec32 (svLogicVec32* d, const svLogicPackedArrRef s, int w); /* Bit selects */ /* Packed arrays are assumed to be indexed n-1:0, where 0 is the index of least significant bit */ /* functions for bit select */ /* s=source, i=bit-index */ svBit svGetSelectBit(const svBitPackedArrRef s, int i); svLogic svGetSelectLogic(const svLogicPackedArrRef s, int i); /* d=destination, i=bit-index, s=scalar */ void svPutSelectBit(svBitPackedArrRef d, int i, svBit s); void svPutSelectLogic(svLogicPackedArrRef d, int i, svLogic s); /* * functions for part select * * a narrow (<=32 bits) part select is copied between * the implementation representation and a single chunk of * canonical representation * Normalized ranges and indexing [n-1:0] are used for both arrays: * the array in the implementation representation and the canonical array. * * s=source, d=destination, i=starting bit index, w=width * like for variable part selects; limitations: w <= 32 * * In part select operations, the data is copied to or from the * canonical representation part (’chunk’) designated by range [w-1:0] * and the implementation representation part designated by range [w+i-1:i]. */ /* canonical <-- actual */ void svGetPartSelectBit(svBitVec32* d, const svBitPackedArrRef s, int i, int w); svBitVec32 svGetBits(const svBitPackedArrRef s, int i, int w); svBitVec32 svGet32Bits(const svBitPackedArrRef s, int i); // 32-bits unsigned long long svGet64Bits(const svBitPackedArrRef s, int i); // 64-bits void svGetPartSelectLogic(svLogicVec32* d, const svLogicPackedArrRef s, int i, int w); /* actual <-- canonical */ void svPutPartSelectBit(svBitPackedArrRef d, const svBitVec32 s, int i, int w); void svPutPartSelectLogic(svLogicPackedArrRef d, const svLogicVec32 s, int i, int w); /* Array querying functions */ /* These functions are modelled upon the SystemVerilog array querying functions and use the same semantics*/ /* If the dimension is 0, then the query refers to the packed part (which is onedimensional) of an array, and dimensions > 0 refer to the unpacked part of an array.*/ /* h= handle to open array, d=dimension */ int svLeft(const svOpenArrayHandle h, int d); int svRight(const svOpenArrayHandle h, int d); int svLow(const svOpenArrayHandle h, int d); int svHigh(const svOpenArrayHandle h, int d); int svIncrement(const svOpenArrayHandle h, int d); int svLength(const svOpenArrayHandle h, int d); int svDimensions(const svOpenArrayHandle h); /* a pointer to the actual representation of the whole array of any type */ /* NULL if not in C layout */ void *svGetArrayPtr(const svOpenArrayHandle); int svSizeOfArray(const svOpenArrayHandle); /* total size in bytes or 0 if not in C layout */ /* Return a pointer to an element of the array or NULL if index outside the range or null pointer */ void *svGetArrElemPtr(const svOpenArrayHandle, int indx1, ...); /* specialized versions for 1-, 2- and 3-dimensional arrays: */ void *svGetArrElemPtr1(const svOpenArrayHandle, int indx1); void *svGetArrElemPtr2(const svOpenArrayHandle, int indx1, int indx2); void *svGetArrElemPtr3(const svOpenArrayHandle, int indx1, int indx2, int indx3); /* Functions for translation between simulator and canonical representations*/ /* These functions copy the whole packed array in either direction. The user is responsible for allocating an array in the canonical representation. */ /* s=source, d=destination */ /* actual <-- canonical */ void svPutBitArrElemVec32 (const svOpenArrayHandle d, const svBitVec32* s, int indx1, ...); void svPutBitArrElem1Vec32(const svOpenArrayHandle d, const svBitVec32* s, int indx1); void svPutBitArrElem2Vec32(const svOpenArrayHandle d, const svBitVec32* s, int indx1, int indx2); void svPutBitArrElem3Vec32(const svOpenArrayHandle d, const svBitVec32* s, int indx1, int indx2, int indx3); void svPutLogicArrElemVec32 (const svOpenArrayHandle d, const svLogicVec32* s, int indx1, ...); void svPutLogicArrElem1Vec32(const svOpenArrayHandle d, const svLogicVec32* s, int indx1); void svPutLogicArrElem2Vec32(const svOpenArrayHandle d, const svLogicVec32* s, int indx1, int indx2); void svPutLogicArrElem3Vec32(const svOpenArrayHandle d, const svLogicVec32* s, int indx1, int indx2, int indx3); /* canonical <-- actual */ void svGetBitArrElemVec32 (svBitVec32* d, const svOpenArrayHandle s, int indx1, ...); void svGetBitArrElem1Vec32(svBitVec32* d, const svOpenArrayHandle s, int indx1); void svGetBitArrElem2Vec32(svBitVec32* d, const svOpenArrayHandle s, int indx1, int indx2); void svGetBitArrElem3Vec32(svBitVec32* d, const svOpenArrayHandle s, int indx1, int indx2, int indx3); void svGetLogicArrElemVec32 (svLogicVec32* d, const svOpenArrayHandle s, int indx1, ...); void svGetLogicArrElem1Vec32(svLogicVec32* d, const svOpenArrayHandle s, int indx1); void svGetLogicArrElem2Vec32(svLogicVec32* d, const svOpenArrayHandle s, int indx1, int indx2); void svGetLogicArrElem3Vec32(svLogicVec32* d, const svOpenArrayHandle s, int indx1, int indx2, int indx3); svBit svGetBitArrElem (const svOpenArrayHandle s, int indx1, ...); svBit svGetBitArrElem1(const svOpenArrayHandle s, int indx1); svBit svGetBitArrElem2(const svOpenArrayHandle s, int indx1, int indx2); svBit svGetBitArrElem3(const svOpenArrayHandle s, int indx1, int indx2, int indx3); svLogic svGetLogicArrElem (const svOpenArrayHandle s, int indx1, ...); svLogic svGetLogicArrElem1(const svOpenArrayHandle s, int indx1); svLogic svGetLogicArrElem2(const svOpenArrayHandle s, int indx1, int indx2); svLogic svGetLogicArrElem3(const svOpenArrayHandle s, int indx1, int indx2, int indx3); void svPutLogicArrElem (const svOpenArrayHandle d, svLogic value, int indx1, ...); void svPutLogicArrElem1(const svOpenArrayHandle d, svLogic value, int indx1); void svPutLogicArrElem2(const svOpenArrayHandle d, svLogic value, int indx1, int indx2); void svPutLogicArrElem3(const svOpenArrayHandle d, svLogic value, int indx1, int indx2, int indx3); void svPutBitArrElem (const svOpenArrayHandle d, svBit value, int indx1, ...); void svPutBitArrElem1(const svOpenArrayHandle d, svBit value, int indx1); void svPutBitArrElem2(const svOpenArrayHandle d, svBit value, int indx1, int indx2); void svPutBitArrElem3(const svOpenArrayHandle d, svBit value, int indx1, int indx2, int indx3); /* Functions for working with DPI context functions */ /* Retrieve the active instance scope currently associated with the executing imported function. Unless a prior call to svSetScope has occurred, this is the scope of the function’s declaration site, not call site. Returns NULL if called from C code that is *not* an imported function. */ svScope svGetScope(); /* Set context for subsequent export function execution. This function must be called before calling an export function, unless the export function is called while executing an extern function. In that case the export function shall inherit the scope of the surrounding extern function. This is known as the "default scope". The return is the previous active scope (as per svGetScope) */ svScope svSetScope(const svScope scope); /* Gets the fully qualified name of a scope handle */ const char* svGetNameFromScope(const svScope); /* Retrieve svScope to instance scope of an arbitrary function declaration. * (can be either module, program, interface, or generate scope) * The return value shall be NULL for unrecognized scope names. */ svScope svGetScopeFromName(const char* scopeName); /* Store an arbitrary user data pointer for later retrieval by svGetUserData() * The userKey is generated by the user. It must be guaranteed by the user to * be unique from all other userKey’s for all unique data storage requirements * It is recommended that the address of static functions or variables in the * user’s C code be used as the userKey. * It is illegal to pass in NULL values for either the scope or userData * arguments. It is also an error to call svPutUserData() with an invalid * svScope. This function returns -1 for all error cases, 0 upon success. It is * suggested that userData values of 0 (NULL) not be used as otherwise it can * be impossible to discern error status returns when calling svGetUserData() */ int svPutUserData(const svScope scope, void *userKey, void* userData); /* Retrieve an arbitrary user data pointer that was previously * stored by a call to svPutUserData(). See the comment above * svPutUserData() for an explanation of userKey, as well as * restrictions on NULL and illegal svScope and userKey values. * This function returns NULL for all error cases, 0 upon success. * This function also returns NULL in the event that a prior call * to svPutUserData() was never made. */ void* svGetUserData(const svScope scope, void* userKey); /* Returns the file and line number in the SV code from which the extern call * was made. If this information available, returns TRUE and updates fileName * and lineNumber to the appropriate values. Behavior is unpredictable if * fileName or lineNumber are not appropriate pointers. If this information is * not available return FALSE and contents of fileName and lineNumber not * modified. Whether this information is available or not is implementation * specific. Note that the string provided (if any) is owned by the SV * implementation and is valid only until the next call to any SV function. * Applications must not modify this string or free it */ int svGetCallerInfo(char **fileName, int *lineNumber); /* * Returns 1 if the current execution thread is in the disabled state. * Disable protocol must be adhered to if in the disabled state. */ int svIsDisabledState(); /* * Imported functions call this API function during disable processing to * acknowledge that they are correctly participating in the DPI disable protocol. * This function must be called before returning from an imported function that is * in the disabled state. */ void svAckDisabledState();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论