Reply To: RandomPkg: How to set weight for range
Why OSVVM™? › Forums › OSVVM › RandomPkg: How to set weight for range › Reply To: RandomPkg: How to set weight for range
 Jim Lewis
Jim LewisHi Nikolai,
There is a simpler form of DistValSlv that returns values in the range of its argument, which is 0 to 15 if the argument is a literal or aggregate:
     A <= RndA.DistSlv((5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5), A'length) ; 
If you prefer, you can also use named association:
     A <= RndA.DistSlv((0=>5, 1=>1, 2=>1, 3=>1, 4=>1, 5=>1, 6=>1, 
                        7=>1, 8=>1, 9=>1, 10=>1, 11=>1, 12=>1, 
                        13=>1, 14=>1, 15=>5), A'length) ; 
With named association, you can also do the following:
     A <= RndA.DistSlv((0=>5, 1 to 14 =>1, 15=>5), A'length) ; 
You can also do this with a coverage model:
     shared variable ACov : CovPType ; 
     . . .
     process
     begin
       ACov.AddBins(5, GenBin(0)) ; 
       ACov.AddBins(1, GenBin(1,14)) ;       ACov.AddBins(5, GenBin(15)) ; 
       . . .
       A <= ACov.RandCovPoint ; 
       ACov.ICoverLast ;
Jim
