Guest
Hi,
Does anyone know what is the simplest
way to convert packed to unpacked arrays
(or should I never want to do this)?
For instance, if I had:
reg [7:0] bytes [3:0];
reg [31:0] word;
...
for(i=0;i<3;i++)
bytes = word[8*i+7:8*i];
...
The word[8*i+7:8*i] gives an error:
Cannot evaluate the expression
((8 * i) + 7)
or word[7+:8*i] gives
The following expression should be a constant.
Expression: (8 * i)
I used to solve this using the Verilog-2001
generate, but it's a nuisance to introduce
it everywhere I need it. Also, it seems kind
of silly to have this limitation for verification.
Regards,
e
Does anyone know what is the simplest
way to convert packed to unpacked arrays
(or should I never want to do this)?
For instance, if I had:
reg [7:0] bytes [3:0];
reg [31:0] word;
...
for(i=0;i<3;i++)
bytes = word[8*i+7:8*i];
...
The word[8*i+7:8*i] gives an error:
Cannot evaluate the expression
((8 * i) + 7)
or word[7+:8*i] gives
The following expression should be a constant.
Expression: (8 * i)
I used to solve this using the Verilog-2001
generate, but it's a nuisance to introduce
it everywhere I need it. Also, it seems kind
of silly to have this limitation for verification.
Regards,
e