SystemVerilog的包装阵VS解压数组的内存占用 [英] SystemVerilog packed array vs unpacked array memory footprint

查看:873
本文介绍了SystemVerilog的包装阵VS解压数组的内存占用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是真的,与当代先进SV RTL仿真,仿真足迹可以使用非压缩数组VS包装的阵列时增加吗?如果是这样,这是一个问题,做验证团队坚持规则,以便使用打包数组?
TIA。
桑杰


解决方案

  

[不]仿真足迹可以使用解压缩时增加
  阵列VS包装的阵列?


这取决于模拟器分配和访问它的存储器。打包数组大多数情况下,将有一个更小的内存占用量,然后解压缩阵列。通常在不是很充足的足迹大小差异。当模拟器访问从内存中的数组,数组封装锻炼整个阵列,同时非压缩数组访问的一部分。当数组很大,不需要访问整个阵列一次,解压阵列有更好的表现,然后打包数组。


  

这是一个问题,做设计团队坚持的设计规则,以便使用
  打包数组?


如果运行模拟器机具有足够的内存来运行仿真然后不要紧。即使如此,内存占用限制,不应该是一个设计规则。设计规则应该集中在质量,性能,硅/ FPGA的限制,和可读性。如果调整阵列结构有助于满足真正的设计规则,那么减少内存占用是一个附带好处。

有限的系统内存(或者很长的仿真时间)打交道时

测试台和非综合模型是一个不同的故事。校准包装和非压缩数组是多种因素考虑之一。许多商业模拟器配备了文档的准则以获得最佳的模拟结果。

通用阵列准则:


  • 包装阵列 - 合成的 - 最好的访问整个数组算法的操作和支持时,位选择和部分选择(的 LRM 和教派; 7.4.1)

    • 例如: REG [31:0] packed_array;


  • 解压阵列 - 合成的 - 最好的时候数组巨大或者每个条目都必须单独访问(的 LRM 和教派; 7.4.2)

    • 例如章unpacked_array [31:0]; REG [31:0] unpacked_array_of_packed_arrays [15:0];


  • 关联数组 - 不是合成的 - 最好的时候,所有条目的能力连接在模拟必要,也不可能获得大多数实体(的 LRM 和教派; 7.8)

    • 例如 INT associative_wildkey [*];逻辑[127:0] associative_keytype [INT];


  • 队列 - 不是合成的 - 最好的时候,参赛人数是未知和数据访问就像一个管道(的 LRM 和教派; 7.10)

    • 例如位[7:0]队列[$];


  • 动态数组 - 没有综合的 - 最需要的时候用它和仿真做动态创建一个整个数组,很好的做法,删除阵列时不这样做( LRM 和教派; 7.5)

    • 例如 INT dynamic_array [];初始dynamic_array =新[8];


  • 向量网 - (检查合成手动)的 - 最好的时候,只访问了整个包装的条目,位选和部分选择不允许(可能有更小的内存因为这个足迹)。限于网络类型( LRM 和教派; 6.9.2)

    • 例如线向量[7:0] VEC;


Is it true that with the contemporary advanced SV RTL simulators, the simulation footprint may increase when using unpacked arrays vs the packed arrays? If so, is this a problem and do verification teams insist on rules to use packed arrays? TIA. Sanjay

解决方案

"[Does] the simulation footprint may increase when using unpacked arrays vs the packed arrays?"

It depends on the simulator allocates and accesses its memory. Most cases packed arrays will have a smaller memory footprint then unpacked arrays. Usually the footprint size differences in not very sufficient. When the simulator accesses an array from memory, packed arrays exercise the whole array while unpacked arrays access a portion. When the array is large and do not require access to the whole array at once, unpacked arrays have better performance then packed arrays.

"is this a problem and do design teams insist on design rules to use packed arrays?"

If the machine running the simulator has an sufficient memory to run the simulation then it doesn't matter. Even still, memory footprint limitations should not be a design rule. Design rules should focus on the quality, performance, silicon/FPGA limitations, and readability. If adjusting array structures helps meet real design rules, then the reduced memory footprint is a side benefit.

Test benches and non-synthesizable models are a different story when dealing with limited system memory (or very long simulation time). Calibrating the packed and unpacked arrays is one of many factors to look into. Many commercial simulators come with documentation for guidelines to get best simulation results.

General array guidelines:

  • packed array - synthesizable - best when accessing an entire array algorithmic operations and supports bit-select and part select (LRM § 7.4.1)
    • example: reg [31:0] packed_array;
  • unpacked array - synthesizable - best when the array is huge or each entry must be accessed individually (LRM § 7.4.2)
    • example reg unpacked_array [31:0]; reg [31:0] unpacked_array_of_packed_arrays [15:0];
  • associative array - not synthesizable - best when ability access to all entries is necessary and unlikely access most entities in simulation (LRM § 7.8)
    • example int associative_wildkey [*]; logic [127:0] associative_keytype [int];
  • queue - not synthesizable - best when number of entries are unknown and data access is like a pipeline (LRM § 7.10)
    • example bit [7:0] queue [$];
  • dynamic array - not synthesizable - best when needing to create an entire array on the fly, good practice to delete the array when done with it and simulation is not done (LRM § 7.5)
    • example int dynamic_array[]; initial dynamic_array = new[8];
  • vectored net - (check synthesizer manual) - best when only accessing the whole packed entry, bit-select and part-select are not allowed (might have smaller memory footprint because of this). Limited to net types (LRM § 6.9.2)
    • example wire vectored [7:0] vec;

这篇关于SystemVerilog的包装阵VS解压数组的内存占用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