hi…
I am trying to use unique keyword to generate unique elements in an array…
But, I am getting a compilation error if I am running the following code…
module test;
class image;
rand int pixel[$];
constraint img{unique{pixel};}
constraint xyz{pixel.size == 10;}
endclass
image I;
initial
begin
I = new();
I.randomize();
for (int j= 0; j<10; j++)
$write(" pixel[%0d] = %0d ", j,I.pixel[j]);
end
endmodule
The following is the error… plz help me in solving this…
Error: image.sv(5): near “unique”: syntax error, unexpected unique**