【问题标题】:Systemverilog: is there a limit in size for a dynamic array?Systemverilog:动态数组的大小是否有限制?
【发布时间】:2021-10-25 14:19:49
【问题描述】:

在对动态数组执行new[SIZE] 时,我们可以在Systemverilog 中使用的SIZE 是否有限制?

【问题讨论】:

    标签: arrays system-verilog dynamic-arrays


    【解决方案1】:

    LRM 第 7.4.2 节 Unpacked arrays 说

    实现可能会限制数组的最大大小,但它们应允许至少 16 777 216 (224) 个元素。

    但如果您尝试访问这么多元素,您可能会受到时间而非空间的限制。如果您只打算访问一小部分地址空间,则关联数组可能是大型数组的更好选择。

    【讨论】:

    • 嘿@dave_59,当我们到达大尺寸的动态数组时,我们会开始得到“垃圾”数据吗?我们将这些数组传递给 C++ 代码使用的“DPI-C”函数。
    【解决方案2】:

    限制很大。

    IEEE Std 1800-2017,第 7.5.1 节新[] 状态

    [ expression ]:
    The desired size of the dynamic array. The type of this operand is longint. 
    It shall be an error if the value of this operand is negative. 
    

    longint 是 64 位签名的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-09
      • 1970-01-01
      • 2020-05-11
      • 2010-10-09
      • 2022-10-23
      • 2018-06-24
      • 1970-01-01
      • 2022-10-17
      相关资源
      最近更新 更多