Write a SystemVerilog module that declares a 4-bit packed array and a 4-e…
Write a SystemVerilog module that declares a 4-bit packed array and a 4-element unpacked array, initializes the packed array, and assigns it to the unpacked array using a static type cast.
Model answer
Because a packed array ( logic [3:0] ) and an unpacked array of 1-bit elements ( logic [3:0] unpacked) have the same total bit width ($4$ bits) and bit-stream representation, SystemVerilog allows converting between them using a typedef and an explicit **static bitstream cast** ( unpacked_array'(pa) ):