arrayssimulationsystem-verilogpacked

SystemVerilog packed array vs unpacked array memory footprint


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


Solution

  • "[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: