Data Link Layer and Medium Access Sub Layer · Computer Networks

Block Coding

Watch lectures

Block Coding in Data Communications


1. Principles of Block Coding

In Block Coding, a continuous message stream is divided into blocks of kk bits, called Datawords. To each kk-bit dataword, rr redundant bits are added, producing an nn-bit block called a Codeword where:

n=k+r(n>k)n = k + r \quad (n > k)

Such an error-control code is designated as an (n,k)(n, k) Block Code.

MermaidDiagram
Rendering diagram…

Valid vs. Invalid Codewords:

  • Total possible kk-bit datawords: 2k2^k.
  • Total possible nn-bit patterns: 2n2^n.
  • Number of Valid Codewords: Exactly 2k2^k (one unique codeword for each dataword).
  • Number of Invalid Patterns: 2n−2k2^n - 2^k.
MermaidDiagram
Rendering diagram…
  • Error Detection Principle:
    1. The sender transmits a valid codeword C∈{2k}C \in \{2^k\}.
    2. If transmission noise alters CC into an invalid pattern (one of the 2n−2k2^n - 2^k unused states), the receiver immediately flags an Error Detected.
    3. Undetected Error: If corruption alters CC into another valid codeword, the receiver accepts it as valid data, failing to detect the corruption.

2. Linear Block Codes

A block code is called a Linear Block Code if and only if the bitwise exclusive-OR (modulo-2 addition ⊕\oplus) of any two valid codewords yields another valid codeword in the codebook:

C1⊕C2=C3(where C1,C2,C3 are valid codewords)C_1 \oplus C_2 = C_3 \quad (\text{where } C_1, C_2, C_3 \text{ are valid codewords})

Generator Matrix (GG) and Parity Check Matrix (HH):

For an (n,k)(n, k) systematic linear block code:

  1. Generator Matrix GG of dimension k×nk \times n:
G=[Ik∣P]G = [I_k \mid P]

(where IkI_k is a k×kk \times k identity matrix and PP is a k×(n−k)k \times (n-k) parity submatrix).
Codeword generation:

C=D⋅GC = D \cdot G
  1. Parity Check Matrix HH of dimension (n−k)×n(n-k) \times n:
H=[PT∣In−k]H = [P^T \mid I_{n-k}]

A received vector YY is valid if and only if:

Y⋅HT=0Y \cdot H^T = 0

Syndrome Decoding (SS):

The receiver multiplies the received nn-bit vector YY by the transpose of HH:

S=Y⋅HTS = Y \cdot H^T
  • If S=0S = 0: No detectable error occurred; strip redundant bits to extract data.
  • If **$S
    eq 0∗∗:Anerroroccurred.Thevalueof**: An error occurred. The value of S(calledthe∗∗Syndrome∗∗)directlymatchesacolumnin (called the **Syndrome**) directly matches a column in H$, pinpointing the exact bit index that flipped!

3. Physical Layer Block Line Codes: 4B/5B and 8B/10B

In physical-layer digital transmission, long sequences of consecutive 0s or 1s cause baseline wander and loss of clock synchronization. Physical block coding maps mm-bit groups to nn-bit symbols (m<nm < n) to ensure frequent voltage transitions.

MermaidDiagram
Rendering diagram…

1. 4B/5B Encoding (Fast Ethernet — 100Base-TX):

  • Maps each 4-bit data nibble (24=162^4 = 16 data values) to a 5-bit code pattern (25=322^5 = 32 possible symbols).
  • Guarantees no more than three consecutive 0s in the output stream, preventing clock drift when modulated via NRZ-I.
  • Unused 5-bit symbols are reserved for control (Start Delimiter J/K, End Delimiter T/R, Idle I).
  • Efficiency: 45=80%\frac{4}{5} = 80\%.

2. 8B/10B Encoding (Gigabit Ethernet — 1000Base-X):

  • Maps 8-bit bytes (256256 values) to 10-bit symbols (10241024 patterns).
  • Maintains DC Balance (equal count of 0s and 1s using Running Disparity ±1\pm 1).
  • Efficiency: 810=80%\frac{8}{10} = 80\%.

Frequently Asked Questions

QIn a (7, 4) linear block code, how many valid codewords and how many invalid patterns exist?
  • k=4k = 4, n=7n = 7.
  • Valid codewords = 2k=24=162^k = 2^4 = 16.
  • Total patterns = 2n=27=1282^n = 2^7 = 128.
  • Invalid patterns = 128−16=112128 - 16 = 112.
QWhat defines a Linear Block Code?

The modulo-2 XOR sum of any two valid codewords in the codebook must produce another valid codeword from the same codebook.

QWhy is 4B/5B encoding combined with NRZ-I in Fast Ethernet?

NRZ-I transitions on bit 1 but produces no transition on bit 0. A long run of zeros would cause the receiver's clock to lose synchronization. 4B/5B ensures that no pattern produces more than three consecutive zeros, guaranteeing frequent clock recovery transitions.

QWhat is a syndrome in a linear block code?

The syndrome is S=Y⋅HTS = Y \cdot H^T, computed from the received vector YY. If S=0S = 0 no error is detected. If $S
eq 0,itsvaluematchesacolumnof, its value matches a column of H$ and so locates the flipped bit.

Student FinanceWeb Platform

Pocketly — Personal Finance for Students

Keep your hostel and college expenses under control. Track accounts, log spending in seconds, and stay within your monthly budget.

← All Computer Networks modules