The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 8:39am
Pages: 1
Send Topic Print
Psudo-Random $random gives Bus Error (Read 1703 times)
eddie
New Member
*
Offline



Posts: 7

Psudo-Random $random gives Bus Error
Oct 23rd, 2009, 1:57am
 
Hi.
I have the following code:

integer Rand;
Rand = $random;
$write("Rand = ");
$write(Rand);

The random function is the correct syntax, as checked by the compiler and me vs the reference manual. Rand and random are both 32 bit integers. My problem is that as soon as the VerilogA code gets to this line it gives a Bus Error, with the message to send Cadence the netlist (i.e. totally unhelpful).

I would rather use the normal distribution function as such:

integer Rand;
Rand = $dist_normal(seed, mean, standard deviation);

But this code gives me a value that is always the same and always saturated near to the mean point. I would for example like a random number uniformly distributed between -50 and +50, with a mean of zero and a standard deviation of 20.

Removing just the Rand = line of code, the module correctly simulates. Its not a syntax issue as the code compiles correctly. Why is this happening. It shouldn't be a memory error as I'm running on a Sun Blade 1500 with 2Gb RAM.

Thanks.
Ed
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: Psudo-Random $random gives Bus Error
Reply #1 - Oct 23rd, 2009, 10:48am
 
What if you
$write("Rand = %d", Rand);

Could be that there's some bug in the $write code trying to format it for output.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
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.