0% found this document useful (0 votes)
23 views37 pages

Ec441 Error

The document discusses Error Control Coding in computer networking, focusing on methods to reduce the bit error rate (BER) while managing throughput. It explains concepts such as block codes, coding and decoding processes, error detection and correction techniques, and the importance of minimum distance in code design. The document also provides examples of error control methods, their performance, and a comparison of bit error rates for different coding strategies.

Uploaded by

starlionjiang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views37 pages

Ec441 Error

The document discusses Error Control Coding in computer networking, focusing on methods to reduce the bit error rate (BER) while managing throughput. It explains concepts such as block codes, coding and decoding processes, error detection and correction techniques, and the importance of minimum distance in code design. The document also provides examples of error control methods, their performance, and a comparison of bit error rates for different coding strategies.

Uploaded by

starlionjiang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

EC441 Intro To Computer Networking

Error Control Coding

Prof. Jeff Carruthers

Electrical and Computer Engineering


Boston University

Spring 2025

Carruthers (ECE @ BU) ECC Spring 2025 1 / 37


Link: Error Control

Error Control Coding

goal: decrease residual bit error rate “BER”, without reducing throughput too much.
idea: add redundancy to allow for detection of errors.
tradeoff : increasing redundant bits improves BER but decreases throughput

Carruthers (ECE @ BU) ECC Spring 2025 2 / 37


Link: Error Control

Introduction

Error-control coding
take k data bits (call it Data), transmit a n-bit long codeword (call it W ord)
there are 2k valid codewords and 2n − 2k other possible words
this is called a block code, often designated as an (n, k) block code.

Carruthers (ECE @ BU) ECC Spring 2025 3 / 37


Link: Error Control

Coding and Decoding a Codeword

calculate
W ord = g(Data)
and send W ord
at receiver, calculate
Data = g −1 (Received W ord)
often, W ord = Data f (Data), i.e, we send original data plus “check bits”:

Data |f (Data)

k
the efficiency or rate of the code is Rc = n

Carruthers (ECE @ BU) ECC Spring 2025 4 / 37


Link: Error Control

Error Control Options

error correction: any received W ord is mapped into some Data


error detection: only the 2k valid words are accepted.
combination of detection and correction:
some non-codewords are rejected
some non-codewords are corrected
all codewords are accepted

Carruthers (ECE @ BU) ECC Spring 2025 5 / 37


Link: Error Control

Examples I

Parity Bit code (Even)


Here, n − k = 1, and we send the k data bits followed by a parity bit which forces an even
number of ones in the k + 1-bit codeword.
Repetition Code
Now k = 1 and we can pick n as large as is required. There are two codewords: n zeros or n
ones.

Carruthers (ECE @ BU) ECC Spring 2025 6 / 37


Link: Error Control

Combined error-detection and error-correction

ed
dmin
ec

Error correction and detection capability of a code.


If the received word is in a sphere, the receiver chooses the closest codeword. If the received
word is not in a sphere, we have detected an error but cannot correct the error

Carruthers (ECE @ BU) ECC Spring 2025 7 / 37


Link: Error Control

Maximum error-correction

................................
................ .........
......... .......
......
...... ......
.....
..... .....
..... .....
....
.... ....
.... ....
......
.
....
....
.
. ... ...
r...... r ..
...
..
. r .....
..
. ...
... ..
..
....
. ...
. ...
.. ..
..
. r ..
..
.
. t ..
..
..
. ..
...
... r r .....
... ...
... ..
... ..
.. ... r
.. ..
..
. ..
.
. .
.........................r
..................... ... .
......... .........
....... ..... ...
....... r ...
..... ..... ... ....
..... ..... .... ....
..... ..... ... ....
.....
....
..........
.... ..... r ....
.... ..............
........................................
........
.... .... .... ............. .......
.....
.
.... ......
.. .
. . . ..
...............
. .....
.....
... ....... . .
... ......... ............ .....
r......
... ... ............. ..............
...
...
.. .................................... ....... ....
.. .
.. r .. .... r
.
r ..........
..
... ....
.. r ... .... ...
... ..
... ... ...
... . ... ..
.. . ..
.. ... ... ..
... . r .
... ...
... ... . ..
.. t r ... ..
.. ... ..
. ...
.. . . ..
... ... ..
... ... .
.
.. r ..
..
...
... ...
.
. ..
...
t .
.
.
.
.. .. .. .
..
... . .. ..
.. ... ... ..
.. .... . ....
.
.. .. .
..
... ... ... ..
... ... ...
....
.... .... r ..
... r .
.
.
.... r .... .. r ..
.... .
. ..... .. . . .. . ..
.....
......
. .................
... .
.
..
.... .... ..
..... ..... ............ ......... . ..
..... ............. ...... ..... ...
...... ........... ...... .... ...
....
....... ........... ..... ....
.......... ........... ..... .... ....
.............................................................. ......... ....
. .......... .....
.... .... ..... .....
.... r .... ..... .....
.... .... ........ ......
... ......... .......
... ... ................ .........
..
.
..
. .................................
.. ..
..
... ..
.. ...
r
... ..
..
.. r r ..
...
.. ..
..
r ..
. ..
..
.
.
.
.
t ...
.
.
.. ...
..
... ...
..
.
...
...
r ...
. r
.. r ...
..
... ...
..
... ..
... ..
... ..
... ...
.... ...
...
.... ....
....
.... .
......
..... ...
..... .....
...... .....
....... ......
........ .......
............ ........
.. .............

