返回介绍

第三十一章 SystemVerilog VPI Object Model

发布于 2020-09-09 22:56:04 字数 20890 浏览 1494 评论 0 收藏 0

主题
主题描述
31.1 简介(一般信息)SystemVerilog extends the Verilog Procedural Interface (VPI) object diagrams to support SystemVerilog constructs. The VPI object diagrams document the properties of objects and the relationships of objects. How these diagrams illustrate this information is explained in Section 26 of the IEEE Std. 1364-2001 Verilog standard. The SystemVerilog extensions to the VPI diagrams are in the form of changes to or additions to the diagrams contained in 1364-2001 Verilog standard.

The following table summarizes the changes and additions made to the Verilog VPI object diagrams:

Table 31-4: Verilog VPI object diagram changes and additions

31.2 Instance


NOTES

  1. Top-level instances shall be accessed using vpi_iterate() with a NULL reference object.
  2. Passing a NULL handle to vpi_get() with types vpiTimePrecision or vpiTimeUnit shall return the smallest time precision of all instances in the design.
  3. If an instance is an element within an array, the vpiIndex transition is used to access the index within the array. If the instance is not part of an array, this transition shall return NULL.
  4. Compilation units are represented as packages that have a vpiUnit property set to TRUE. Such implicitly declared packages shall have implementation dependent names.
31.3 Interface


NOTE
All interfaces are instances and all relations and properties in the Instances diagram also apply.

31.4 Program


NOTE
All programs are instances and all relations and properties in the Instances diagram also apply.

31.5 Module (supersedes IEEE 1364-2001 26.6.1)


31.6 Modport
31.7 Interface tf decl


NOTE
vpiIterate(vpiTaskFunc) can return more than one task/function declaration for modport tasks/functions with an access type of vpiForkJoin, because the task or function can be imported from multiple module instances.

31.8 Ports (supersedes IEEE 1364-2001 26.6.5)


NOTES

  1. vpiPortType shall be one of the following three types: vpiPort, vpiInterfacePort, and vpiModportPort. Port type depends on the formal, not on the actual.
  2. vpi_get_delays, vpi_put_delays delays shall not be applicable for vpiInterfacePort.
  3. vpiHighConn shall indicate the hierarchically higher (closer to the top module) port connection.
  4. vpiLowConn shall indicate the lower (further from the top module) port connection.
  5. vpiLowConn of a vpiInterfacePort shall always be vpiRefObj.
  6. Properties scalar and vector shall indicate if the port is 1 bit or more than 1 bit. They shall not indicate anything about what is connected to the port.
  7. Properties index and name shall... more
31.9 Ref Obj
31.10 Variables (supersedes IEEE 1364-2001 section 26.6.8)


NOTES
1) A var select is a word selected from a variable array.
2) The boolean property vpiArray shall be TRUE if the variable handle references an array of variables, and FALSE otherwise. If the variable is an array, iterate on vpiVarSelect to obtain handles to each variable in the array.
3) To obtain the members of a union and structure, see the relations in Section 31.21
4) The range relation is valid only when vpiArray is true. When applied to array vars this relation returns only unpacked ranges. When applied to logic and bit variables, it returns only the... more

