please tell me Constraint for {1 2 2 3 3 3 4 4 4 4}
In reply to Vikas Misra:
class pattern;
rand int array[10];
constraint c_pattern {array[0] == 1;
array[1] == 2;
array[2] == 2;
array[3] == 3;
array[4] == 3;
array[5] == 3;
array[6] == 4;
array[7] == 4;
array[8] == 4;
array[9] == 4;
};
function new();
endfunction
endclass
module testbench();
pattern p_;
initial begin
p_ = new();
if (!p_.randomize()) $display("Failed to randomize p_");
else $display("p_ array is %p", p_.array);
end
endmodule