In reply to dave_59:
Hi Dave ,
While answering I had assumed same object is being randomized() repeatedly .
Also it was based on previous observations across simulators . Since I randomize it 10 times I never used to see the other combination of output
I tried changing code to ::
int unsigned array2[6];
int count ;
constraint VAL {
foreach(array1[i])
if ( count < 4 )
array1[i] == array2[i] ;
}
function void pre_randomize();
if ( count == 0 )
array2 = '{ 0 , 0 , 0 , 0 , 0 , 0} ;
if ( count == 1 )
array2 = '{ 0 , 0 , 0 , 0 , 0 , 1} ;
if ( count == 2 )
array2 = '{ 0 , 0 , 0 , 0 , 1 , 0} ;
if ( count == 3 )
array2 = '{ 0 , 0 , 0 , 0 , 0 , 2 } ;
endfunction
function void post_randomize();
count ++ ;
endfunction
I see same output as you explained is also possible . ( Had my theory been true the simulators would have given randomization failure )
Thanks for the info Dave ! .