I am trying to randomize an array in my class where array elements are non-repeating and below 11.
But my constraints are satisfying my requirement. How should I change my code?
class A;
rand bit [3:0] value [10];
int q[$];
constraint C1 {foreach(value[i]) value[i]<11 && value[i] >0;}
constraint CYCLIC {foreach(value[i])
if(i>0)
value[i] != value[i-1];
}
endclass:A
module randc1;
A pkt;
initial begin
pkt = new();
void'(pkt.randomize());
foreach(pkt.value[i])
$display("%d ",pkt.value[i]);
end
endmodule