Module 4 Error Control Coding-1
Module 4 Error Control Coding-1
Notation
In digital communication message is usually represented by binary codes, which consists only of binary
symbols 0 and 1. In such a code, the encoding and decoding functions involve the binary arithmetic
operations of modulo-2 addition and multiplication. The ordinary plus sign (+) is used to denote modulo-
2 addition. The rules for modulo-2 addition and modulo-2 multiplication are as follows:
[C] = {c1 , c2 , . . . cn }
In a systematic linear block codes, the message bits of a codeword appears before the parity-check bits,
or vice versa. The remaining (n − k) parity-check bits in the codeword. By combining the message bits
and parity-check bits and expressed as a codeword which is as follows:
The remaining (n − k) parity-check bits ck+1 , ck+2 , . . . cn are generated from k message bits using a
predetermined rule
1 0 0 . . . 0 P11 P12 . . . P1,n−k
0 1 0 . . . 0 P21 P22 . . . P2,n−k
[c1 , c2 , . . . ck , ck+1 ck+2 . . . cn ] = [d1 , d2 , dk ]
.. .. .. .
. . . ..
. . . ...
0 0 0 . . . 1 Pk1 Pk2 . . . Pk,n−k
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 1
0.1. Linear Block Codes
[C] = [D][G]
where [G] is called as generator matrix and is expressed as:
.
[G] = [Ik ..P ]k×n
d1 , d 2 ,...d k b1 , b2 ,...bn k
Message bits Parity-check bits
k bits n k bits
n bits
c1 , c2 ,........ ck ck 1ck 2 ......... cn
Let b0 , b1 , . . . bn−k−1 denote the (n − k) parity-check bits in the codeword. For the code to possess a
systematic structure, a codeword is divided into two parts, one of which is occupied by the message bits
and the other by the parity-check bits.
Clearly, we have the option of sending the message bits of a codeword before the parity-check bits, or
vice versa. The former option is illustrated in Figure 10.4, and its use is assumed in the following.
b0 , b1 ,...bn k 1 m0 , m1 ,...mk 1
Parity-check bits Message bits
or
m0 , m1 ,...mk 1 b0 , b1 ,...bn k 1
Message bits Parity-check bits
k bits n k bits
n bits
Figure 3: Structure of systematic codeword.
bi i = 0, 1, . . . n − k − 1
ci =
mi+k−n i=n−k,n−k+1,...n−1
this set of probabilities must satisfy the normalization property
m = [m0 , m1 , . . . mk−1 ]
b = [b0 , b1 , . . . bn−k−1 ]
c = [c0 , c1 , . . . cn−1 ]
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 2
0.1. Linear Block Codes
P00 P01 ... P0,n−k−1
P10 P11 ... P1,n−k−1
P =
.. .. .. ..
. . . .
Pk−1,0 Pk−1,1 . . . Pk−1,n−k−1
where the element pij is 0 or 1.
The codeword c may be expressed as a partitioned row vector in terms of the vectors m and b as
follows:
..
c= b.m
or
.
c = m .. b
or
..
c = m Ik . P
where
1 0 ··· 0
0 1 ··· 0
Ik =
.. .. . . ..
. . . .
0 0 ··· 1
Define the k-by-n generator matrix
..
G = P . Ik
or
..
G = Ik . P
ci + cj = mi G + mj G
= (mi + mj )G
The modulo-2 sum of mi and mj represents a new message vector. Correspondingly, the modulo-2 sum of
ci and cj represents a new code vector.
The message bits and parity-check bits are expressed in another form which is a linear block code. Let
H denote an (n − k)-by-n matrix, defined as
.. T
H = In−k . P
or
.
H = P T .. In−k
where P T is an (n − k)-by-k matrix, representing the transpose of the coefficient matrix P , and In−k is
the (n − k)-by-(n − k) identity matrix.
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 3
0.1. Linear Block Codes
1 0 0 ... 0 P11 P12 . . . P1,n−k
. 0 1 0 ... 0 P21 P22 . . . P2,n−k
[G] = [Ik ..P ]
.. .. .. .
. . . ..
. . . ...
0 0 0 ... 1 Pk1 Pk2 . . . Pk,n−k
..
H = PT . In−k
P11 P21 ... Pk1 1 0 0
... 0
P12 P22 ... Pk2 0 1 0
... 0
[H] =
.. .. .. ..
. . ... . ... .
P1,n−k P2,n−k . . . Pk,n−k 0 0 0 ... 1
T Ik
= P T In−k
HG
PT
= PT + PT
= 0
cH T = mGH T
= 0
The matrix H is called the parity-check matrix of the code and the above equation is mentioned as
parity-check equations.
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 4
0.1. Linear Block Codes
s = rH T
The syndrome depends only on the error pattern and not on the transmitted codeword.
s = rH T
= (c + e)H T
= cH T + eH T
= eH T
dmin ≥ 2t + 1
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 5
0.1. Linear Block Codes
2020 Jan 7 b. The parity check bits of a (7,4) Hamming code, are generated by
c5 = d1 + d3 + d4
c6 = d1 + d2 + d3
c7 = d2 + d3 + d4
(iii) The (n,k) linear block code so obtained has a ’dual’ code. This dual code is a (n, n-k) code having
a generator matrix H and parity check matrix G. Determine the eight code vectors of the dual code
for the (7,4) Hamming code describe above.
(iv) Find the minimum distance of the dual code determined in part (c).
Solution:
n=7 and k=4
It is a 4 × 7 matrix in which 4 × 4 identity matrix
Message bits are d1 , d2 , d3 , d4 and code bits are arranged as c1 = d1 , c2 = d2 , c3 = d3 , c4 = d4 , c5 =
d1 + d3 + d4 c6 = d1 + d2 + d3 , c7 = d2 + d3 + d4 ,
[C] = [c1 , c2 , c3 , c4 , c5 , c6 , c7 ]
= [d1 , d2 , d3 , d4 , (d1 + d3 + d4 ), (d1 + d2 + d3 ), (d2 + d3 + d4 )]
1 0 0 0| 1 1 0
0 1 0 0| 0 1 1
= [d1 , d2 , d3 , d4 ]
0 0 1 0| 1 1 1
0 0 0 1| 1 0 1
= [D][G]
0 0 0
The dual code is n, n − k = 7, 3 with message bits as d1 , d2 , d3
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 6
0.1. Linear Block Codes
1 0 1 1 1 0 0
0 0 0 0 0 0
[c] = [d1 , d2 , d3 ][H] = [d1 , d2 , d3 ] 1 1 1 0 0 1 0
0 1 1 1 0 0 1
By observing the dual code vector the minimum distance minimum number of ones it is four Hence
dmin = Hmin = 4
Jan-2020-CBCS 8-a For a systematic (6,3) linear block code, the parity matrix P is given by
1 0 1
0 1 1
1 1 0
i) Find all possible code words. ii) Find error detecting and correcting capability.
(06 Marks)
Solution:
n=6 and k=3
There are 23 = 8 message vectors given by u=[000, 001, 010, 011, 100, 101, 110, 111]
The code vectors V are estimated using generator matrix G which is in the form of
[C] = [D][G]
where
[G] = [Ik |P ]
1 0 0| 1 0 1
= 0 1 0| 0 1 1
0 0 1| 1 1 0
[C] = [D][G]
= [d1 , d2 , d3 ][G]
1 0 0| 1 0 1
= [d1 , d2 , d3 ] 0 1 0| 0 1 1
0 0 1| 1 1 0
= [d1 , d2 , d3 , (d1 , +d3 ), (d2 + d3 ), (d1 + d2 )]
dmin = 2
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 7
0.1. Linear Block Codes
(10 Marks)
Solution:
n=6 and k=3, n-k=6-3=3
There are 23 = 8 message vectors given by u=[000, 001, 010, 011, 100, 101, 110, 111]
The code vectors V are estimated using generator matrix G which is in the form of
[C] = [D][G]
where
[G] = [Ik |P ]
1 0 0| 1 1 1
= 0 1 0| 1 1 0
0 0 1| 1 0 1
[C] = [D][G]
= [d1 , d2 , d3 ][G]
1 0 0| 1 1 1
= [d1 , d2 , d3 ] 0 1 0| 1 1 0
0 0 1| 1 0 1
= [d1 , d2 , d3 , (d1 + d2 + d3 ), (d1 + d2 )(d1 + d3 )]
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 8
0.1. Linear Block Codes
[G] = [Ik |P ]
1 0 0| 1 1 1
= 0 1 0| 1 1 0
0 0 1| 1 0 1
[H] = [P T |In−k ]
[H] = [P T |In−k ]
1 1 1| 1 0 0
= 1 1 0| 0 1 0
1 0 1| 0 0 1
d1
d2
Input
d1 d2 d3 d3
Message
Commutator
To Channel
+ + + (d1+d2+d3)
(d1+d2)
(d1+d3)
Jan-2019-CBCS 7-a For a (6,3) code find all possible code vectors, if the coefficient matrix P is given by
1 1 0
0 1 1
1 0 1
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 9
0.1. Linear Block Codes
(08 Marks)
Solution:
n=6 and k=3
There are 23 = 8 message vectors given by u=[000, 001, 010, 011, 100, 101, 110, 111]
The code vectors V are estimated using generator matrix G which is in the form of
[C] = [D][G]
where
[G] = [Ik |P ]
1 0 0| 1 1 0
= 0 1 0| 0 1 1
0 0 1| 1 0 0
[C] = [D][G]
= [d1 , d2 , d3 ][G]
1 0 0| 1 1 0
= [d1 , d2 , d3 ] 0 1 0| 0 1 1
0 0 1| 1 0 1
= [d1 , d2 , d3 , (d1 + d3 ), (d1 + d2 )(d2 + d3 )]
d2
Input
d1 d2 d3 d3
Message
Commutator
To Channel
+ + + (d1+d3)
(d1+d2)
(d2+d3)
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 10
0.1. Linear Block Codes
Figure 6: Encoder-LBC-2019-Jan
iii) Find the syndrome vector S
Parity check matrix H is expressed as
[H] = [P T |In−k ]
[H] = [P T |In−k ]
1 0 1| 1 0 0
= 1 1 0| 0 1 0
0 1 0| 0 0 1
S = RH T
P
HT = −
In−k
1 1 0
0 1 1
1 0 0
T
H = − − −
1 0 0
0 1 0
0 0 1
S = RH T
1 1 0
0 1 1
1 0 0
= [r1 r2 r3 r4 r5 r6 ]
1 0 0
0 1 0
0 0 1
= [s1 s2 s3 ]
= [(r1 + r3 + r4 ), (r1 + r2 + r5 ), (r2 + r6 )]
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 11
0.1. Linear Block Codes
Received
r1 r2 r3 r4 r5 r6
Vector
+ + +
S0 S1 S2
(r1+r3+r4) (r2+r6)
(r1+r2+r5)
Figure 7: Syndrome-LBC-2019-Jan
Feb-2022-CBCS 7-a 2017 2010 scheme For a systematic (7,4) linear block code the parity matrix P is given
by
1 1 1
1 1 0
1 0 1
0 1 1
i) Find all possible code vectors.
ii) Draw the encoding circuit.
iii) A single error has occurred in the received vector R=[1011100]. Detect the error.
iii) Draw the syndrome calculation circuit.
(10 Marks)
Solution:
n = 7 and k = 4
The code vectors are estimated using generator matrix G which is in the form of
[C] = [D][G]
where
[G] = [Ik |P ]
1 0 0 0 | 1 1 1
0 1 0 0 | 1 1 0
=
0 0 1 0 | 1 0 1
0 0 0 1 | 0 1 1
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 12
0.1. Linear Block Codes
[C] = [D][G]
= [d1 , d2 , d3 , d4 ][G]
1 0 0 0 | 1 1 1
0 1 0 0 | 1 1 0
= [d1 , d2 , d3 , d4 ]
0 0 1 0 | 1 0 1
0 0 0 1 | 0 1 1
= [d1 , d2 , d3 , , d4 , (d1 + d2 + d3 ), (d1 + d2 + d4 )(d1 + d3 + d4 )]
c1
c2
c3
Input
d1 d2 d3 d4 c4
Message
Commutator
c5
To Channel
+ + + (d1+d2+d3)
(d1+d2+d4) c6
(d1+d3+d4)
c7
S = RH T
P
HT = −
In−k
1 1 1
1 1 0
1 0 1
T
0 1 1
H = − − −
1 0 0
0 1 0
0 0 1
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 13
0.1. Linear Block Codes
1 1 1
1 1 0
1 0 1
T
S = RH = [1 0 1 1 1 0 0]
0 1 1
1 0 0
0 1 0
0 0 1
[S] = [S1 , S2 , S3 ] = [1 0 1]
Syndrome bits are [1 0 1] which is presented in 3rd row of H T it indicates the error occurred in the 3rd
position of the vector counting from lest side of the received data. The received data is [1 0 1 1 1 0 0] in
which 3rd position bit is 1 which has to be changed as 0. The corrected vector is [1 0 0 1 1 0 0].
1 1 1
1 1 0
1 0 1
T
S = RH = [r1 , r2 , r3 , r4 , r5 , r6 , r7 ]
0 1 1
1 0 0
0 1 0
0 0 1
Received
r7 r6 r5 r4 r3 r2 r1
Vector
+ + +
S3 S2 S1
(r1+r3+r4+r7) (r1+r2+r3+r5)
(r1+r2+r4+r6)
A (6,3) linear block code with a parity matrix is as shown. The received code vector R = [1 1 0 0 1 0] is
given. Detect & correct the single error that has occurred due to noise
1 0 1
0 1 1
1 1 0
Solution:
H = [P T |In−k ]
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 14
0.1. Linear Block Codes
1 0 1 | 1 0 0
H= 0 1 1 | 0 1 0
1 1 0 | 0 0 1
S = RH T
P
HT = −
In−k
1 0 1
0 1 1
1 1 0
T
H = − − −
1 0 0
0 1 0
0 0 1
1 0 1
0 1 1
1 0 0
T
S = RH = [1 1 0 0 1 0]
− − −
1 0 0
0 1 0
0 0 1
S1 = 1 + 0 + 0 + 0 + 0 + 0 = 1
S2 = 0 + 0 + 0 + 0 + 0 + 0 = 0
S3 = 1 + 1 + 0 + 0 + 0 + 0 = 0
S = [S1 , S2 , S3 ] = [1 0 0] 6= 0
Compare this syndrome bits with the rows of H T . The syndrome bit S = [1 0 0] which is present in the
4th row of H T . Hence 4th bit of the received vector counting from left is having an error. The error bit
has been identified and has to be corrected. If it is 0 it has to be changed as 1 or if it is 1 it has to be
changed as 0.
The received code vector is R = [1 1 0 0 1 0] it has to changed as R = [1 1 0 1 1 0]
Jan-2019-CBCS 7-a The parity check bits of a (8,4) linear block code is given by
C5 = d1 + d2 + d4
C6 = d1 + d2 + d3
C7 = d1 + d3 + d4
C8 = d2 + d3 + d4
(08 Marks)
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 15
0.1. Linear Block Codes
Solution:
n = 8 and k = 4
1 0 0 0 | 1 1 1 0
0 1 0 0 | 1 1 0 1
G=
0 0 1 0 | 0 1 1 1
0 0 0 1 | 1 0 1 1
H = [P T |In−k ]
1 1 0 1 | 1 0 0 0
1 1 1 0 | 0 1 0 0
H=
1 0 1 1 | 0 0 1 0
0 1 1 1 | 0 0 0 1
The minimum weight other than zero code vector is minimum weight. In this code vector minimum
weight is 4.
S1 = r1 + r2 + r3 + r5
S2 = r1 + r2 + r4 + r6
S3 = r1 + r3 + r4 + r7
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 16
0.1. Linear Block Codes
(08 Marks)
Solution:
1 0 1
1 1 0
1 1 1
T
0 1 1
H =
− − −
1 0 0
0 1 0
0 0 1
1 1 1 0 | 1 0 0
H= 0 1 1 1 | 0 1 0
1 0 1 1 | 0 0 1
H = [P T | In−k ]
G = [Ik | P ]
1 0 0 0 | 1 0 1
0 1 0 0 | 1 1 0
G=
0 0 1 0 | 1 1 1
0 0 0 1 | 0 1 1
n = 7 and k = 4
0 0 0 1 | 0 1 1
= [d1 , d2 , d3 , , d4 , (d1 + d2 + d3 ), (d2 + d3 + d4 )(d1 + d3 + d4 )]
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 17
0.1. Linear Block Codes
c1
c2
c3
Input
d1 d2 d3 d4 c4
Message
Commutator
c5
To Channel
+ + + (d1+d2+d3)
(d2+d3+d4) c6
(d1+d3+d4)
c7
Jan-2020-CBCS 7-c Design a syndrome calculating circuit for a (7, 4) cyclic code g(X) = 1 + X + X 3 and
also calculate the syndrome of the received vector R=1110101
Solution:
Gate
g0= 1 g1 = 1 g2= 0
Input
Gate + S0 + S1 S2
Syndrome
Output
2019-DEC-CBCS 8-b A (7,4) cyclic code has the generator g(X) = 1 + X + X 3 . Find the code vector
both in systematic and non systematic form for the message bits (1101)
Solution:
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 18
0.1. Linear Block Codes
Gate
g0=1 g1=1
g2=0
Code
word
P0 + P1 P2 +
When message bit is 1 the g0 and g1 are 1 After four shift, the contents of the register are (0 0 0) and
the codeword is (0 0 0 1 0 1 1)
2019-DEC-CBCS 8-b Draw the encoder circuit of a cycling code using (n-k) bit shift registers and explain
it.
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 19
0.1. Linear Block Codes
Gate
g0 g1 gn-k-1
g2
Code
+ + word
R0 + R1 R2 +
R Registers
Parity Check digits
+ Modulo 2 adders
2019-DEC-CBCS 8-a Explain the syndrome calculation and error detection with help of neat diagram for
cyclic codes.
2019-DEC-CBCS 8-b Consider a (15,7) binary cyclic code with g(x) = 1 + X 4 + X 6 + X 7 + X 8
Solution:
Gate
g0=1 g4=1 g6=1 g7=1
R0 R1 R2 R3 + R4 R5 + R6 + R7 +
Shifts Input D R0 R1 R2 R3 R4 R5 R6 R7
0 0 0 0 0 0 0 0 0
1 1 1 0 0 0 1 0 1 1
2 1 0 1 0 0 0 1 0 1
3 1 0 0 1 0 0 0 1 0
4 0 0 0 0 1 0 0 0 1
5 0 1 0 0 0 1 0 1 1
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 20
0.1. Linear Block Codes
The code word is, the content of the register in the last shift is 10001011, hence code word is 10001011-
00111
iii) Draw the syndrome calculating circuit.
Gate
g0=1 g4=1 g6=1 g7=1
+ S0 S1 S2 S3 + S4 S5 + S6 + S7
Syndrome
Figure 15: Syndrome calculating circuit.
Dr. Manjunatha P Prof., Dept of ECE, JNN College of Engg Shimoga [email protected] 21