Constraint Failure

In reply to MICRO_91:

[2] Any alternate way ??


class A  ;
 
rand int unsigned a[] ;
 
constraint DEPTH { a.size() == 10 ; }
 
 
 
constraint VALUES { 
                       
  foreach(a[i]) {
    if ( i == 0 )
       a[i] == 0 ;
    else if ( i == 1 )
	   a[i] == 1 ;
    else 
      a[i] == a.sum with (item.index<i? int'(item):0);    
	}
} 
 
endclass
 
 module test;
A a1 ;
 
 
initial begin
 
 
a1 = new();
 
if ( a1.randomize() ) // Fails , But why ??
 begin
 
  $display("Success with %p",a1); 
 
 end
 
end
                        
endmodule