返回介绍

E.6.3 Data representation

发布于 2020-09-09 22:56:14 字数 2068 浏览 913 评论 0 收藏 0

DPI imposes the following additional restrictions on the representation of SystemVerilog data types.

  • SystemVerilog types that are not packed and that do not contained packed elements have C compatible representation.
  • Basic integer and real data types are represented as defined in Annex E.6.4.
  • Enumeration types are represented as the types associated with them. Enumerated names are not available on C side of interface.
  • Representation of packed types is implementation-dependent.
  • Unpacked arrays embedded in a structure have C compatible layout regardless of the type of elements. Similarly, standalone arrays passed as actuals to a sized formal argument have C compatible representation.
  • Standalone array passed as an actual to an open array formal
  • if the element type is scalar or packed then the representation is implementation dependent
  • otherwise the representation is C compatible. Therefore an element of an array shall have the same representation as an individual value of the same type. Hence, an array’s elements can be accessed from C code via normal C array indexing similarly to doing so for individual values.
  • The natural order of elements for each dimension in the layout of an unpacked array shall be used, i.e., elements with lower indices go first. For SystemVerilog range [L:R], the element with SystemVerilog index min(L,R) has the C index 0 and the element with SystemVerilog index max(L,R) has the C index abs(L-R).
NOTE—This does not actually impose any restrictions on how unpacked arrays are implemented; it only says an array that does not satisfy this condition shall not be passed as an actual argument for a formal argument which is a sized array; it can be passed, however, for a formal argument which is an unsized (i.e., open) array. Therefore, the correctness of an actual argument might be implementation-dependent. Nevertheless, an open array provides an implementation-independent solution; this seems to be a reasonable trade-off.

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

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

发布评论

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