IIT Block Codes
IIT Block Codes
IIT Block Codes
Channel Coding
In this lesson, we will have short and specific discussions on two block codes, viz.
the Hamming code and the Reed- Solomon code. The Hamming code is historically
important and it is also very suitable for explaining several subtle aspects of encoding and
decoding of linear binary block codes. The Reed- Solomon code is an important example
of linear non-binary code, which can correct random as well as burst errors. It is one of
the most extensively applied block codes in digital transmission an digital storage media.
Hamming Code
Invented in 1948 by R. W. Hamming, this single error correcting code is an
elegant one. It should be easy to follow the encoding and decoding methods. Though the
original code, developed by Hamming, was a specific (7,4) code with n = 7 and k = 4,
subsequently all single error correcting linear block codes have come to be known as
Hamming codes too.
( )
In general, a Hamming code is specified as 2 m − 1, 2 m − m − 1 , i.e., a block of k =
( ) (
2 m − m − 1 bits are encoded together to produce a codeword of length n = 2 m − 1 bits.)
So, ‘m’ parity bits are added for every ‘k’ information bits. Some examples of Hamming
codes are (7, 4), (15, 11), (31, 26) and (63, 57). All these codes are capable of detecting 2
errors and correcting single error as the Hamming distance for them is 3.
By adding an overall parity bit, an (n, k) Hamming code can be modified to yield
an (n+1, k+1) code with minimum distance 4. Such a code is known as extended
Hamming code.
We follow the polynomial approach to describe the (7,4) Hamming code. The
generator polynomial for (7,4) Hamming code is:
g(x)= Generator polynomial = x3+x+1 6.34.1
i
Here, the coefficients of x –s are elements of GF(2), i.e. the coefficients are ‘0’ or ‘1’.
However, all the polynomials are defined over an ‘extended’ field of GF(2). The
extension field for (7,4) Hamming code is GF (23). In general, the extension field, over
( )
which the generator polynomial is defined, for 2 m − 1, 2 m − m − 1 Hamming code is
GF(2m).
Interestingly, if we can identify a polynomial in ‘x’, say p(x) defined over GF(2),
such that p(x) is a prime and irreducible polynomial with degree ‘m’, then we can define
a finite field with 2m polynomial elements, i.e., GF(2m) easily. Degree of a polynomial is
the highest exponent of ‘x’ in the polynomial.
For the (7,4) Hamming code, m =3 and a desired prime, irreducible p(x) = g(x) =
x3 + x +1. Table 6.34.1 shows one possible representation of GF(23). Note that all
polynomials whose degree are less than m = 3, are elements of GF(23) and it takes only a
group of ‘m’ bits to represent one element in binary form.
Table 6.34.1: An illustration on the elements of GF(23). Note that, x7 = 1, x8= x and so on
Let us note that, for the (7,4) Hamming code, the degree of a message polynomial
m(x) ≤ 3, the degree of the generator polynomial g(x) = 3 = (n – k) and the degree of a
codeword polynomial c(x) ≤ 6.
As an example, let us consider a block of 4 message bits (0111) where ‘0’ is the
last bit in the sequence. So, the corresponding message polynomial is, m(x)= x2 + x + 1.
If we follow non-systematic coding, the codeword polynomial is:
c(x) = m(x).g(x) = (x2 + x + 1) (x3 + x + 1) = x5 + x3 + x2 + x4 + x2 + x + x3 + x + 1
= x5 + x4 + (x3 ⊕ x3) + (x2 ⊕ x2)+ (x ⊕ x) + 1 = x5 + x4 + 1
So in binary form, we get the code word (0110001).
Similarly, if the message polynomial is m(x) = x3 + x2 + x + 1, verify that the codeword is
(1101001).
If we wish to go for systematic encoding where the parity bits will be appended to
the message bits, we use the following expression for the codeword polynomial as
introduced in Lesson #33:
c′ ( x ) = x n − k m ( x ) − R g(x) ⎡⎣ x n −k m ( x ) ⎤⎦ 6.34.3
Now, m(x) = x2 + x + 1.
∴ xn-k.m(x) = x3 (x2 + x + 1) = x5 + x4 + x3
Now, divide this by the generator polynomial g(x) as bellow and remember that addition
and subtraction operations are the same over GF(2).
Message
bits Parity
bits
Hamming Decoder
Upon receiving a polynomial r(x) = c(x) + e(x), the decoder computes the syndrome
polynomial s(x) = Rg ( x ) [ r ( x )] . If the remainder is ‘0’, the decoder declares the
received word as a correct one. If s(x) is a non-zero polynomial, the decoder assumes
that there is a single error in one of the 7 bits. In fact, the precise location of the
erroneous bit is uniquely related to the syndrome polynomial. Note that the degree of
the syndrome polynomial is 2 or less. So, the number of non-zero syndrome
polynomials is (23-1) = 7. Each polynomial form indicates a single error at a bit
position. Once the location of the erroneous bit is found from the syndrome
polynomial, the bit is simply inverted to obtain the correct transmitted codeword. For
a systematic code, the information bits can be retrieved easily from the corrected
Reed-Solomon Codes
Reed Solomon (R-S) codes form an important sub-class of the family of Bose-
Chaudhuri-Hocquenghem (BCH) codes and are very powerful linear non-binary block
codes capable of correcting multiple random as well as burst errors. They have an
important feature that the generator polynomial and the code symbols are derived from
the same finite field. This enables to reduce the complexity and also the number of
computations involved in their implementation. A large number of R-S codes are
available with different code rates. A few R-S codes with their code parameters are
shown in Table 6.34.2.
Like other forward error correcting (FEC) decoders the decoding of the R-S codes
is more complex than their encoding operation. An iterative algorithm due to E.R
Berlekamp with J. L. Massey’s extension, a search algorithm due to R. T. Chien and G.
D. Forney’s method for calculation for error values, together constitute a basic approach
for decoding the R-S codes.
For positive integers m and t, a primitive (n, k, t) R-S code is defined as below:
Number of encoded symbols per block: n = 2m – 1
Number of message symbols per block: k
Code rate: R= k/n
Number of parity symbols per block: n – k = 2t
Minimum symbol Hamming distance per block: d = 2t +1.
It can be noted that the block length n of an (n, k, t) R-S code is bounded by the
corresponding finite field GF(2m). Moreover, as n – k = 2t, an (n, k, t) R-S code has
optimum error correcting capability. As we have seen earlier in this lesson, each field
elements can be represented by m bits. So, a codeword of (n,k,t) R-S code over GF (2m),
consisting of n symbols, can be represented by (n × m) bits and the code has sufficient
inherent algebraic structure to correct at least t erroneous symbols per block. If the
number of erroneous symbols per block exceeds t, there is no guarantee that the errors
will be corrected. Practical decoders in such cases behave differently depending on the
error pattern. Possibility of correcting more than t erroneous symbols, for some error
pattern, also exists. The t erroneous symbols, when represented by m bits each, can be
affected in two extreme cases in the following manner:
(i) one bit of each of the t-symbols is corrupted.
(ii) all m bits of each of the t-symbols are corrupted.
So, the random error correcting capability of an (n,k,t) R-S code is up to at least t bits per
block of (n × m) bits. When errors due to a communication channel are not totally
uncorrelated, i.e. the errors tend to be bursty in nature, the use of R-S code becomes more
relevant and important. Note that a particular symbol, consisting of m bits, may be
erroneous due to error in one or more (up to m) bits and the code ensures correct
decoding of up to t such erroneous symbols. Thus if there are (m × t) or less erroneous
bits, distributed in t symbols only, the code corrects the erroneous symbols without
failure.
The generator polynomial g(X) for the (n, k, t) R-S code is written as,
g ( x ) = ∏ (x − α i )
2t
6.34.4
i =1
Here ‘ α ‘ is the primitive root of an irreducible polynomial of degree ‘m’ over GF(2) and
‘ α ’ is defined over GF(2m),the extension field. We have briefly discussed about the
definition of GF(2m) earlier in this lesson.
Example #6.34.1: Let the allowable bandwidth expansion for error correcting code alone
be about 50% and let the hardware complexity permit us to consider block length of 31.
For such a situation one can think of an R-S code with following parameters:
N = 31 = 25 – 1; m = 5;
Based on the allowed bandwidth expansion, the approximate code rate is 2/3.
So, we can choose k = 21; R = 21/31 = 0.678.
n-k = 2t =10; t = 5 and d = 2t +1 = 11.
Thus the chosen code is a (31, 21, 5) R-S code.
Additive
Channel
Receiver &
Quantizer
Fig 6.34.1 Block diagram of a digital communication system using Reed-Solomon codes
for error control
n −k
v ( x ) = ∑ v i x i = x n −k .m ( x ) + rem ( x ) = q ( x ) .g ( x ) 6.34.6
i =0
GATE
X g0 X g1 X g3 X gn-2 X gn-1
SR2t-1
+ + + SR2t-2 + +
SR0 SR1 SR2
Parity
symbols O/P
° .
.
Message symbols °
n −1
f (a j ) = ∑ f t (a j ) i = v(a j ) + e(a j ) = 0 + e(a j )
i =0
( )
This shows that the quantities f α j contain information about the error
polynomial e(x) only. These quantities, named syndromes, are only 2t in number and they
play pivotal role in the decoding process.
After determining the syndromes, the next step is to find the coefficients of a
suitably defined error-locator polynomial Q(x). This is carried out following the
Berlekamp-Massey algorithm. The coefficients of the error-locator polynomial are
necessary for finding the error-locations which is done following the cyclic Chien search