Carruthers (ECE @ BU) ECC Spring 2025 8 / 37


Link: Error Control

Maximum error-detection

Carruthers (ECE @ BU) ECC Spring 2025 9 / 37


Link: Error Control

Code design and Minimum Distance

A code is a set C of n-bit codewords.


Hamming distance
the Hamming distance between two codewords is the number of bits in which they differ.
For example, dist(0011, 1010) = 2 since they differ in the 1st and 4th positions.
the minimum distance of a code is the Hamming distance between the two closest
codewords, i.e. it is the minimum of all Hamming distances between each pair of codewords.

Carruthers (ECE @ BU) ECC Spring 2025 10 / 37


Link: Error Control

Code Power
Define:

ec to be the number of errors guaranteed to be corrected successfully, and


ed to be the number of errors guaranteed to be detected successfully.

Carruthers (ECE @ BU) ECC Spring 2025 11 / 37


Link: Error Control

Receiver algorithm

Let e be the number of apparent errors, and R be the received word. Then

e = min dist(R, Ci )
i

If 0 ≤ e ≤ ec , then pick Ci as correct code, i.e. assume R should have been Ci


If ec < e, then request a retransmission, discard, or pick any of the codes Ci with
dist(R, Ci ) = e
the algorithm is described by a set C of codewords and two parameters ec and ed .

Carruthers (ECE @ BU) ECC Spring 2025 12 / 37


Link: Error Control

To Detect or Correct? I
Theorem.
For a code with minimum distance dmin , the receiving data link agent uses an (ec , ed ) pair that
must satisfy

ec + ed ≤ dmin − 1 (1)
ec ≤ ed (2)

Proof: One can get the intuition by looking at Figure 1 (a) and the receiver error-control
algorithm.
If in a given situation we can correct an error, we must necessarily detect its presence. Hence
ec ≤ ed .
Suppose ec + ed = dmin . This means for the two closest codewords Ci and Cj , there is a
codeword that is ec away from Ci and ed away from Cj . What do we do with this codeword? If
T = Ci , then we are required to correct R to Ci . If T = Cj , we are required to throw this R
Carruthers (ECE @ BU) ECC Spring 2025 13 / 37
Link: Error Control

To Detect or Correct? II

away. The algorithm is written such that we must correct R to Ci . Hence , we cannot guarantee
both conditions for all codewords (refer to the definitions of ec and ed ). So we must have
ec + ed < dmin .

Carruthers (ECE @ BU) ECC Spring 2025 14 / 37


Link: Error Control

Code Performance from ec and ed I

Define:
(ed )max to be the largest possible choice for ed , and
(ec )max to be the largest possible choice for ec .
For example, if dmin = 7, then we can choose the following options:

ec ed
0 6 ⇐ (ed )max = 6
1 5
2 4
3 3 ⇐ (ec )max = 3
Receiver code design

Carruthers (ECE @ BU) ECC Spring 2025 15 / 37


Link: Error Control

What dmin means

(0, dmin − 1) is the best error-detecting code


(⌊ 21 (dmin − 1)⌋, ⌊ 21 (dmin − 1)⌋) is the best error-correcting code
we cannot successfully do (⌊ 12 (dmin − 1)⌋, dmin − 1), i.e. we must choose between doing our
best at detection and our best at correction.
Choosing dmin
  
detect d+1
To d errors requires dmin = (3)
correct 2d + 1

Carruthers (ECE @ BU) ECC Spring 2025 16 / 37


Link: Error Control

dmin Summary I

(1) Equation (1) says we must tradeoff ec for ed . So we should make ec = 0 in which case
ed = dmin − 1.
(2) We maximize ec by making ec = ed , and so 2ec ≤ dmin − 1 or ec ≤ (dmin − 1)/2. Since ec is
an integer, ec = ⌊(dmin − 1)/2⌋ is the best we can do.