31.11 Var Select (supersedes IEEE 1364-2001 26.6.8)
31.12 Typespec
NOTES
1) If the vpiTypedef is TRUE and the typedef creates an alias of another typedef, then the vpiTypedefAlias shall return a non null handle which represents the handle to the aliased typedef. For example:
31.13 Variable Drivers and Loads (supersedes IEEE 1364-2001 26.6.23)
NOTES
1) vpiDrivers/Loads for a structure, union, or class variable will include the following:
— Driver/Load for the whole variable
— Driver/Load for any bit/part select of that variable
— Driver/Load of any member nested inside that variable
2) vpiDrivers/Loads for any variable array should include the following:
— Driver/Load for entire array/vector or any portion of an array/vector to which a handle can be obtained.
31.14 Instance Arrays (supersedes IEEE 1364-2001 26.6.2)
NOTE
1) Param assignments can only be obtained from non-primitive instance arrays.
2) To obtain all the dimensions of a multi-dimensional array, the range iterator must be used. Using the vpiLeftRange/vpiRightRange properties will only return the last dimension of a multidimensional array.
31.15 Scope (supersedes IEEE 1364-2001 26.6.3)
NOTE
1: Unnamed scopes shall have valid names, though tool dependent.
2: The vpiImport iterator shall return all objects imported into the current scope via import statements. Note that only objects actually referenced through the import shall be returned, rather than items potentially made visible as a result of the import. Refer to Section 18.2.2 for more details.
31.16 IO Declaration (supersedes IEEE 1364-2001 26.6.4)
vpiDirection returns vpiRef for pass by ref ports.
31.17 Clocking Block
31.18 Class Object Definition
NOTE
  1. ClassDefn handle is a new concept. It does not correspond to any vpiUserDefined (class object) in the design. Rather it represents the actual type definition of a class.
  2. Should not call vpi_get_value/vpi_put_value on the non-static variables obtained from the class definition handle.
  3. Iterator to constraints returns only normal constraints and not inline constraints.
  4. To get constraints inherited from base classes, you will need to traverse the extend relation to obtain the base class.
  5. The vpiDerivedClasses iterator returns all the classes derived from the given class.
  6. The relation to vpiExtend exists whenever a one class is derived from another class... more
31.19 Constraint, constraint ordering, distribution,
31.20 Constraint expression
31.21 Class Variables
NOTES
1) vpiWaiting/Process iterator on mailbox/semaphores will show the processes waiting on the object:
— Waiting process means either frame or task/function handle.
2) vpiMessage iterator shall return all the messages in a mailbox.
3) vpiClassDefn returns the ClassDefn which was used to create the handle. vpiActualDefn returns
the ClassDefn that handle object points to when the query is made. The difference can be seen in
the example below:
class Packet
...
endclass : Packet
class LinkedPacket extends Packet
...
endclass : LinkedPacket
LinkedPacket l = new;
Packet p = l;
In this example, the vpiClassDefn of variable "p" is... more
31.22 Structure/Union
NOTES
vpi_get_value/vpi_put_value cannot be used to access values of entire unpacked structures and unpacked unions.
31.23 Named Events (supersedes IEEE 1364-2001 26.6.11)
NOTE
The new iterator (vpiWaitingProcesses) returns all waiting processes, identified by their frame, for that named event.

NOTE
vpi_iterate(vpiIndex, named_event_handle) shall return the set of indices for a named event within an array, starting with the index for the named event and working outward. If the named event is not part of an array, a NULL shall be returned.
31.24 Task, Function Declaration (supersedes IEEE 1364-2001 26.6.18)
NOTE
5) A Verilog HDL function shall contain an object with the same name, size, and type as the function.
6) vpiInterfaceTask/vpiInterfaceFunction shall be true if task/function is declared inside an interface or a modport of an interface.
7) For function where return type is a user-defined type, vpi_handle (vpiReturn,Function_handle) shall return the implicit variable handle representing the return of the function from which the user can get the details of that user-defined type.
8) vpiReturn will always return a var object, even for simple returns.
31.25 Alias Statement
31.26 Frames (supersedes IEEE 1364-2001 26.6.20)
NOTES
1) The following callbacks shall be supported on frames:
— cbStartOfFrame: triggers whenever any frame gets executed.
— cbEndOfFrame: triggers when a particular thread is deleted after all storage is deleted.
31.27 Threads
NOTES
The following callbacks shall be supported on threads
— cbStartOfThread: triggers whenever any thread is created
— cbEndOfThread: triggers when a particular thread gets deleted after storage is deleted.
— cbEnterThread: triggers whenever a particular thread resumes execution
31.28 tf call (supersedes IEEE 1364-2001 26.6.19)
NOTE:
1) the vpiWith relation is only available for randomize methods (see Section 12.6) and for array locator methods (see Section 4.15.1).
2) For methods (method func call, method task call), the vpiPrefix relation will return the object to which the method is being applied. For example, for the class method invocation
packet.send();
the prefix for the "send" method is the class var "packet"
31.29 Module path, path term (supersedes IEEE 1364-2001 26.6.15)
NOTE:
1) specify blocks can occur in both modules and interfaces. For backwards compatibility the vpiModule relation has been preserved; however this relation will return NULL for specify blocks in interfaces. For new code it is recommended that the vpiInstance relation be used instead.
31.30 Concurrent assertions
NOTE
Clocking event is always the actual clocking event on which the assertion is being evaluated, regardless of whether this is explicit or implicit (inferred)
31.31 Property Decl
31.32 Property Specification
NOTE
Variables are declarations of property variables. You cannot get the value of these variables.


