SystemVerilog · Topic
SystemVerilog Arrays — Packed, Unpacked, Dynamic & Queues
Packed and unpacked dimensions, dynamic arrays, queues, associative arrays and array methods — what each is for and which are synthesizable.
A packed dimension and an unpacked dimension look alike in a declaration and behave nothing alike. A packed array is a single integral value that happens to be indexable, so it can be sliced, assigned as a whole and used in arithmetic; an unpacked array is a collection of separate objects, so it supports `foreach` and array methods but not arithmetic. Getting this backwards produces the most cited SystemVerilog trap: a part-select on the wrong dimension is legal, returns X rather than erroring, and the X is often absorbed downstream.