Page 4 · Bits to symbols

Block Codes

How 4b/5b, 8b/10b, 64b/66b, 128b/130b and 128b/132b turn raw bits into a stream with transitions, balance and alignment, and what each costs in overhead.

4b/5b

Each 4-bit nibble maps to one of 32 five-bit codes. Sixteen are chosen so that no code has more than one leading zero or more than two trailing zeros, so no more than three zeros ever appear in a row. Sent with NRZI (where a 1 is a transition), that guarantees an edge at least every 4 bits. Some of the spare codes are control symbols (J/K start delimiter, T/R end, idle). It does not balance DC, which is acceptable on fiber (FDDI, 100BASE-FX) and on 100BASE-TX, where a scrambler and MLT-3 follow.

efficiency = 4/5 = 80% 100 Mb/s × 5/4 = 125 MBd

8b/10b

Data byte HGF EDCBAEDCBA5 bitsHGF3 bits5b/6bencoder3b/4bencoderRunning disparityRD = −1 or +1abcdei6 bitsfghj4 bits10-bit symbolEach sub-block has disparity 0 or ±2.If RD is −1, pick the version withmore 1s; if +1, the one with more 0s.Comma K28.5:RD− 001111 1010RD+ 110000 0101The 5 identical bits in "11111" or"00000" cannot occur in data, so thereceiver finds word boundaries from it.
Widmer and Franaszek's 1983 code splits each byte into a 5-bit and a 3-bit part and maps them through two small tables. A running-disparity bit chooses between the two forms of unbalanced code words so the line's 1s and 0s stay even.
  1. Split. Each byte is split into its low 5 bits (EDCBA) and high 3 bits (HGF), written Dx.y: D21.5 is the byte with x = 21, y = 5.
  2. Encode. 5 bits → 6 bits and 3 bits → 4 bits from fixed tables. Every code word has disparity 0 (equal 1s and 0s) or ±2.
  3. Balance. For unbalanced code words both polarities exist. The running disparity (RD) picks the one that pulls the line back toward zero, then flips. RD only ever takes the values −1 and +1.
  4. Guarantees. No more than 5 identical bits in a row, at least 3 transitions per 10-bit symbol, and DC balance bounded at all times.
  5. Control symbols. Twelve K-codes exist outside the data set. K28.5 contains the comma pattern 0011111 or 1100000, which cannot appear in data even across symbol boundaries, so the receiver aligns on it.
  6. Error detection for free. A bit error often produces an invalid code word or a disparity violation, which the receiver flags immediately.
efficiency = 8/10 = 80% PCIe 2.0: 5 GT/s × 0.8 = 4 Gb/s per lane per directionThat 20% was the reason PCIe 3.0 moved to 128b/130b: 8 GT/s × 128/130 = 7.88 Gb/s, nearly double Gen 2 with only a 60% higher signaling rate.

64b/66b

Instead of mapping through tables, 64b/66b prefixes each 64-bit block with a 2-bit sync header and scrambles the payload.

64b/66b data0164 bits data, scrambled64b/66b control10type (8)56 bits control / data, scrambled128b/130b (PCIe)01128 bits, scrambled (16 bytes)128b/132b (USB 3.1, DP 2)4-bit hdr128 bits, scrambledThe header is always 01 or 10 (or a 4-bit code with redundancy): a guaranteed transition and a block marker.
Long block codes add a short sync header to a large scrambled payload. The scrambler, not the code table, provides the transitions and the balance.
efficiency = 64/66 = 97.0% 10GBASE-R: 10 Gb/s × 66/64 = 10.3125 GBd

128b/130b

PCIe 3.0, 4.0 and 5.0 use the same idea with a longer block: a 2-bit header (01 data, 10 ordered set) and 128 bits of payload, scrambled with an additive LFSR that both ends reset at defined points. Ordered sets carry training, skip (clock compensation) and electrical-idle signals. The longer block halves the header overhead again.

efficiency = 128/130 = 98.5%

128b/132b

USB 3.1 Gen 2 (10 Gb/s) and DisplayPort 2.x UHBR rates use a 4-bit header with 128 scrambled bits. The four header bits encode two values with enough redundancy that a single bit error in the header can be corrected, which matters because a corrupted header loses a whole block.

efficiency = 128/132 = 97.0% USB 3.1 Gen 2: 10 Gb/s × 128/132 ≈ 9.7 Gb/s

Other codes you will meet

CodeWhereIdea
TMDS 8→10HDMI 1.x/2.0, DVIXOR/XNOR chain to minimize transitions, then optional inversion for DC balance; 4 special control words for alignment
16b/18bHDMI 2.1 FRLHigher-efficiency block code (89%) with scrambling for 12 Gb/s lanes
4B3B + 3B2T100BASE-T14 bits → 3 bits (rate adaptation), then 3 bits → 2 ternary PAM3 symbols
16b → 7 symbolsMIPI C-PHYMaps a 16-bit word into 7 three-wire symbols
FLIT + FECPCIe 6Fixed 256-byte flow-control units with lightweight FEC and CRC; no per-symbol block code
RS-FEC25G+ Ethernet, 1000BASE-T1Reed-Solomon forward error correction recovers the SNR that PAM or long channels cost

Overhead summary

CodeLine bits per payload bitEfficiencyBalanceMax run
4b/5b1.2580%no3 zeros (with NRZI)
8b/10b1.2580%guaranteed5
TMDS1.2580%guaranteed (approx.)bounded
16b/18b1.12589%scrambledstatistical
64b/66b1.03197.0%scrambled≤ 66
128b/132b1.03197.0%scrambledbounded by headers
128b/130b1.01698.5%scrambledbounded by headers
← PreviousModulation