Reply To: RandomPkg: How to set weight for range
the argument type of DistValSlv is an array with a record of two integers.
I wonder wether the range notation can work here too.
It wold look somewhat like this:
A <= RndA.DistValSlv(
(1 to 14,1),
If this works not, maybe a function with a case statement can help.
In the function you then write sth. like this:
for position in 0 to 15 loop — 15 might come from some ‘lengh calculation
case position is
when 0 => ReturnVal(position,5);
when 1 to 14 =>ReturnVal(position,1);
when 15 =>ReturnVal(position,5);
Unless there isn’t some better solution, this might at least be a useful workaround for the moment.
(edit:) But actualy that won’t reduce the code much, unless you have a really big array of random constraints.
Have a nice simulation