package random
- Alphabetic
- Public
- Protected
Type Members
- 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.
- 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.
- 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.
- sealed trait LFSRReduce extends (Bool, Bool) => Bool
A reduction operation for an LFSR.
- 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))
- 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))
- abstract class PRNG extends Module
An abstract class representing a Pseudo Random Number Generator (PRNG)
- class PRNGIO extends Bundle
Pseudo Random Number Generators (PRNG) interface
Value Members
- 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)
- 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)
- 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)
- object PRNG
Helper utilities related to the construction of Pseudo Random Number Generators (PRNGs)
- object XNOR extends LFSRReduce
Not XOR (exclusive or) reduction operation
- object XOR extends LFSRReduce
XOR (exclusive or) reduction operation