NOTES:
1. within the context of a property expr, vpiOpType can be any one of vpiNotOp, vpiImplyOp, vpiDelayedImplyOp, vpiAndOp, vpiOrOp, vpiIfOp, vpiIfElseOp
Operands to these operations will be provided in the same order as show in the BNF.
31.33 Multiclock Sequence Expression
31.34 Sequence Declaration
NOTE:
the vpiArgument iterator shall return the sequence instance arguments in the order that the formals for the sequence are declared, so that the correspondence between each argument and its respective formal can be made. If a formal has a default value, that value will appear as the argument should the instantiation not provide a value for that argument.
31.35 Sequence Expression
Notes:
2. Within a sequence expression, vpiOpType can be any one of vpiAndOp, vpiIntersectOp, vpiOr, vpiFirstMatchOp, vpiThroughoutOp, vpiWithinOp, vpiUnaryCycleDelayOp, vpiCycleDelayOp, vpiRepeatOp, vpiConsecutiveRepeatOp or vpiGotoRepeatOp.
3. For operations, the operands are provided in the same order as the operands appear in BNF, with the following exceptions:
vpiUnaryCycleDelayOp: arguments will be: sequence, left range, right range. Right range will only be given if different than left range.
vpiCycleDelayOp: argument will be: LHS sequence, rhs sequence, left range, right range. Right range will only be provided if different than left range.
all the repeat operators: the first argument will be the sequence being... more
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)
NOTES:
1) For an operator whose type is vpiMultiConcat, the first operand shall be the multiplier expression. The remaining operands shall be the expressions within the concatenation.
2) The property vpiDecompile will return a string with a functionally equivalent expression to the original expression within the HDL. Parenthesis shall be added only to preserve precedence. Each operand and operator shall be separated by a single space character. No additional white space shall be added due to parenthesis.
3) New vpiOpTypes: vpiInsideOp, vpiMatchOp, vpiCastOp, vpiPreIncOp, vpiPostIncOp, vpiPreDecOp, vpiPostDecOp, vpiIffOp, vpiCycleDelayOp. The cast operation is represented as a unary operation, with its... more
31.42 Event control (supersedes IEEE 1364-2001 26.6.30)
NOTE—For event control associated with assignment, the statement shall always be NULL.
31.43 Event stmt (supersedes IEEE 1364-2001 26.6.27)
31.44 Process (supersedes IEEE 1364-2001 26.6.27)
NOTE- vpiAlwaysType can be one of: vpiAlwaysComb, vpiAlwaysFF, vpiAlwaysLatch
31.45 Assignment (supersedes IEEE 1364-2001 26.6.28)
NOTE: vpiOpType will return vpiAssignmentOp for normal non-blocking ’=’ assignments, and the operator combined with the assignment for the operators described in section 7.3.

For example, the assignment
链接 主题

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

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

发布评论

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