Reply To: Help on using DistValInt

Why OSVVM™? Forums OSVVM Help on using DistValInt Reply To: Help on using DistValInt


Hi Jim,

I’ve tried something similar to your example code and now it produced the results that I was expecting. 

counts := (0,0,0,0);
for i in 0 to 100 loop
  tmp_val := rndx.DistValInt(((1,1),(2,5),(3,3),(4,1)));
  case (tmp_val) is
    when 1      => counts(0) := counts(0)+1; 
    when 2      => counts(1) := counts(1)+1; 
    when 3      => counts(2) := counts(2)+1; 
    when 4      => counts(3) := counts(3)+1; 
    when others => counts    := counts;
  end case;    
end loop;

report "counts: " & to_string(counts(0)) & ","
                  & to_string(counts(1)) & ","
                  & to_string(counts(2)) & ","
                  & to_string(counts(3));

I got "Note: counts: 8,54,27,12" in my simulation run.

Yesterday I did not execute the rndx.DistValInt() multiple times and I only tested a few SEED values to initialize my random variable and I think that was the reason why I did not observe the generation of tmp_val properly.

Thanks a lot for your help,