"Range must be bounded by constant expression" - Error from a constraint block

In reply to naveensv:

Hi Tudor,

I am stuck at one point where I need to get a 2D array from a one dimensional array in a constraint.
Snippet:

rand int total_count[];
local rand int legal_next[][];
constraint
total_count.size() == 2;

foreach (legal_next[i])
legal_next.size() == 2; //I am hard-coding here intentionally

foreach (legal_next[i])
legal_next[i].size() == total_count[i];

foreach (even[i])
single_dimension[2*i] = even[i];

foreach (odd[i])
single_dimension[2*i +1] = odd[i];

Now single_dimension has all elements and I need to select legal range in them.

Now I am trying to split single_dimension and assign to legal_next portion by portion
For ex:
If single_dimension = {1,2,3,4,5,6,7,8,9,10};
total_count[0] = 4 and total_count[1] = 5
Then,
legal_next[0] = {1,2,3,4}
legal_next[1] = {5,6,7,8,9}

Unfortunately I cannot use for loop in the constraint.
I tried my best to achieve this. But that didn’t help much.
Could you suggest any best way to do this?