I want to randomize 6 bits such that no more than 2 continuously repeat digits is not allowed .
For example , 1st data = 6 (allowed)
2nd data =6 (allowed)
3rd data = 6 ( not allowed )
Any idea how should I proceed ?
Thanks
I want to randomize 6 bits such that no more than 2 continuously repeat digits is not allowed .
For example , 1st data = 6 (allowed)
2nd data =6 (allowed)
3rd data = 6 ( not allowed )
Any idea how should I proceed ?
Thanks
I believe you want data something like this : 1,1,2,2,3,4,4,5,6,6,7...
If this is the case following can help :
rand bit[5:0] data;
bit [5:0] prev_data;
bit count;
constraint val_data{if(count) data != prev_data;}
function void post_randomize();
if(count) count = 0;
if(data == prev_data) count++;
prev_data = data;
endfunction
Thanks