Q016FreeSystemVerilog
SystemVerilog Packed vs. Unpacked Arrays
Question
How should this declaration be interpreted?

Code to inspect
bit [7:0] bytes [4];Answer choices
- A. One packed 32-bit vector
- B. Eight unpacked arrays, each four bits wide
- C. Four unpacked elements, each an 8-bit packed vector
- D. A dynamic array whose current size is four
Short answer
Choose C. bytes is an unpacked collection of four elements, and each element is an eight-bit packed vector. The [7:0] dimension appears with the type, so its bits form a contiguous value; [4] follows the identifier and establishes the outer element collection.
Why this reasoning works
Packed dimensions appear to the left of the variable name and participate as part of each element’s integral bit representation. That makes bytes[i] an 8-bit value that can be sliced and used in arithmetic. Packed bit numbering here runs from 7 down to 0, so bytes[i][7] selects that element’s most significant bit.
Unpacked dimensions appear after the name and organize separate elements. In this declaration, the outer dimension supplies four byte-sized entries rather than flattening everything into one 32-bit packed vector. The total storage is still 32 bits, but assignment compatibility, indexing order, slicing, and layout semantics differ from a single packed [31:0] declaration.
Interview takeaways
- Left dimensions are packed
- Right dimensions are unpacked
- Four elements, eight bits each
