The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> $dist_normal
https://designers-guide.org/forum/YaBB.pl?num=1400968461

Message started by fullstop on May 24th, 2014, 2:54pm

Title: $dist_normal
Post by fullstop on May 24th, 2014, 2:54pm

Hi ,
I am trying to generate random  number normally distributed at every  time stamp of my transient simulations. this is module I am using.

`include "constants.vams"
`include "disciplines.vams"

module distcheck (pinout) ;
electrical pinout ;
integer seed ;
real rrandnum,counter=0.0 ;
analog begin
@ (initial_step) begin
seed = 0 ;
end
counter=counter+1;
rrandnum = abs($dist_normal( seed,0,1)) ;
V(pinout) <+ rrandnum;
end // of analog block
endmodule

but when i check the output it is giving me weibull and not normal distribution,

can anybody please help me on this

thanks a lot in advance

Title: Re: $dist_normal
Post by boe on May 26th, 2014, 5:14am

Fullstop,

Code:
rrandnum = abs($dist_normal( seed,0,1)) ;
will NOT generate a normal distribution.
- B O E

Title: Re: $dist_normal
Post by fullstop on May 26th, 2014, 6:39am

Hi BOE,

thanks for the reply.
Can you please help me how that can be done. I want to generate a random number for every time step of my transient simulation.

Thanks
fullstiop

Title: Re: $dist_normal
Post by boe on May 26th, 2014, 7:07am

Fullstop,
First of all, taking the absolute value is definitely wrong. I suggest

Code:
rrandnum = $rdist_normal(seed, 0, 1);

- B O E

Title: Re: $dist_normal
Post by fullstop on May 26th, 2014, 7:36am

Hey BOE,

Thanks a lot, infact that was the problem.
There is one more issue.
I think it is generating a new random number at every iteration at every time stamp. Isn't it possible like it only generate a random number only when time stamp is increased and not at every iteration during transient simulation. It is taking a lot of time

thanks
fullstop

Title: Re: $dist_normal
Post by Geoffrey_Coram on Jul 8th, 2014, 7:58am

Perhaps that's a bug in your simulator?

You may be able to print the value with
 $debug("rrandnum=%g at time=%g\n", rrandnum, $abstime);

and see if you get different values at the same time.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.