Carruthers (ECE @ BU) ECC Spring 2025 17 / 37


Link: Error Control

Parity/Repetition Performance

Parity bit codes have a rate k/(k + 1) and dmin = 2. Hence, they allow single-bit error detection
and no error correction.
Repetition by n gives a code with rate 1/n and dmin = n. Hence, it allows n − 1 errors to be
detected OR ⌊(n − 1)/2⌋ errors to be corrected.

Carruthers (ECE @ BU) ECC Spring 2025 18 / 37


Link: Error Control

Single-Bit Error Correction I

Theorem
Single-bit error correction requires the codeword length n to satisfy

(n + 1) ≤ 2n−k . (4)

If n is less than the minimum value satisfying (4), the code is not single-bit error correcting.
Proof: Each codeword requires n + 1 words to itself: the codeword and the n adjacent words.
Hence we must have
2k (n + 1)
codewords, whereas we actually have 2n .

Carruthers (ECE @ BU) ECC Spring 2025 19 / 37


Link: Error Control

Discussion: 1-bit EC

the above puts a limit on the maximum length of frame we can accommodate for single-bit
error correction
if we increase n, we can eventually satisfy the equation
the condition is necessary but not sufficient

Carruthers (ECE @ BU) ECC Spring 2025 20 / 37


Link: Error Control

BER comparison example I

Calculate utilization U and residual probability of bit error Pe for


single-bit error detection
single-bit error correction
rate 1/3 repetition coding with error correction
assuming
n = 1000
BER = 10−6
we use the most efficient codes possible
we retransmit if there is a detected error.

Carruthers (ECE @ BU) ECC Spring 2025 21 / 37


Link: Error Control

BER comparison example II

Results:
The results we will derive are summarized in the following table:
Method U Pe
single-bit error detection 0.998 10−9
single-bit error correction 0.990 10−9
rate 1/3 repetition coding 0.333 10−12
Discussion
the rate 1/3 code is inefficient
error detection is 5 times more efficient than error correction in this case, which is a typical
number.

Carruthers (ECE @ BU) ECC Spring 2025 22 / 37


Link: Error Control

BER comparison example III

We assume the errors in each bit are independent, and so the number of errors in a block is
binomial with N = 1000, p = 10−6 .
The probability of w errors is

N!
f (w) = pw (1 − p)N −w
w!(N − w)!

which works out to f (0) = 0.999, f (1) = 0.001, f (2) = 10−6.3 ,and f (3) = 10−9.8 .
Single-bit error correction.
Solve (1000 + 1) < 2n−k and get n − k = 10. This assumes we can find such an optimal error
correction code. No retransmissions are used, so U = 990/1000. The residual bit error rate is

Pe = E(number of uncorrected errors/frame)/N

Carruthers (ECE @ BU) ECC Spring 2025 23 / 37


Link: Error Control

BER comparison example IV

which is
N
X
Pe = qf (q)/1000 (5)
q=2

≈ (2 ∗ 10−6.3 + 3 ∗ 10−9.8 )/1000 (6)


−9
≈ 10 . (7)

Single-bit error detection.


We can use n − k = 1, a parity bit code. Calculate E(M ), number of transmissions M of a
block. We have M is geometric(p = 10−3 ), so E(M ) = 1/(1 − p).
k 999
Hence U = n·E(M ) = 1000×1/(.999) = 998/1000.
Of the frames we accept, some have 2 or more errors, which results in a residual bit error rate.
This results in exactly the same calculation as for single-bit error correction, and so Pe = 10−9 .
Carruthers (ECE @ BU) ECC Spring 2025 24 / 37
Link: Error Control

BER comparison example V

Repetition coding.
Let us approximate to n = 999 and so k = 333. Then U = RC = 1/3. The residual Pe is the
probability that for any of the three copies of any bit transmitted, either 2 of 3 or 3 of 3 are
changed. So Pe = 3 × 10−12 + 10−18 = 3 × 10−12 .

Carruthers (ECE @ BU) ECC Spring 2025 25 / 37


Link: Error Control

Design Example 1

Design a code from 3-bit codewords with 2 codewords. What is the rate of the code? Which
codewords should you send? What options can be used for error detecting or correcting?

Carruthers (ECE @ BU) ECC Spring 2025 26 / 37


Link: Error Control

Design Example 1: answers

The rate of the code is 1/3.


Pick any two opposites; 000 and 111 are convenient. Or 101 and 010 if you want to guarantee
transitions.
We have two sensible options:
1) Decode 000 100 010 001 as 0
Decode 111 110 101 011 as 1
2) Decode 000 as 0
Decode 111 as 1
retransmit others

