123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <html>
- <head>
- <title>Random</title>
- </head>
- <body bgcolor="FFFFFF">
- <h1><img align="center" src="../../../icons/random.gif" width="32" height="32">
- <em>Random</em></h1>
- <p><table>
- <tr><td><strong>Library:</strong></td>
- <td><a href="index.html">Memory</a></td></tr>
- <tr><td><strong>Introduced:</strong></td>
- <td>2.3.0</td></tr>
- <tr><td valign="top"><strong>Appearance:</strong></td>
- <td valign="top"><img src="../../../img-libs/random.png" width="34" height="44"></td></tr>
- </table></p>
- <h2>Behavior</h2>
- <p>This component iterates through a pseudorandom sequence of numbers, which
- steps forward to the following number in the sequence each time the clock is
- triggered while the component is enabled. Technically speaking, the algorithm
- used to compute the pseudorandom sequence is a linear
- congruential generator: Starting from a seed
- <var>r</var><sub><small>0</small></sub>, the following number
- <var>r</var><sub><small>1</small></sub> is the number</p>
- <center>
- <var>r</var><sub><small>1</small></sub> =
- (25,214,903,917 <var>r</var><sub><small>0</small></sub> + 11)
- mod 2<sup><small>48</small></sup>
- </center>
- <p>The next value <var>r</var><sub><small>2</small></sub>
- is computed from <var>r</var><sub><small>1</small></sub>
- using the same computation, and so forth. This sequence is of 48-bit numbers;
- the value seen from the component is the low-order bits as configured
- by its Data Bits attribute, after first throwing out the lower 12 bits of
- the current seed.</p>
- <p>Besides the clock input, the component also includes an <var>enable</var>
- input, which leads the clock input to be ignored when <var>enable</var> is 0,
- and the <var>reset</var> input, which resets the component's value asynchronously
- to the initial seed <var>r</var><sub><small>0</small></sub>.</p>
- <p>The initial seed is user-configurable. If it is configured at 0 (which is
- the default), then the seed is based on the current time; when instructed
- to reset through the <var>reset</var> input, the component computes a new
- seed based on the new current time.</p>
- <h2>Pins</h2>
- <dl>
- <dt>East edge, labeled <var>Q</var> (output, bit width matches Data Bits attribute)</dt>
- <dd>Outputs the value currently stored by the component.</dd>
- <dt>West edge, top pin, labeled with a triangle (input, bit width 1)</dt>
- <dd>Clock: At the instant that this is triggered as specified by the Trigger
- attribute, the component steps to the following number in its sequence.</dd>
- <dt>West edge, bottom pin (input, bit width 1)</dt>
- <dd>Enable: The component is enabled when this input is disconnected or 1;
- but if it is 0, then the clock input is ignored.</dd>
- <dt>South edge (input, bit width 1)</dt>
- <dd>Reset: When this is 1, the pseudorandom sequence asynchronously resets to
- the initial seed. (If seed is 0, this new seed should be different from the
- initial seed used previously.)</dd>
- </dl>
- <h2>Attributes</h2>
- <p>When the component is selected or being added,
- Alt-0 through Alt-9 alter its <q>Data Bits</q> attribute.</p>
- <dl>
- <dt>Data Bits</dt>
- <dd>The bit width of the value emitted by the component.</dd>
- <dt>Seed</dt>
- <dd>The starting value used for the pseudorandom sequence. If this is 0
- (the default), then the starting value is based on the time that the random
- sequence began.</dd>
- <dt>Trigger</dt>
- <dd>Configures how the clock input is interpreted. The value <q>rising edge</q>
- indicates that the component should update its value at the instant when the
- clock rises from 0 to 1. The <q>falling edge</q> value indicates that it should
- update at the instant the clock falls from 1 to 0.</dd>
- <dt>Label</dt>
- <dd>The text within the label associated with the component.</dd>
- <dt>Label Font</dt>
- <dd>The font with which to render the label.</dd>
- </dl>
- <h2>Poke Tool Behavior</h2>
- <p>None.</p>
- <h2>Text Tool Behavior</h2>
- <p>Allows the label associated with the component to be edited.</p>
- <p><a href="../index.html">Back to <em>Library Reference</em></a></p>
- </body>
- </html>
|