DexterLab

🚨 New downloadable modules coming soon📘 Electrical Signaling & PHY Interfaces — new overview📘 Electrical I/O Standards — new overview📘 Integration between Theory and Design Library in progress

8b/10b — Overview, Tables & Implementation Notes

Overview

8b/10b encoding maps each 8‑bit symbol into a 10‑bit code group with controlled disparity and guaranteed transition density. It provides DC balance, bounded run length, control characters, and immediate error detection. It is used in Gigabit Ethernet, PCIe Gen1/2, Fibre Channel, Serial RapidIO, SATA, and early DisplayPort.

This page consolidates the architectural description, encoding/decoding tables, K‑character definitions, and RTL implementation notes.

1. Why 8b/10b Exists

  • DC balance through running disparity
  • Transition density for stable CDR
  • Control characters (K‑codes) for alignment and protocol control
  • Error detection via invalid codes and disparity violations

2. Encoder & Decoder Architecture

Encoder

  • 8 bits → 5b/6b encoder3b/4b encoder → 10 bits
  • running disparity determines RD– or RD+ version
  • explicit handling of K‑codes

Decoder

  • 10 bits → 6b/5b decoder4b/3b decoder → 8 bits
  • classification (data vs control)
  • disparity validation
  • error detection

3. Running Disparity (RD)

Running disparity is a single‑bit state:

  • RD = +1 → previous symbol had more 1s
  • RD = –1 → previous symbol had more 0s

Each symbol has two versions (RD– and RD+).
The encoder selects the version that keeps RD bounded.

4. Control Characters (K‑codes)

K‑characters are special non‑data symbols used for:

  • comma alignment
  • framing
  • training sequences
  • protocol control

K28.5 is the canonical comma symbol and the only K‑character that is provably non‑emulable by any D.x.y pattern.

5. 5b/6b Encoding Table

Input (5b)RD− Code (6b)RD+ Code (6b)Notes
00000100111011000D.0
00001011101100010D.1
00010101101010010D.2
00011110001110001D.3 (neutral)
00100110101001010D.4
00101101001101001D.5 (neutral)
00110011001011001D.6 (neutral)
00111111000000111D.7
01000111001000110D.8
01001100101100101D.9 (neutral)
01010010101010101D.10 (neutral)
01011110100001011D.11
01100001101001101D.12 (neutral)
01101101100010011D.13
01110011100100011D.14
01111010111101000D.15
10000011011100100D.16
10001100011011100D.17
10010010011101100D.18
10011110010110010D.19 (neutral)
10100001011110100D.20
10101101010010101D.21
10110011010100101D.22
10111111010000101D.23
11000110011001100D.24
11001100110011001D.25
11010010110101001D.26
11011110110001001D.27
11100001110110001D.28
11101101110010001D.29
11110011110100001D.30
11111101011010100D.31

6. 3b/4b Encoding Table

Input (3b)RD− Code (4b)RD+ Code (4b)Notes
00001001011D.x.0
00110010110D.x.1
01001011010D.x.2
01111000011D.x.3
10011010010D.x.4
10110110100D.x.5
11001111000D.x.6
11111100001D.x.7

7. K‑Character Tables

K‑Character Table

K‑code5b/6b (RD− / RD+)3b/4b (RD− / RD+)Notes
K28.0001111 / 1100000100 / 1011Special
K28.1001111 / 1100001001 / 0110Special
K28.2001111 / 1100000101 / 1010Special
K28.5001111 / 1100001010 / 0101Comma character
K28.6001111 / 1100000111 / 1000Special
K28.7001111 / 1100001110 / 0001Special

Non‑Emulability Notes

  • K28.5 has a unique run‑length pattern → cannot be produced by any D‑character
  • other K‑characters are reserved but not mathematically unique

Example Table

