I'm trying to assignment logic l_data[31:0]; to byte data[];.
data = l_data; is not legal SystemVerilog assignment. How can it be done?
I'm trying to assignment logic l_data[31:0]; to byte data[];.
data = l_data; is not legal SystemVerilog assignment. How can it be done?
Use a bit-stream cast (section 6.24.3 of the IEEE Std 1800-2012 LRM). You will need to create a typedef for the cast, but it is a good idea to use typedefs for all your variable declarations anyways.
typedef byte unsigned dynamic_byte_array_t[];
typedef logic fixed_logic_array_t[31:0];
dynamic_byte_array_t data;
fixed_logic_array_t l_data;
data = dynamic_byte_array_t'(l_data);
A couple of notes:
byte, it is signed by default._t suffix to all my type basic names,