TX01234567891001010101010101010101010123456789100101010101010101010101RX1g = 0b1011 # x^3 + x + 12a = 0b11010011 << 3 # 3 zeros3for i in range(10, 2, -1):4 if a >> i & 1: a ^= g << i-311 bits1011
0246810-2-1012t (µs)v (V)LINE VOLTAGE v(t)11010011011sent · received123456780255075100burst length (bits)caught (%)BURSTS CAUGHT (%)1001001007587.587.587.587.5length ≤ 3: all caught
Coloured parts: what the current step is about; everything else rests in whiteBlocks: sender and receiver registers of bit lamps (a lit lamp is a 1), the cable, the noise source, a Python cardPlots: the line voltage sent and received, and the share of bursts caught by lengthThe 1011 tray is the generator G: it hops along a row and XORs the lamps under itThe message 11010011 is divided by G = 1011 (x³ + x + 1) with XOR; the remainder 011 is the CRC. The receiver divides the whole frame again: remainder 000 means accept. Real CRC-32 (Ethernet, zlib) presets the register to all ones, feeds each byte low bit first and inverts the result; the error-catching comes from the same division by G.

Bursts and polynomials

  1. A spike of interference does not flip one lone bit. It lasts a while, so it flips a run of neighbouring bits: a burst. Here one click flips 3 bits in a row. A single parity bit misses any even number of flips.

Sender: compute the CRC

Receiver: check it

Why it works, and its limits

CRC in code and in Ethernet

The working

# step 1/12 · bursts

line: +1 V = bit 1, −1 V = bit 0
one bit every 1 µs

sent      11010011011
received  11011101011
              ^^^  bits 4, 5, 6 flipped

burst = errors packed close together
(scratches, lightning, a motor switching on)
parity: 2 flips cancel out, unseen

Every bit in the figure comes from the model: the message 11010011, the generator 1011 (x³ + x + 1, listed as CRC-3-GSM), the remainder 011 and both bursts are computed, and the bar chart is made by trying every burst of each length at every position in the 11-bit frame. The line plot is an example: polar NRZ (+1 V for a 1, −1 V for a 0) at one bit per microsecond, with an interference click modelled as a decaying oscillation. The receiver reads each bit in the middle of its slot.