Passing array size as argument for another array inside the task/function

In reply to gabi0307:

Section 7.4.2 in the LRM states that dimensions for an unpacked array are required to be constant expressions. Using a variable violates this requirement.

You can use a dynamic array instead:


parameter SIZE_1 = 27;
task task1(input int SIZE, input logic my_array1, input logic my_array2);
   automatic logic my_array3[] = new[SIZE-1];
   //rest of the code
endtask
 
task1(SIZE_1, array1, array2);