Configurable Fibonacci linear-feedback shift register with a weighted register-to-output projection. More...
#include <lfsr.hpp>
Public Member Functions | |
| bool | configure (int length, std::uint32_t feedback_mask, std::uint32_t seed) noexcept |
| bool | set_length (int length) noexcept |
| bool | set_feedback_mask (std::uint32_t mask) noexcept |
| void | set_seed (std::uint32_t seed) noexcept |
| bool | set_weight (std::size_t bit, SampleType weight) noexcept |
| void | clear_weights () noexcept |
| bool | set_offset (SampleType offset) noexcept |
| void | reset () noexcept |
| std::uint32_t | clock (bool external_bit=false) noexcept |
| SampleType | weighted_output () const noexcept |
| SampleType | minimum_output () const noexcept |
| SampleType | maximum_output () const noexcept |
| int | length () const noexcept |
| std::uint32_t | feedback_mask () const noexcept |
| std::uint32_t | seed () const noexcept |
| std::uint32_t | state () const noexcept |
| SampleType | offset () const noexcept |
Static Public Member Functions | |
| static constexpr int | latency_samples () noexcept |
| static constexpr int | tail_samples () noexcept |
Static Public Attributes | |
| static constexpr int | kMinLength = 2 |
| static constexpr int | kMaxLength = 32 |
| static constexpr int | kDefaultLength = 8 |
| static constexpr std::uint32_t | kDefaultFeedbackMask = 0x8Eu |
| static constexpr std::uint32_t | kDefaultSeed = 0b10110100u |
Configurable Fibonacci linear-feedback shift register with a weighted register-to-output projection.
The register shifts toward the most-significant bit. On each clock(), the new bit is the parity of state & feedback_mask, optionally XOR-ed with an external bit. Bit weights are expressed directly in caller-defined output units; weighted_output() is offset + sum(weight[i]) for every high bit. Its exact range is therefore reported by minimum_output() and maximum_output().
Length is 2..32 bits. A zero seed is intentionally legal and absorbing unless an external high bit is clocked; this preserves Rungler patch semantics. A maximal-period sequence requires a nonzero seed and a primitive-polynomial feedback mask chosen by the caller. The default mask 0x8e is audited by the direct full-period oracle as a primitive 8-bit configuration; arbitrary caller masks intentionally make no period claim.
RT contract: all methods are bounded scalar/array work with no allocation, locks, I/O, or hidden entropy. reset() restores the public seed exactly. Latency and tail are both zero samples.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinestaticconstexprnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinestaticconstexprnoexcept |
|
inlinenoexcept |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |