Constraint on even and odd number

In reply to subbarao:



class transaction;

rand bit[15:0]array[100];

constraint C1 { foreach(array[i])
                    if(i%2==0)
                          array[i]%2 !=0;
                    else
                         array[i]%2 ==0;}
endclass