P08 BlockCodes Sol
P08 BlockCodes Sol
ENGN 3226
Q2
Consider a (7,4) linear block code dened by the generator matrix 1 0 0 0 1 1 0 0 1 0 0 0 1 1 G = 0 0 1 0 1 1 1 0 0 0 1 1 0 1 (a) Determine if the code is a Hamming code. Find the parity check matrix H of the code in systematic form. (b) Find the encoding table for the linear block code. (c) What is the minimum distance dmin of the code. How many errors can the code detect. How many errors can the code correct. (d) Draw the hardware encoder diagram. (e) Find the decoding table for the linear block code. (f) Draw the hardware syndrome generator diagram. (g) Suppose c = 1 0 0 1 0 1 1 is sent and r = 1 1 0 1 0 1 1 is received. Show how the code can correct this error.
Q3
Consider a (5,1) linear block code dened by the generator matrix 1 1 1 1 1 G = (a) Find the parity check matrix H of the code in systematic form. (b) Find the encoding table for the linear block code. (c) What is the minimum distance dmin of the code. How many errors can the code detect. How many errors can the code correct. (d) Draw the hardware encoder diagram. (e) Find the decoding table for the linear block code (consider single bit errors only). (f) Draw the hardware syndrome generator diagram. (g) Suppose c = 1 1 1 1 1 is sent and r = 0 1 1 1 1 is received. Show how the code can correct this error. Problem Set #8 page 1
ANU
ENGN 3226
Q4
Consider the generator polynomial for a (7,3) cyclic code dened by g( p) = p4 + p3 + p2 + 1 (a) Find the encoding table for the cyclic code. (b) What is the minimum distance dmin of the code.
Q5
Consider the generator polynomial for a (7,4) cyclic code dened by g( p) = p3 + p2 + 1 (a) Find the encoding table for the cyclic code. (b) What is the minimum distance dmin of the code. (c) Find the systematic output codeword for input c =
1 .
Problem Set #8
page 2
ANU
ENGN 3226
ENGN 3226 Digital Communications Problem Set #8 Solution Q1: Complete Solution
(a)
Testing for hamming code, we have m = nk = 63 = 3 k = 2m m 1 = 23 3 1 = 4 = 3 n = 2m 1 = 23 1 = 7 = 6 Hence (6, 3) is not a Hamming code. We have G P T P I3 H H = 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 1 0 0 1 1 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1
0 1 1 1 0 1 1 0 1
. = [ P T. . I nk ] 1 0 1 1 = 1 1 0 0 0 1 1 0
0 1 0
0 0 1
(b)
The encoding table for (6, 3) linear block code is Message 000 001 010 011 100 101 110 111 Code word 000000 001101 010011 011110 100110 101011 110101 111000 Weight of code word 0 3 3 4 3 4 4 3
Problem Set #8
page 3
ANU This is calculated as follows c0= m0 G = = c1= m1 G = = c2= m2 G = = c3= m3 G = = c4= m4 G = = c5= m5 G = = c6= m6 G = = c7= m7 G = = 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 1 1 0 1 1 1 0 1 1 0 0 1 1 0 1 1
ENGN 3226
0 0 0 1 0 0 1 0 1 0 0 0 1 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 1 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 1
1 0 1 1 0 0 1 0 1 0 0 0 1 1 0 0 0
(3rd row of G ) 1 1 0 0 1 1 1 0 1 (2nd row of G ) 1 1 0 0 1 1 1 0 1 (2nd row of G + 3rd row of G ) 1 1 0 0 1 1 1 0 1 (1st row of G ) 1 1 0 0 1 1 1 0 1 (1st row of G + 3rd row of G ) 1 1 0 0 1 1 1 0 1 (1st row of G + 2nd row of G ) 1 1 0 0 1 1 1 0 1 (1st row of G + 2nd row of G + 3rd row of G )
(c)
From encoding table, we have dmin = 3 e = dmin 1 = 2 1 (dmin 1) 1 t 2 Hence the (6, 3) linear block code can detect 2 bit errors and correct 1 bit error in 6 bit output codeword.
Problem Set #8
page 4
ANU
ENGN 3226
(d)
The output for general code word is c = mG = = m1 m1 m2 m2 m3 m3 1 0 0 0 1 0 0 0 1 1 0 1 1 1 0 0 1 1 m2 + m3
m1 + m3
m1 + m2
m m1 m2 m3
c c4 c5 c6
(e)
We have H 1 = 1 0 1 0 1 = 1 0 0 0 1 1 1 1 0 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 0 1 0 0 0 1
T H
The decoding table is Error Pattern Syndrome 000000 000 100000 110 010000 011 001000 101 000100 100 000010 010 000001 001 Problem Set #8
Comment all 0s 1st row of H T 2nd row of H T T 3rd row of H 4th row of H T 5th row of H T 6th row of H T page 5
ANU
ENGN 3226
(f)
The syndrome for general received word is s = r HT 1 0 1 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1
r1
r2
r3
r4
r5
r6
r1 + r3 + r4
r1 + r2 + r5
r2 + r3 + r6
(g)
Given that c = 1 1 1 0 0 0 is sent and r = 1 1 0 1 1 0 0 0 1 1 0 0 1 0 0 1 0 1 1 0 0 1 1 1 0 0 1 is received.
= r HT =
From decoding table, this syndrome corresponds to error pattern e = [000001]. Hence the corrected code word is y = r + e 1 1 1 0 0 1 = 1 1 1 0 0 0 =
Problem Set #8
page 6
ANU
ENGN 3226
0 0 0 1
1 0 1 1
1 1 1 0
0 1 1 1
1 0 1
1 0 0
0 1 0
0 0 1
(b)
The encoding table for (7, 4) linear block code is Message 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Code word 0000000 0001101 0010111 0011010 0100011 0101110 0110100 0111001 1000110 1001011 1010001 1011100 1100101 1101000 1110010 1111111 Weight of code word 0 3 4 3 3 4 3 4 3 4 3 4 4 3 4 7
(c)
From encoding table, we have dmin = 3 e = dmin 1 = 2 1 t (dmin 1) 1 2 Hence the (7, 4) linear block code can detect 2 bit errors and correct 1 bit error in 7 bit output codeword.
Problem Set #8
page 7
ANU
ENGN 3226
(d)
The output for general code word is c = mG = m1 m1 m2 m2 m3 m3 m4 m4 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 1 1 1 1 1 0 0 1 1 1 m2 + m3 + m4
m1 + m3 + m4
m1 + m2 + m3
(e)
We have T H = 1 0 1 1 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1
The decoding table is Error Pattern Syndrome 0000000 000 1000000 110 0100000 011 0010000 111 0001000 101 0000100 100 0000010 010 0000001 001 Problem Set #8 page 8
ANU
ENGN 3226
(f)
The syndrome for general received word is s = r HT 1 0 1 1 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1
r1
r2
r3
r4
r5
r6
r7
r1 + r3 + r4 + r5
r1 + r2 + r3 + r6
r2 + r3 + r4 + r7
(g)
Given that c = 1 0 0 1 0 1 1 is sent and r = 1 1 0 1 1 1 0 1 1 1 0 1 0 0 1 0 0 1 0 1 1 1 0 0 1 1 0 1 0 1 1 is received.
s = r HT
From decoding table, this syndrome corresponds to error pattern e = [0100000]. Hence the corrected code word is y = r + e 1 1 0 1 0 1 1 = 1 0 0 1 0 1 1 =
Problem Set #8
page 9
ANU
ENGN 3226
Q3: Solution
(a)
G G H H . = [ I k. .P] = 1 1 1 1 1 . = [ P T. . I nk ] 1 1 0 1 0 1 = 1 0 0 1 0 0
0 0 1 0
0 0 0 1
(b)
The encoding table for (5, 1) linear block code is Message 0 1 Code word 00000 11111 Weight of code word 0 5
(c)
From encoding table, we have dmin = 5 e = dmin 1 = 4 1 t (dmin 1) 2 2 Hence the (5, 1) linear block code can detect 4 bit errors and correct 2 bit errors in 5 bit output codeword.
(d)
The output for general code word is m1 1 1 1 1 1 c = mG = m1 m1 m1 m1 m1 = The hardware encoder implementation is
m m1
c c3 c4 c5
Problem Set #8
page 10
ANU
ENGN 3226
(e)
We have T H = 1 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1
The decoding table is Error Pattern Syndrome 00000 0000 10000 1111 01000 1000 00100 0100 00010 0010 00001 0001
(f)
The syndrome for general received word is s = r HT = r1 r2 r3 r4 r5 1 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1
r1 + r2
r1 + r3
r1 + r4
r1 + r5
Problem Set #8
page 11
ANU
(g)
Given that c = 1 1 1 1 1 0 1 0 0 1 0 1 1 0 0 0 1 1 1 1 is received.
s = r HT
From decoding table, this syndrome corresponds to error pattern e = [1000]. Hence the corrected code word is y = r + e 0 1 1 = 1 1 1 =
1 1
1 1
(b)
dmin = 4.
Problem Set #8
page 12
ANU
ENGN 3226
(b)
dmin = 3.
(c)
Given that c = 1 1 1 1 .
Given that the generator polynomial for a (7,4) cyclic code is g( p) = p3 + p2 + 1 The systematic output code word is pnk = p3 M ( p) = p3 + p2 + p + 1 pnk M ( p) = ( p3 )( p3 + p2 + p + 1) = p6 + p5 + p4 + p3 pnk M ( p) g( p) = = b( p) = c( p) = = c = p6 + p5 + p4 + p3 p3 + p2 + 1 p3 + p + 1 + p2 + p + 1 p3 + p2 + 1
p2 + p + 1 pnk M ( p) + b( p) p6 + p5 + p4 + p3 + p2 + p + 1 1 1 1 1 1 1 1
Problem Set #8
page 13