How good are random VHDL numbers?

I use random VHDL numbers from IEEE.math_real, but how good are these generated numbers?

.... let's say compared to rand(...)from C.

Were there any statistical tests?


Here is a histogram of the Gaussian distribution. Parameters:

  • Random source: 2 uniform distributed REAL values ​​generated math_real.Uniform(...)
  • Convert Box-Muller
  • calculated using REAL
  • Output signal: 0..4095 INTEGER
  • 102,400 iterations

Classic view of the histogram:
NormalDistributedRandomValue 100Ki iterations, range 0..4095

Like a point cloud:
NormalDistributedRandomValue 100Ki iterations, range 0..4095


Here is a uniform distribution histogram. Parameters:

  • Random source: uniform distributed REAL values ​​generated using math_real.Uniform(...)
  • calculated using REAL
  • Output signal: 0..4095 INTEGER
  • 102,400 iterations

Classic view of the histogram:
NormalDistributedRandomValue 100Ki iterations, range 0..4095

Like a point cloud:
NormalDistributedRandomValue 100Ki iterations, range 0..4095

Gnuplot fit results for f(x)=m*x+b:

m = -0.0000343906
b = 25.0704

In my opinion, both histograms have a high jitter.

+4
1

IEEE.math_real.UNIFORM:

procedure UNIFORM(variable SEED1,SEED2:inout POSITIVE;variable X:out REAL) is
  ...
  variable Z, K: INTEGER;
  variable TSEED1 : INTEGER := INTEGER'(SEED1);
  variable TSEED2 : INTEGER := INTEGER'(SEED2);
begin
  ...

  K := TSEED1 / 53668;
  TSEED1 := 40014 * (TSEED1 - K * 53668) - K * 12211;
  if TSEED1 < 0  then
    TSEED1 := TSEED1 + 2147483563;
  end if;

  K := TSEED2 / 52774;
  TSEED2 := 40692 * (TSEED2 - K * 52774) - K * 3791;
  if TSEED2 < 0  then
    TSEED2 := TSEED2 + 2147483399;
  end if;

  Z := TSEED1 - TSEED2;
  if Z < 1 then
    Z := Z + 2147483562;
  end if;

  SEED1 := POSITIVE'(TSEED1);
  SEED2 := POSITIVE'(TSEED2);
  X :=  REAL(Z) * 4.656613e-10;
end UNIFORM;

:

a) , ' " ACM", 31, № 6, 1988 ., . 742-774. 32- .

b) UNIFORM (SEED1, SEED2) [1, 2147483562] [1, 2147483398] . UNIFORM.

c) 32- , ~ 2.30584 * (10 ** 18) .

d) . L'Ecuyer.

L'ecuyer " " , user1155120 .

, (CLCG) Wichmann/Hill/Schrage/Bratley et. . (. L'ecuyer), 32- .

, , CLCG, Wiki , . user1155120 , CLCG " , Ada" .

, , VHDL , , / .

+2

Source: https://habr.com/ru/post/1628698/


All Articles