|
发表于 2017-3-3 15:47:27
|
显示全部楼层
Normal (Gaussian) Distribution
Use the $rdist_normal function to generate random real numbers (or the $dist_normal
function to generate integer numbers) that are normally distributed. The $rdist_normal
function is not supported in digital contexts.
$rdist_normal ( seed , mean , standard_deviation ) ;
$dist_normal ( seed , mean , standard_deviation ) ;
seed is a scalar integer variable used to initialize the sequence of generated numbers. seed
must be a variable because the function updates the value of seed at each iteration. To
ensure generation of a normal distribution, change the value of seed only when you initialize
the sequence.
mean is an integer or real expression that specifies the value to be approached by the mean
value of the generated numbers.
standard_deviation is an integer or real expression that determines the width of
spread of the generated values around mean. Using a larger standard_deviation
spreads the generated values over a wider range.
To generate a gaussian distribution, use a mean of 0 and a standard_deviation of 1.
For example, the following module returns a series of real numbers that together form a
gaussian distribution.
module distcheck (pinout) ;
electrical pinout ;
integer seed ;
real rrandnum ;
analog begin
@ (initial_step) begin
seed = 23 ;
end
rrandnum = $rdist_normal( seed, 0, 1 ) ;
$display ("Random number is %g", rrandnum ) ;
V(pinout) <+ rrandnum ;
end // of analog block
endmodule |
|