class sdr.AdditiveScrambler

Implements an additive scrambler.

Notes

Additive Scrambler Block Diagram
         +--------------@<-------------@<------------@<-------------+
         |              ^              ^             ^              |
         |              | c_n-1        | c_n-2       | c_1          | c_0
         |              | T[0]         | T[1]        | T[n-2]       | T[n-1]
         |              |              |             |              |
         |  +--------+  |  +--------+  |             |  +--------+  |
         +->|  S[0]  |--+->|  S[1]  |--+---  ...  ---+->| S[n-1] |--+
         |  +--------+     +--------+                   +--------+
         |
         v
 x[n] -->@--> y[n]

 S[k] = State vector
 T[k] = Taps vector
 x[n] = Input sequence
 y[n] = Output sequence
 @ = Finite field adder

References

Examples

Construct the additive scrambler used in IEEE 802.11.

In [1]: c = galois.Poly.Degrees([7, 3, 0]); c
Out[1]: Poly(x^7 + x^3 + 1, GF(2))

In [2]: scrambler = sdr.AdditiveScrambler(c)

Scramble and descramble a sequence.

In [3]: x = np.random.randint(0, 2, 20); x
Out[3]: array([0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1])

In [4]: y = scrambler.scramble(x); y
Out[4]: array([0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1])

In [5]: xx = scrambler.descramble(y); xx
Out[5]: array([0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1])

In [6]: np.array_equal(x, xx)
Out[6]: True

Constructors

AdditiveScrambler(characteristic_poly: PolyLike | None = None, ...)

Creates an additive scrambler.

Methods

scramble(x: ArrayLike) NDArray[int_]

Scrambles the binary input sequence \(x[n]\).

descramble(y: ArrayLike) NDArray[int_]

Descrambles the binary input sequence \(y[n]\).

Properties

property lfsr : FLFSR

The Fibonacci LFSR used for scrambling.