Verilog-A中rdist_normal(seed,0,1) 函数中Seed值如何确定!
// Fixed frequency oscillator with white accumulating jitter.
//
// Accumulating jitter is the jitter associated with a free-running oscillator.
//
module osc2 (out);
output out; voltage out;// output signal
parameter real freq=1 from (0:inf);// output frequency
parameter real vl=-1;// high output voltage
parameter real vh=1;// low output voltage
parameter real tt=0.01/freq from (0:inf);// transition time of output
parameter real jitter=0 from [0:0.1/freq);// white period jitter
integer n, seed;
real next, dT;
analog begin
@(initial_step) begin
seed = 286;
next = 0.5/freq + $abstime;
end
@(timer(next)) begin
n = !n;
dT = jitter*$rdist_normal(seed,0,1);
next = next + 0.5/freq + `M_SQRT1_2*dT;
end
V(out) <+ transition(n ? vh : vl, 0, tt);
end
endmodule
这段代码为http://www.designers-guide.org/VerilogAMS/functional-blocks/osc/osc.va中的实例,用来建模VCO抖动的,请问rdist——normal函数中Seed值是如何确定的,为什么这里面是286?
求指教
谢谢
我是初学者 在尝试写veriloga 但是每次加入随机数 总是报错 请问是什么问题
"module idc_1.2<<--? 2(rand);"
谁有Verilog a 教程,给大家分享一下。谢谢
也想问一下
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