5-Error Detection
5-Error Detection
Computer Networks
RQ 2
Single-Bit Error
In a single-bit error, only one bit in the data unit has
changed during transmission.
Such errors are more probable in parallel
transmission than in serial transmission
For a data rate of 1Mbps, noise of 1ms will change
one bit.
RQ 3
Burst Error
A burst error means that 2 or more bits in the data
unit have changed.
It is more probable in serial transmission than in
parallel transmission.
The length of burst error is measured from first
corrupted bit to the last corrupted bit.
RQ 4
Error Detection
Redundancy
Error detection uses the concept of
redundancy, which means adding extra
bits for detecting errors at the destination.
RQ 5
Redundancy
RQ 6
Error Detection vs. Correction
In error detection, we are looking only
to see if any error has occurred.
In error correction, we need to know
the exact number of bits that are
corrupted and their location in the
message.
The correction of errors is more
difficult than the detection.
RQ 7
FEC vs. Retransmission
Two main methods of error correction
Forward Error Correction (FEC)
Retransmission
Using FEC the receiver tries to guess
the message by using redundant bits
In correction by retransmission, the
receiver detects an error and asks the
sender to resend the message
RQ 8
Coding
Redundancy is achieved through various
coding schemes.
The sender adds redundant bits through
a process that creates a relationship
between the redundant bits and the
actual data bits.
The receiver checks the relationships
between the two sets of bits to detect or
correct the errors.
RQ 9
Coding
Coding schemes can be divided into
into two broad categories:
Block coding
Convolution coding
Convolution coding is more complex
than Block coding
Here we will concentrate only on Block
coding
RQ 10
Some basic concepts
Modular Arithmetic
In modulo-N arithmetic, we use only the
integers in the range 0 to N −1, inclusive
XOR
RQ 11
Block Coding
In block coding, a message is divided into
blocks, each of k bits, called datawords.
Then r redundant bits are added to each block
to make the length n = k + r.
The resulting n-bit blocks are called
codewords.
RQ 12
Process of error detection in
block coding
RQ 13
Example 1
Let us assume that Datawords Codewords
k = 2 and n = 3. 00 000
01 011
Table shows the list
10 101
of datawords and 11 110
codewords.
Assume the sender encodes the dataword 01
as 011 and sends it to the receiver. Consider
the following cases
RQ 14
Example 1
1. The receiver receives 011. It is a valid codeword.
The receiver extracts the dataword 01 from it.
2. The codeword is corrupted during transmission,
and 111 is received. This is not a valid codeword
and is discarded.
3. The codeword is corrupted during transmission,
and 000 is received. This is a valid codeword.
The receiver incorrectly extracts the dataword
00. Two corrupted bits have made the error
undetectable.
RQ 15
Example 2
Let us add more redundant bits in the
previous example.
We add 3 redundant bits to the 2-bit
dataword to make 5-bit codewords.
Table shows the datawords and
codewords. Datawords Codewords
00 00000
01 01011
10 10101
11 11110
RQ 16
Example 2
The sender converts the dataword 01 to
the codeword 01011 and sends.
The codeword is corrupted during
transmission, and 01001 is received.
First, the receiver detects error by
checking the table. The receiver,
assuming that there is only 1 bit
corrupted, uses the following strategy to
guess the correct dataword.
RQ 17
Example 2
The reciever compares the received codeword
with all codewords in the table
The receiver decides that the first, third or
fourth codeword is not the one that was sent
because there is a difference of two bits.
The original codeword must be the second
one in the table because this is the only one
that differs from the received codeword by 1
bit. The receiver replaces 01001 with 01011
and consults the table to find the dataword 01.
RQ 18
Hamming Distance
The Hamming distance between two words
is the number of differences between
corresponding bits.
The Hamming distance can be found if we
apply the XOR operation on the two words
and count the number of 1s in the result.
e.g. The Hamming distance d(000, 011) is 2
because
RQ 19
Hamming Distance
The minimum Hamming distance (dmin)is
the smallest Hamming distance between
all possible pairs in a set of words.
For example, dmin = 2 for the coding
scheme of example 1 and dmin = 3 for the
coding scheme of example 2.
RQ 20
Hamming Distance
A coding scheme C is written as C(n, k)
with a separate expression for dmin.
For example,
our first coding scheme is C(3, 2) with
dmin= 2
our second coding scheme is C(5, 2) with
dmin= 3.
RQ 21
Hamming Distance
To guarantee the detection of up to s
errors in all cases, the minimum
Hamming distance in a block
code must be dmin= s + 1.
To guarantee correction of up to t
errors in all cases, the minimum
Hamming distance in a block code
must be dmin= 2t + 1.
RQ 22
Example 3
The minimum Hamming distance for our first
code scheme is 2. This code guarantees
detection of only a single error. For example,
if the third codeword (101) is sent and one
error occurs, the received codeword does
not match any valid codeword. If two errors
occur, however, the received codeword may
match a valid codeword and the errors are
not detected.
RQ 23
Example 4
A code scheme has a Hamming distance dmin= 4.
What is the error detection and correction capability
of this scheme?
Solution
This code guarantees the detection of up to three
errors (s = 3), but it can correct up to one error.
RQ 24
Linear Block Codes
A linear block code is a code in which
the exclusive OR (XOR) of two valid
codewords creates another valid
codeword.
Almost all block codes used today are
a type of linear block codes.
RQ 25
Minimum Distance for Linear
Block Codes
In linear block codes, the minimum
Hamming distance is the number of 1s
in the nonzero valid codeword with the
smallest number of 1s.
For example, In our first code, the
numbers of 1s in the nonzero
codewords are 2, 2, and 2. So the
minimum Hamming distance is dmin= 2.
RQ 26
Simple Parity-Check Code
A simple parity-check code is a single-
bit error-detecting code in which
n = k + 1 with dmin= 2.
The extra bit, called the parity bit, is
selected to make the total number of
1s in the codeword even.
RQ 27
Simple parity-check code C(5, 4)
RQ 28
Encoder and decoder for
simple parity-check code
RQ 29
Example
Let us look at some transmission scenarios. Assume the
sender sends the dataword 1011. The codeword created
from this dataword is 10111, which is sent to the receiver.
We examine five cases:
1. No error occurs; the received codeword is 10111. The
syndrome is 0. The dataword 1011 is created.
2. One single-bit error changes a1 . The received
codeword is 10011. The syndrome is 1. No dataword
is created.
3. One single-bit error changes r0 . The received codeword
is 10110. The syndrome is 1. No dataword is created.
RQ 10.30
Example
4. An error changes r0 and a second error changes a3 .
The received codeword is 00110. The syndrome is 0.
The dataword 0011 is created at the receiver. Note that
here the dataword is wrongly created due to the
syndrome value.
5. Three bits—a3, a2, and a1—are changed by errors.
The received codeword is 01011. The syndrome is 1.
The dataword is not created. This shows that the simple
parity check, guaranteed to detect one single error, can
also find any odd number of errors.
RQ 10.31
Two-dimensional parity check
In two-dimensional parity check, a
block of bits is divided into rows and a
redundant row of bits is added to the
whole block.
RQ 32
Two-dimensional parity check
RQ 33
Two-dimensional parity check
RQ 34
Two-dimensional parity check
RQ 35
Cyclic Codes
Cyclic codes are special linear block
codes with one extra property. In a
cyclic code, if a codeword is cyclically
shifted (rotated), the result is another
codeword.
RQ 36
Cyclic Redundancy Check
Most powerful of the redundancy checking
RQ 37
A CRC code with C(7, 4)
RQ 38
CRC encoder and decoder
RQ 39
Division in CRC encoder
RQ 40
Division in the CRC decoder
for two cases
RQ 41
Polynomial to represent a
binary word
RQ 42
CRC division using polynomials
RQ 43
CRC Analysis
Dataword: d(x) Codeword: c(x)
Syndrome: s(x) Error: e(x)
Generator: g(x)
If s(x) ≠ 0, one or more bits is corrupted.
If s(x) = 0, either
No bit is corrupted. Or
Some bits are corrupted, but the decoder failed to
detect them.
RQ 44
CRC Analysis
cr(x) = c(x) + e(x)
cr(x)/g(x) = c(x)/g(x) + e(x)/g(x)
RQ 45
Standard polynomials
RQ 46
Checksum
Like linear and cyclic codes, the
checksum is based on the concept of
redundancy
Several protocols still use the
checksum for error detection, although
the tendency is to replace it with a
CRC
RQ 47
Checksum
1 1 1 1
1 0 0 1 0 0 0 0
RQ 48
Sender steps for Checksum