Re: Random Number



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.
.



Relevant Pages

  • Re: about relational greater operator
    ... If you then assign this self-determined single bit result ... Did you intend this instead... ... DOULOS - Developing Design Know-how ... VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services ...
    (comp.lang.verilog)
  • Re: Verilog Question
    ... it's Verilog so it will attract ... inhabit both, so here goes. ... DOULOS - Developing Design Know-how ...
    (comp.lang.vhdl)
  • Re: decoder using generate statement
    ... gates. ... Note the use of as a Verilog idiom for 2^N. ... recursive instantiation. ... DOULOS - Developing Design Know-how ...
    (comp.lang.verilog)
  • Re: New person to CPLD programming
    ... Verilog good, VHDL bad. ... There used to be obfuscated-C and obfuscated-Perl ... Verilog contests, because people do it all the time ... DOULOS - Developing Design Know-how ...
    (comp.arch.fpga)
  • Re: verilog versus vhdl
    ... each branch is a single statement in Verilog, ... execution continues through the switch block; ... case labels in Verilog don't need to be constants. ... DOULOS - Developing Design Know-how ...
    (comp.arch.fpga)