Generating HDL from a Random Number Generator

12 ビュー (過去 30 日間)
Kiran Kintali
Kiran Kintali 2021 年 11 月 6 日
編集済み: Kiran Kintali 2021 年 11 月 6 日
How do I model Random Number Generator suitable for HDL Coder?

採用された回答

Kiran Kintali
Kiran Kintali 2021 年 11 月 6 日
The mask on the uniform generator has sample time and seed parameters.
  1. The uniform generator produces uint32 values.
  2. There is a different algorithm for 128bit numbers. http://www.math.sci.hiroshima-u.ac.jp/m-mat/MT/ARTICLES/sfmt.pdf
  3. One can try concatenate 4 of these with different seeds but the quality is not guaranteed.
  4. The normal generator produces N~(0,1) distribution using Box-Mueller. Due to log and multiplication with 2*pi, some precision loss occurs that may not be significant.
load_system('hdl_rng.slx');
% generate 10000 random integers
sim('hdl_rng.slx',10000);
% plot the histogram
subplot(1,2,1);
histogram(uniform_random_numbers,linspace(0,2^32,21));
title('Histogram of uniform random numbers');
subplot(1,2,2);
histogram(normal_random_numbers,linspace(-4,4,21));
title('Histogram of normal random numbers');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOptimization についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by