The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> How to get a Gaussian source using Verilog-AMS https://designers-guide.org/forum/YaBB.pl?num=1332404760 Message started by ahutianyi on Mar 22nd, 2012, 1:25am |
Title: How to get a Gaussian source using Verilog-AMS Post by ahutianyi on Mar 22nd, 2012, 1:25am Hi,guys I'm modeling a ADC.However,I meet a problem when to model a random source.I need a 255 outputs Gaussian source,and I find it difficult to realize that using "$rdist_normal(seed,mean,deviation)". :'( Is there anybody who can help me? Thanks very much! |
Title: Re: How to get a Gaussian source using Verilog-AMS Post by ahutianyi on Mar 23rd, 2012, 12:56am ahutianyi wrote on Mar 22nd, 2012, 1:25am:
|
Title: Re: How to get a Gaussian source using Verilog-AMS Post by ywguo on Mar 23rd, 2012, 7:09am Hi, What do you mean when saying 255 outputs Gaussian source? What do you get using your code? Is it correct for the code V(offset[i]) <+ V(result[i]); result is defined as real. I don't know what the compiler/simulator do with the above statement. Yawei |
Title: Re: How to get a Gaussian source using Verilog-AMS Post by Geoffrey_Coram on Mar 26th, 2012, 10:46am I'm sure he meant V(offset[i]) <+ result[i]; |
Title: Re: How to get a Gaussian source using Verilog-AMS Post by Geoffrey_Coram on Mar 26th, 2012, 10:52am But I think you need two integers, one for the loop index and a second for the seed; as it is, V(offset[1]) = $rdist_normal(1, mean, dev) That is, the call to $rdist_normal that sets output[1] is always made with the seed=1, so it will get the same value for each and every timepoint. |
Title: Re: How to get a Gaussian source using Verilog-AMS Post by ahutianyi on Mar 27th, 2012, 5:01am I meant that I want to get a series of random sources.All the sources follow the Gaussian distribution.I found the sytax error---V(offset[i])<+V(result[i]).However,I can't realize the resources yet.Is there anybody can help me? |
Title: Re: How to get a Gaussian source using Verilog-AMS Post by Geoffrey_Coram on Mar 27th, 2012, 11:07am We can't help you if we don't understand what you are trying to do. Are you sure you want a new $rdist value for *every* timepoint? Perhaps you want to use a clock input, or a timer event, to signal when to generate new random values. integer i, myseed; genvar j; @(initial_step) myseed = 0; @(timer(0,1u)) begin for (i=1; i <=256; i++) begin result[i] = $rdist_normal(myseed, mean, dev); end end for (j=1; j <=256; j++) begin V(offset[j]) <+ transition(result[j], 0, 1n, 1n); end |
Title: Re: How to get a Gaussian source using Verilog-AMS Post by ahutianyi on Mar 27th, 2012, 11:47pm Thanks a lot.I'm sure I want to realize a series of Gaussian voltages,and the voltages are stable.I use these voltages as the sources of the latter blocks. :) |
Title: Re: How to get a Gaussian source using Verilog-AMS Post by Geoffrey_Coram on Mar 28th, 2012, 4:53am Oh, if the voltages are stable (ie, don't change in time, but are picked randomly at time zero), then integer i, myseed; genvar j; @(initial_step) begin myseed = 0; for (i=1; i <=256; i++) begin result[i] = $rdist_normal(myseed, mean, dev); end end for (j=1; j <=256; j++) begin V(offset[j]) <+ result[j]; end |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |