chisel6.4.0 < Back


# Packages

-  package root
  Definition Classes
    root
-  package chisel3

  This package contains the main chisel3 API.

  This package contains the main chisel3 API.

  Definition Classes
    root
-  package util

  The util package provides extensions to core chisel for common hardware components and utility functions

  The util package provides extensions to core chisel for common hardware components and utility functions

  Definition Classes
    chisel3
-  package circt
  Definition Classes
    util
-  package experimental
  Definition Classes
    util
-  package random
  Definition Classes
    util
- FibonacciLFSR
- GaloisLFSR
- LFSR
- LFSRReduce
- MaxPeriodFibonacciLFSR
- MaxPeriodGaloisLFSR
- PRNG
- PRNGIO
- XNOR
- XOR

p

chisel3.util

# random

#### package random

Content Hierarchy

Ordering

1. Alphabetic

Visibility

1. Public
2. Protected

### Type Members

1.  class FibonacciLFSR extends PRNG with LFSR

   Fibonacci Linear Feedback Shift Register (LFSR) generator.

   Fibonacci Linear Feedback Shift Register (LFSR) generator.

   A Fibonacci LFSR can be generated by defining a width and a set of tap points (corresponding to a polynomial). An optional initial seed and a reduction operation (XOR, the default, or XNOR) can be used to augment the generated hardware. The resulting hardware has support for a run-time programmable seed (via PRNGIO.seed) and conditional increment (via PRNGIO.increment).

   If the user specifies a seed, then a compile-time check is added that they are not initializing the LFSR to a state which will cause it to lock up. If the user does not set a seed, then the least significant bit of the state will be set or reset based on the choice of reduction operator.

   In the example below, a 4-bit Fibonacci LFSR is constructed. Tap points are defined as four and three (using LFSR convention of indexing from one). This results in the hardware configuration shown in the diagram.

       val lfsr4 = Module(new FibonacciLFSR(4, Set(4, 3))
       //                 +---+
       // +-------------->|XOR|-------------------------------------------------------+
       // |               +---+                                                       |
       // |   +-------+     ^     +-------+           +-------+           +-------+   |
       // |   |       |     |     |       |           |       |           |       |   |
       // +---+  x^4  |<----+-----|  x^3  |<----------|  x^2  |<----------|  x^1  |<--+
       //     |       |           |       |           |       |           |       |
       //     +-------+           +-------+           +-------+           +-------+

   If you require a maximal period Fibonacci LFSR of a specific width, you can use MaxPeriodFibonacciLFSR. If you only require a pseudorandom UInt you can use the FibonacciLFSR companion object.

   See also

     https://en.wikipedia.org/wiki/Linear-feedback_shift_register#Fibonacci_LFSRs

2.  class GaloisLFSR extends PRNG with LFSR

   Galois Linear Feedback Shift Register (LFSR) generator.

   Galois Linear Feedback Shift Register (LFSR) generator.

   A Galois LFSR can be generated by defining a width and a set of tap points. Optionally, an initial seed and a reduction operation (XOR, the default, or XNOR) can be used to augment the generated hardware. The resulting hardware has support for a run-time programmable seed (via PRNGIO.seed) and conditional increment (via PRNGIO.increment).

   If the user specifies a seed, then a compile-time check is added that they are not initializing the LFSR to a state which will cause it to lock up. If the user does not set a seed, then the least significant bit of the state will be set or reset based on the choice of reduction operator.

   In the example below, a 4-bit LFSR Galois LFSR is constructed. The tap points are defined as four and three (using LFSR convention of indexing from one). This results in the hardware configuration shown in the diagram.

       val lfsr4 = Module(new GaloisLFSR(4, Set(4, 3))
       // +-----------------+---------------------------------------------------------+
       // |                 |                                                         |
       // |   +-------+     v     +-------+           +-------+           +-------+   |
       // |   |       |   +---+   |       |           |       |           |       |   |
       // +-->|  x^4  |-->|XOR|-->|  x^3  |---------->|  x^2  |---------->|  x^1  |---+
       //     |       |   +---+   |       |           |       |           |       |
       //     +-------+           +-------+           +-------+           +-------+

   If you require a maximal period Galois LFSR of a specific width, you can use MaxPeriodGaloisLFSR. If you only require a pseudorandom UInt you can use the GaloisLFSR companion object.

   See also

     https://en.wikipedia.org/wiki/Linear-feedback_shift_register#Galois_LFSRs

3.  trait LFSR extends PRNG

   Trait that defines a Linear Feedback Shift Register (LFSR).

   Trait that defines a Linear Feedback Shift Register (LFSR).

   If the user specifies a seed, then a compile-time check is added that they are not initializing the LFSR to a state which will cause it to lock up. If the user does not set a seed, then the least significant bit of the state will be set or reset based on the choice of reduction operator.

   See also

     FibonacciLFSR

     GaloisLFSR

     https://en.wikipedia.org/wiki/Linear-feedback_shift_register

4.  sealed trait LFSRReduce extends (Bool, Bool) => Bool

   A reduction operation for an LFSR.

   A reduction operation for an LFSR.

   See also

     XOR

     XNOR

5.  class MaxPeriodFibonacciLFSR extends FibonacciLFSR

   A maximal period Fibonacci Linear Feedback Shift Register (LFSR) generator.

   A maximal period Fibonacci Linear Feedback Shift Register (LFSR) generator. The maximal period taps are sourced from LFSR.tapsMaxPeriod.

       val lfsr8 = Module(new MaxPeriodFibonacciLFSR(8))

6.  class MaxPeriodGaloisLFSR extends GaloisLFSR

   A maximal period Galois Linear Feedback Shift Register (LFSR) generator.

   A maximal period Galois Linear Feedback Shift Register (LFSR) generator. The maximal period taps are sourced from LFSR.tapsMaxPeriod.

       val lfsr8 = Module(new MaxPeriodGaloisLFSR(8))

7.  abstract class PRNG extends Module

   An abstract class representing a Pseudo Random Number Generator (PRNG)

8.  class PRNGIO extends Bundle

   Pseudo Random Number Generators (PRNG) interface

### Value Members

1.  object FibonacciLFSR

   Utility for generating a pseudorandom UInt from a FibonacciLFSR.

   Utility for generating a pseudorandom UInt from a FibonacciLFSR.

   For example, to generate a pseudorandom 8-bit UInt that changes every cycle, you can use:

       val pseudoRandomNumber = FibonacciLFSR.maxPeriod(8)

2.  object GaloisLFSR

   Utility for generating a pseudorandom UInt from a GaloisLFSR.

   Utility for generating a pseudorandom UInt from a GaloisLFSR.

   For example, to generate a pseudorandom 8-bit UInt that changes every cycle, you can use:

       val pseudoRandomNumber = GaloisLFSR.maxPeriod(8)

3.  object LFSR

   Utilities related to psuedorandom number generation using Linear Feedback Shift Registers (LFSRs).

   Utilities related to psuedorandom number generation using Linear Feedback Shift Registers (LFSRs).

   For example, to generate a pseudorandom 16-bit UInt that changes every cycle, you can use:

       val pseudoRandomNumber = LFSR(16)

4.  object PRNG

   Helper utilities related to the construction of Pseudo Random Number Generators (PRNGs)

5.  object XNOR extends LFSRReduce

   Not XOR (exclusive or) reduction operation

6.  object XOR extends LFSRReduce

   XOR (exclusive or) reduction operation

### Ungrouped