I have used distribution constraint, As per my understanding, in below code “5” should repeat for 3 times and “7” should repeat for 2 times. I am randomizing for 5 times. But in output “5” is repeating for 4 times and “7” is repeating only for 1 time.
Why it is not getting distributed as per the weight?
module test;
class base_class;
rand int addr;
constraint addr_c{addr dist {5:=3, 7:=2};}
endclass
base_class base_h;
initial begin
base_h=new();
repeat(10) begin
assert(base_h.randomize());
$display("%p", base_h);
end
end
endmodule