This is the problem statement I am trying to solve.
I have a packet data stored in an array.
In the packet array, there is a field in the header that can be of variable length.
I am trying to extract this field. I don’t have the code handy now but I use something like this rougly
This gives an error that array range has to be a constant expression.
This is expected as I do understand that LRM enforces this rule.
But I am looking how to resolve this issue.
Any options/directions is highly appreciated.
In reply to verif_learner:
See 11.4.14.4 Streaming dynamically sized data
Thanks, Dave. This works for a small example.
I am pasting the code hoping it helps someone:
module mod;
int arr_1[10] = {1,2,3,4,5,6,7,8,9,10};
int arr_2[];
int size = 5;
initial
begin
arr_2 = new[size];
arr_2 = {>>int{arr_1 with [0+:size]}};
$display ("%p %p", arr_1, arr_2);
end
endmodule