Applying unique to random variables

In reply to dave_59:

Hi Dave ,

Is there any way I can use Unique Constraint on Packed Arrays ?

Example ::



rand bit [2:0 ] b; // Need 8 Unique Values 

constraint UNIQ { unique { b  } ; } 



This just Makes sure that 2 Consecutive Values are not same .

I get one way would be taking a Queue and pushing values inside into it in post_randomize() and adding another constraint of

 ! ( b inside { q } ; ) 

and in post_randomize



 if ( queue.size() == 8 )
    queue.delete();


Regards,
AGIS