Error Detection and Correction
Error Detection and Correction
Correction
By,
B. R. Chandavarkar,
CSE Dept., NITK, Surathkal
Error Correction
How can errors be detected by using block coding?
If the following two conditions are met, the receiver can detect a change
in the original codeword.
1. The receiver has (or can find) a list of valid codewords.
2. The original codeword has changed to an invalid one.
Example:
Assume the sender encodes the dataword 01 as 011 and sends it to the
receiver. Consider the following cases:
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
(the leftmost bit is corrupted). This is not a valid codeword and is
discarded.
3. The codeword is corrupted during transmission, and 000 is received
(the right two bits are corrupted). This is a valid codeword. The
receiver incorrectly extracts the dataword 00. Two corrupted bits
have made the error undetectable.
Hamming Distance
• One of the central concepts in coding for error control is the
idea of the Hamming distance.
• The Hamming distance between two words (of the same size)
is the number of differences between the corresponding bits.
• We show the Hamming distance between two words x and y
as d(x, y).
• We may wonder why Hamming distance is important for
error detection. The reason is that the Hamming distance
between the received codeword and the sent codeword is the
number of bits that are corrupted during transmission. For
example, if the codeword 00000 is sent and 01101 is received,
3 bits are in error and the Hamming distance between the
two is d(00000, 01101) = 3.
• In other words, if the Hamming distance between the sent
and the received codeword is not zero, the codeword has been
corrupted during transmission.
Minimum Hamming Distance
• Although the concept of the Hamming distance is the central
point in dealing with error detection and correction codes,
the measurement that is used for designing a code is the
minimum Hamming distance.
• In a set of words, the minimum Hamming distance is the
smallest Hamming distance between all possible pairs.
• We use dmin to define the minimum Hamming distance in a
coding scheme. To find this value, we find the Hamming
distances between all words and select the smallest one.
• Example:
• For example, we can call our first coding scheme C(3, 2) with
dmin =2 and our second coding scheme C(5, 2) with dmin =
3.
Minimum Distance for Error Detection
• Now let us find the minimum Hamming distance in a code if
we want to be able to detect up to s errors.
• If s errors occur during transmission, the Hamming distance
between the sent codeword and received codeword is s.
• If our system is to detect up to s errors, the minimum
distance between the valid codes must be (s + 1), so that the
received codeword does not match a valid codeword.
• In other words, if the minimum distance between all valid
codewords is (s + 1), the received codeword cannot be
erroneously mistaken for another codeword. The error will
be detected.
• We need to clarify a point here: Although a code with dmin =
s + 1 may be able to detect more than s errors in some
special cases, only s or fewer errors are guaranteed to be
detected.
Minimum Distance for Error Correction
• Error correction is more complex than error detection; a decision is
involved.
• When a received codeword is not a valid codeword, the receiver
needs to decide which valid codeword was actually sent.
• The decision is based on the concept of territory, an exclusive area
surrounding the codeword. Each valid codeword has its own
territory.
• We use a geometric approach to define each territory. We assume
that each valid codeword has a circular territory with a radius of t
and that the valid codeword is at the center.
• For example, suppose a codeword x is corrupted by t bits or less.
Then this corrupted codeword is located either inside or on the
perimeter of this circle.
• If the receiver receives a codeword that belongs to this territory, it
decides that the original codeword is the one at the center.
• Note that we assume that only up to t errors have occurred;
otherwise, the decision is wrong.
Minimum Distance for Error Detection
10.32
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.
• For example, if 1011000 is a codeword and we cyclically left-
shift, then 0110001 is also a codeword.
Cyclic Redundancy Check
• We can create cyclic codes to correct errors.
• A subset of cyclic codes called the cyclic redundancy check
(CRC), which is used in networks such as LANs and WANs.
Advantages of Cyclic Codes
• Cyclic codes have a very good performance in detecting
single-bit errors, double errors, an odd number of errors, and
burst errors.
• They can easily be implemented in hardware and software.
• They are especially fast when implemented in hardware.
This has made cyclic codes a good candidate for many
networks.
Figure 10.22 CRC division using polynomials
10.38
Note
10.39
• Which of the following g(x) values guarantees that a single-
bit error is caught ?
(i) x + 1 (ii) X3 (iii) 1
(a) This is a very poor choice for a generator. Any two errors next to
each other cannot be detected.
(b) This generator cannot detect two errors that are four positions
apart. The two errors can be anywhere, but if their distance is 4,
they remain undetected.
(c) This is a good choice for this purpose.
CHECKSUM
• Checksum is an error-detecting technique that can be
applied to a message of any length.
• In the Internet, the checksum technique is mostly used at
the network and transport layer rather than the data-link
layer.
• At the source, the message is first divided into m-bit units.
• The generator then creates an extra m-bit unit called the
checksum, which is sent with the message.
• At the destination, the checker creates a new checksum from
the combination of the message and sent checksum. If the
new checksum is all 0s, the message is accepted; otherwise,
the message is discarded
Convolution Coding
• Decoding of 11 11 01 11 01 01 11 received as 01 11 01 11 01
01 11 using sequential decoding
Cont….
Cont….
Cont….
B. Maximum likely-hood decoding
• Step 1
• Step 2
• Step 3
• Step 4
• After Step 4
• Step 5
• Step 6
• Step 7