The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 8:35am
Pages: 1
Send Topic Print
How can I get real random number in Verilog-A? (Read 3339 times)
seefree
Junior Member
**
Offline



Posts: 10

How can I get real random number in Verilog-A?
Jul 28th, 2008, 10:21am
 
Hi,

I tried create a model with random value at each run, below is the code:

parameter integer seed = 2;
integer myseed, newseed;
real vrand;
  analog begin
        myseed=seed+$random();
        newseed=seed*$random(myseed);
        vrand = $rdist_normal( newseed, vmean, vsdev );
        V(vp,vn) <+ vrand;
  end
endmodule

I can run monte carlo analysis with different values, but same value for different runs, which makes it repeatable. In other words, when I re-run simulation, the value sequence from Random() function is the same. Can I create a model with the real random number? I tried to find a function in Verilog-A to get the system clock time to generize the rendom but couldn't find the function...

Thanks,
Back to top
 
 
View Profile   IP Logged
icsoul
Junior Member
**
Offline



Posts: 29

Re: How can I get real random number in Verilog-A?
Reply #1 - Aug 5th, 2008, 4:32am
 
I don't think you can do that.

Becacuse any software including veriloga is based on some fixed algorithm. So there is no "real random".

Your original seed is fixed to 2, so the myseed and newseed are also in a fixed change mode.

If the seed is changed random or is deleted, the result may be better.

Good luck!~
Back to top
 
 
View Profile   IP Logged
jbdavid
Community Fellow
*****
Offline



Posts: 378
Silicon Valley
Re: How can I get real random number in Verilog-A?
Reply #2 - Aug 6th, 2008, 9:44am
 
setup montecarlo to give you a random value of the seed parameter.
Back to top
 
 

jbdavid
Mixed Signal Design Verification
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.