Re: Random Number
- From: Jonathan Bromley <jonathan.bromley@xxxxxxxxxxxxx>
- Date: Tue, 08 Jul 2008 21:54:28 +0100
On Tue, 08 Jul 2008 21:37:15 +0100, Clemens wrote:
Is there any easy way to generate a random number in TCL?
In some way, I wanna force a signal to HIGH for different
amount of times between 10 & 30 ns.
Weird - a sudden rash of digital-simulator questions.
Yes, you can generate pseudo-random numbers in Tcl.
But why would you want to, for this purpose? Your
hardware description language (VHDL or Verilog) has
native random number generation, and those functions
will be much easier to integrate into a test
environment than something written in a simulator's
scripting language. HDL code will be portable
across simulators too, unlike tool-specific scripts.
If you really must use Tcl, look at the docs on [expr]
and find out about the rand() and srand() functions.
If you want to use VHDL, look at the IEEE.math_real
package and find out about the UNIFORM() procedure.
If you want to use Verilog, find out about $dist_uniform()
and the numerous other built-in random distribution
functions. comp.lang.vhdl and comp.lang.verilog will
provide a good pool of expertise.
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@xxxxxxxxxxxxx
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
.
- Follow-Ups:
- Re: Random Number
- From: Fredderic
- Re: Random Number
- References:
- Random Number
- From: Clemens
- Random Number
- Prev by Date: Random Number
- Next by Date: Re: Events on Serial port
- Previous by thread: Random Number
- Next by thread: Re: Random Number
- Index(es):
Relevant Pages
|