The $dist_erlang
function in Verilog-2005 takes an argument called mean
. Some information about the mean
argument of $dist_erlang
is found in this paragraph from section 17.9.2 of the spec:
They also provide C code for how simulators ought to internally implement $dist_erlang
(from page 320 of the spec). This code implements a formula that can be found on Wikipedia for sampling an Erlang distribution.
erlangian(seed, k, mean)
long *seed, k, mean;
{
double x, log(), a, b;
long i;
x = 1.0;
for(i = 1; i <= k; i++)
{
x = x * uniform(seed, 0, 1);
}
a = (double)mean;
b = (double)k;
x = -a * log(x)/b;
return(x);
}
I'm no expert on statistics, but I'm pretty sure that the multiplication by mean
/ a
at the very end of this function is not gonna result in a distribution whose mean is mean
. This would imply that every Erlang distribution sampled from using the equation on Wikipedia has a mean of 1, which definitely isn't true.
Am I missing something here, or is this an honest to goodness error in the Verilog spec?