K‑code10b patternNotes
K.28.5001111 1010 / 110000 0101Comma symbol; the only K‑character that is provably non‑emulable by any D.x.y.
K.28.0001111 0100 / 110000 1011Reserved control symbol; may overlap with D‑patterns depending on disparity.
K.28.1001111 1001 / 110000 0110Control symbol; not used for comma alignment.
K.28.2001111 0101 / 110000 1010Reserved control symbol.
K.28.3001111 0011 / 110000 1100Protocol‑level control; not guaranteed to be non‑emulable.
K.28.4001111 0010 / 110000 1101Reserved control symbol.
K.28.6001111 0110 / 110000 1001Control symbol; may share patterns with D‑characters.
K.28.7001111 1110 / 110000 0001Reserved control symbol; not a comma.

8. 6b/5b Decoding Table

6b code5b outputNotes
10011100000D.0
01100000000D.0
01110100001D.1
10001000001D.1
10110100010D.2
01001000010D.2
11000100011D.3 (also used by D.28, context‑dependent)
11010100100D.4
00101000100D.4
10100100101D.5
01100100110D.6 (also used by D.25, context‑dependent)
11100000111D.7
00011100111D.7
11100101000D.8
00011001000D.8
10010101001D.9 (also used by D.22, context‑dependent)
01010101010D.10 (also used by D.21, context‑dependent)
11010001011D.11 (also used by D.20, context‑dependent)
00101101011D.11 (also used by D.20, context‑dependent)
00110101100D.12
10110001101D.13 (also used by D.18, context‑dependent)
01001101101D.13 (also used by D.18, context‑dependent)
01110001110D.14 (also used by D.17, context‑dependent)
10001101110D.14 (also used by D.17, context‑dependent)
01011101111D.15
10100001111D.15
01101110000D.16
10010010000D.16
10001110001D.17 (also used by D.14, context‑dependent)
01110010001D.17 (also used by D.14, context‑dependent)
01001110010D.18 (also used by D.13, context‑dependent)
10110010010D.18 (also used by D.13, context‑dependent)
11001010011D.19
00101110100D.20 (also used by D.11, context‑dependent)
11010010100D.20 (also used by D.11, context‑dependent)
10101010101D.21 (also used by D.10, context‑dependent)
01010110101D.21 (also used by D.10, context‑dependent)
01101010110D.22 (also used by D.9, context‑dependent)
10010110110D.22 (also used by D.9, context‑dependent)
11101010111D.23
00010110111D.23
11001111000D.24
00110011000D.24
10011011001D.25
01100111001D.25 (also used by D.6, context‑dependent)
01011011010D.26
10100111010D.26 (also used by D.5, context‑dependent)
11011011011D.27
00100111011D.27
00111011100D.28
11000111100D.28 (also used by D.3, context‑dependent)
10111011101D.29
01000111101D.29
01111011110D.30
10000111110D.30
10101111111D.31
01010011111D.31

9. 4b/3b Decoding Table

4b code3b outputNotes
0100000D.x.0 (also used by D.x.5, context‑dependent)
1011000D.x.0 (also used by D.x.5, context‑dependent)
1001001D.x.1
0110001D.x.1
0101010D.x.2
1010010D.x.2
1100011D.x.3
0011011D.x.3
1101100D.x.4
0010100D.x.4
1011101D.x.5 (also used by D.x.0, context‑dependent)
0100101D.x.5 (also used by D.x.0, context‑dependent)
0111110D.x.6
1000110D.x.6
1110111D.x.7
0001111D.x.7

10. RTL Implementation Notes

Encoder

  • table‑driven or logic‑driven
  • RD stored as a single flip‑flop
  • explicit K‑code handling
  • optional pipelining
  • bit ordering must match serializer

Decoder

  • detect invalid 10‑bit codes
  • detect disparity errors
  • extract K‑flag
  • reconstruct 8‑bit symbol
  • provide error flags

11. Example VHDL Skeleton

entity encoder_8b10b is
  port (
    clk   : in  std_logic;
    din   : in  std_logic_vector(7 downto 0);
    kin   : in  std_logic;
    dout  : out std_logic_vector(9 downto 0);
    rdout : out std_logic
  );
end entity;

12. Summary

8b/10b encoding provides:

  • DC balance
  • transition density
  • control characters
  • error detection

It is simple, robust, and ideal for medium‑speed serial links with PLL‑based CDR.

Related Pages