Hi ,
I am trying to do a simple randomization with dist in sv , I am not getting the result as i have distributed .
My expected output : 10- one times , 11- Five times, 12 three times , 13-one times
class Packet;
rand int a;
constraint c { a dist { 10:=1, 11:=5,12:=3,13:=1}; }
endclass
module test();
Packet pkt;
initial
begin
pkt = new();
repeat(10)
begin
if(pkt.randomize()) $display("%d",pkt.a);
end
end
endmodule
V C S S i m u l a t i o n R e p o r t
10
12
10
13
11
10
11
11
13
12
Cadence output
ncsim> run
12
11
12
11
11
10
10
11
10
11
Can you please make me understand ? Thanks in advance .
By
Siraj