Carruthers (ECE @ BU) ECC Spring 2025 27 / 37


Link: Error Control

Design Example 2

Design a code using 3-bit codewords with 4 codewords. What is the rate of the code? Which
codewords should you send? What options can be used for error detecting or correcting?

Carruthers (ECE @ BU) ECC Spring 2025 28 / 37


Link: Error Control

Design Example 2: answers

The rate of the code is 2/3. Pick 000 011 101 110 as the codewords.
We have only one sensible option:
1) Decode 000 as 00
Decode 011 as 01
Decode 101 as 10
Decode 110 as 11
retransmit others

Carruthers (ECE @ BU) ECC Spring 2025 29 / 37


Link: Error Control

When to use less efficient error-correcting codes: I

storage channels (e.g. compact disks, magnetic tape)


real-time requirements (e.g. voice, video)
simplex channels (e.g. digital broadcast TV)
high-delay channels (e.g. satellite links)
Why?
storage: errors are permanent
real-time: no time for retransmission
simplex: no way to ask for retransmission
high-delay: less efficient to retransmit

Carruthers (ECE @ BU) ECC Spring 2025 30 / 37


Effective Error Control Codes

Cyclic redundancy check (CRC) codes

T (x) = r + k-bit frame (codeword) to be transmitted


M (x) = k-bit message (data), the first k bits of T
R(x) = r-bit CRC (checksum bits or CRC bits), the last r bits of T
G(x) = pattern of r + 1 bits, the generator polynomial
Choosing the code words: pick G(x), and the codewords are those T (x) such that T (x) is a
multiple of G(x).

Carruthers (ECE @ BU) ECC Spring 2025 31 / 37


Effective Error Control Codes

CRC Summary

transmitter: divide xr M (x) by G(x) and use remainder as CRC


ˆ by G(x) and check remainder is 0.
receiver: divide T (x)

Carruthers (ECE @ BU) ECC Spring 2025 32 / 37


Effective Error Control Codes

CRC Performance

The common choices for G(x), (such as CRC-16 which is x16 + x15 + x2 + 1) detect
1, 2, or 3 bit errors
any odd number of errors
any burst error if burst length l satisfies l ≤ n − k
most longer burst errors
as long as the message sequence is shorter than 215 bits.
A burst error of length l is any consecutive sequence of bits which are in error.

Carruthers (ECE @ BU) ECC Spring 2025 33 / 37


Effective Error Control Codes

BCH Codes

A BCH code is a block code with a generator polynomial with a specific design.
BCH code design
choose a minimum distance 2t + 1
choose a block code size n = 2b − 1 for some integer b
then k = n − bt
the generator g(x) is the lowest degree polynomial which has roots α, α2 , . . . , α2t

Carruthers (ECE @ BU) ECC Spring 2025 34 / 37


Effective Error Control Codes

BCH Notes

The code provides t-bit error correction.


The four parameters (n, k, b, t) must satisfy the equations above.
Usually, the code is specified by n and t as “BCH(n, t)”.

Carruthers (ECE @ BU) ECC Spring 2025 35 / 37


Effective Error Control Codes

Design Example 3

An error control code uses the following set of codewords: 00000, 11100, 11011, and 00111.
(a) What is the rate of the code?
(b) What is the minimum distance of the code?
(c) If the code is used for error detection only, how many bit errors are guaranteed to be
detected?
(d) If the code is used for error correction only, how many bit errors are guaranteed to be
corrected?
(e) Discuss what to do if you receive the word 01010 and you are using the code for error
correction.

Carruthers (ECE @ BU) ECC Spring 2025 36 / 37


Effective Error Control Codes

DE3 Answers

(a) Two data bits are used to encode these five-bit sequences, so the rate of the code is 2/5.
(b) The minimum distance of the code is 3. Notice that d(00000, 00111) = 3,
d(00000, 11011) = 4, d(00000, 11100) = 3, d(11011, 11100) = 3, d(11011, 00111) = 3, and
d(11100, 00111) = 4.
(c) The code can detect dmin − 1 = 2 bit errors.
(d) The code can correct ⌊(dmin − 1)/2⌋ = 1 bit error. Note that “n + 1 ≤ 2n−k ” is a necessary
but not sufficient condition for single-bit error correction.
(e) 01010 is a Hamming distance 2 away from 00000 and also 2 away from 11011. (it is 3 away
from the other codes). If retransmission is possible one might ask for a retransmission. The
other option is to “correct” to either 00000 or 11011; this gives you a 50% chance of success.

Carruthers (ECE @ BU) ECC Spring 2025 37 / 37

You might also like