Académique Documents
Professionnel Documents
Culture Documents
Where is it done ?
How is it done ?
(n,k) code has k message bits and is expected to be mapped on to n coded bits.
All 2k k-bit message words are called k-tuples For each of the 2k
message k-tuples, the
encoding process
assigns one member of
All 2n n-bit blocks are called n-tuples
the 2n n-tuples
Ex: for ( 127, 92) code, There will be 292 = 5 X 1027 code words.
We need techniques for generating the code words dynamically from the
message words.
The set of all 2k n-tuples is called a Linear Block Code, IFF, it is a subspace
of the vector space Vn of all n tuples
Since, the code words that form a linear block code is a k-dimensional
subspace of the n-dimensional space,
It is possible to find a set of n-tuples, fewer than 2k, that can generate all the
2k code words of the subspace ( from Rule 2: The sum of any two vectors in
S, is also a vector in S: Closure Property )
2n n-tuples, Vn , form an n-
dimensional vector space. 2n n-tuples, Vn
2k n-tuples subspace,
Linear Block Code
< 2k span
The generating set of
vectors (fewer than 2k )
are said to span the
subspace.
2k k-tuples
The Smallest linearly
independent set that span the subspace,
subspace is called the basis. Linear Block
Code
The number of vectors in the
basis is called the dimension
of the subspace.
8 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Liner Block codes
U = m1 V1 + m2 V2 + , mk Vk
U7 = [ 1 0 1 1 1 0 ]
The 2k, k-bit Messages are ( 000, 001, 010, 011, 100,101,110,111)
U7 = m7 G = [ 1 1 0] =[1 0 1 1 1 0]
The encoder needs to store only the k linearly independent vectors and not
2k code words !!
13 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Liner Block codes Important Points
The Error detection & Correction capabilities of a code are dictated by the
minimum distance between the codes. ( dmin)
pij = 0 or 1
P is a k X (n-k) Parity Matrix
and Ik is a k X k Identity matrix
= [ m1, m2, , mk ]
Ex: (7,4)
U= mG = [ 1 1 01] = [0 0 0 1 1 0 1]
Ex: (7,4)
U = [ m1 m2 m3 m4 ] G
u1 = m1 + m3 + m4 u2 = m1 + m2 + m3 u3 = m2 + m3 + m4
p2
U = [m1 + m3 + m4 m1 + m2 + m3 m2 + m3 + m4 m1 m2 m3 m4 ]
p1 p3
22 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
(7,4) Systematic Liner Block codes - Encoder
p2
U = [m1 + m3 + m4 m1 + m2 + m3 m2 + m3 + m4 m1 m2 m3 m4 ]
p1 p3
p1 p2 p3
H is with an (n k) X n
matrix, with n k linearly 0 is a k X (n-k) matrix with all zero entries.
independent rows
That is, any vector in the row space of G is orthogonal to the rows of H..
And any vector that is orthogonal to the rows of H is in the row space of G
GHT
Since U = m G And U HT = 0 U H T = m G HT = 0
This is the Parity check process and H is called the parity check matrix.
Ex: (7,4)
Ex: (7,4)
GHT = ??
If U = u1, u2, u3, ., un is the transmitted code vector ( one of the 2k tuples)
And r = r1, r2, r3, ., rn is a received vector ( one of the 2n tuples), then
Since
If r contains correctable errors, then S has some non zero entries that can
earmark the particular error pattern.
U7 = m7 G = [ 1 1 0] =[1 0 1 1 1 0]
r = e + U7 = [ 1 0 1 1 1 1 ]
r=[1 0 1 1 1 1]
= [ 1 0 1]
e =000001 S = [ 1 0 1]
Calculating the Syndrome S for the received vector r is same as the one
calculated for error vector e
For each error vector with single error, there is a corresponding syndrome S
33 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
(6,3) code Syndrome for All single error patterns
= X =
Syndrome testing not only helps the error detection but also
correction as the syndrome can be mapped to hidden error pattern.
Concept of standard array and error detection:
1. Form a Standard array for all possible error patterns. Ex: For the (6,3)
example, with Single error correction capability, the standard array is
= X =
Let m7 = [ 1 1 0 ]
If there is an error e = 1 0 0 0 0 0,
code word is
r = e + U7 = [ 0 0 1 1 1 0 ]
U7 = m7 G
=[1 0 1 1 1 0] S = [ 1 0 0]
37 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
(6,3) code Error Correction
7. Locate the received vector in standard array, in the row corresponding to the
error pattern
39 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
(6,3) code Error Correction
8. The true bit pattern ( error corrected) is the top most entry in the column.
C
44 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Systematic Liner Block codes Error Correction
Standard Array
All code vectors
bit error patterns
Cyclic codes are a sub set of linear block codes with a special property :
Are these Cyclic ? That is, by cyclic rotation of one word do we get
another code word belonging to the same set ?
47 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
What are Cyclic Codes ?
Are these Cyclic ? That is, by cyclic rotation of one word do we get
another code word belonging to the same set ?
In general, the cyclic code U (i) = (un-i , un-i+1 , un-1 , u0, u1, un-i-1)
U (1) (X) is polynomial whose degree is (n-1) and is not divisible by (Xn + 1)
OR, U (1) (X) = X U (X) Modulo (Xn +1) Paves a way to obtain cyclic
shifted codes !!
Let U = 1 1 0 1. Express the code word in polynomial form and obtain the 3 cyclic
shifted code word, using polynomial division method.
In general, for i-th cyclic rotation, U (i) (X) = Xi U (X) Modulo (Xn +1)
Where G is the generator matrix, m the message vector and U is the code word.
Similarly, the generator polynomial g(X) for an (n, k) cyclic code is given by
U(X)
= m(X)
g(X)
=> U is a valid code word only when g(X) divides U(X) without a remainder !!
Decoding: At the receiver, if the remainder of r(X) / g(X) zero, valid code is
received.
For Example:
Factors are
(X4 + X3 + X2 + 1) = (X + 1) ( X3 + X + 1)
g (X) = ( X3 + X2 + 1) g1(X) = ( X3 + X + 1)
= ( 1+ X + X3 + X6) U=1101001
U1 = 1 0 0 1 0 1 1
To make the message bits to appear the end of the code word, the message
polynomial should start with terms like m0 Xn-k
We know that U is a valid code word only when g(X) divides U(X) without a
remainder !!
Also, U(X) = p(X) + Xn-k m (X) Hence, q(X) g(X) = p(X) + Xn-k m (X)
Adding p(X) on both sides
q(X) g(X) + p(X) = Xn-k m (X) p(X) / g(X) + q(X) = Xn-k m (X) / g(X)
q(X) is quotient and p(X) is the remainder, when Xn-k m (X) is divided with g(X)
While Decoding:
Since U(X) = q(X) g(X), At the receiver, if the remainder of r(X) / g(X) zero,
valid code is received.
Also, Since the code word polynomial is U(X) = p(X) + Xn-k m (X)
the message bits are the right most k-bits of the received vector..
n = 7, k = 4, n - k = 3
U(X) = 1 + X3 + X5 + X6 U=1001011
n = 2m-1 ; m = 3,4,5
The coefficients of g(X) are in the octal number format
The generator polynomials g (X) = g0 + g1 X + g2 X2 + ..gn-k Xn-k
g(X) are given in tabular form
g0 and gn-k must be equal to 1
66 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
BCH Codes
0 0 1 0 1 1
g0 g1 g2 g3
g (X) = 1 + X2 +X3
67 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Shift Register Structures for Polynomial Division
Coded Symbol
or bit Energy Es
Message Bits Code Bits
Parity De De Modulation
Coding and detection
Message bit error
probability = PB Bit error probability = p = Pb
Parity Decoder works on a block of n bits to identify whether the block is in error or not.
b)
= P I
E)
S=[1101101]
Error correction
capability :
floor [(dmin-1)/2]
=1
F) Solve
yourself
Its not a valid codes as the
Syndrome is not 0 dmin = 3
73 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Convolutional Codes
In all the above, for a given sequence of message bits, the code
word depends on the current block message bits.
In convolutional codes, for a given sequence of message bits, the code
word not only depends on the current block message bits but also on the
previous / next block of message bits.
That is, Convolutional codes have Memory:
74 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Convolutional Codes
After each shift, n outputs are collected and used as coded bits.
connection vector
Constrained length of the encoder
= number of shift register stages :
K=3
Code Rate = k / n =
EQUIVALENT Input
Sequence: 1 0 0
output Sequence: 11 10 11
g1(X) = 1 + X + X2
interlaced with
m(X) g2(X)
g2(X) = 1 + X2
g1(X) = 1 + X + X2
10 01 11
g1 = 1 0 1 00 00 00
10 01 11
---------------------------------
10 01 01 01 11 Output
100 10 m(X) = 1 + X2
00 10 11 01
The state transition takes place for The output depends on the current input and
every shift of input message bit into the current state of the encoder: i. e. the
the shift register. contents of the right most K-1 registers.
If the state is 00
and if input is 0 :
0 0 0
Output word = 00
The output depends on the current input State diagram depicts the these state
and the state of the encoder ( i. e. the transitions and the corresponding
contents of the shift register). outputs of the encoder, for every
possible input bit
86 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Encoder Output - State Diagram Representation
a = 00
1/11
0/11
1/00
b = 10 c = 01
0/10
Current Input New output State
state bit state Connection 0/01
1/01
0,0 0 0,0 0,0 Solid Line d = 11
0,0 1 1,0 1,1 Dotted Line
1,0 0 0,1 1,0 Solid Line 1/10
1,0 1 1,1 0,1 Dotted Line
a = 00
1/11
0/11
1/00
b = 10 c = 01
0/10
1/01 0/01
d = 11
1/10
State diagram gives only the states and associated encoded words in
static condition.
How to obtain the encoded bits for message bits that progress in time ?
0/00
a = 00
1/11
0/11
1/00
b = 10 c = 01
0/10
1/01 0/01
d = 11
1/10
t1 t2 t3 t4 t5
89 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Trellis Diagram
Input is 0 00
a a
Input is 1
11
11
b b
10
00
01
c c
01
d d
10
tn tn+1
00 00
a a a a
11 11
11 11
b b b b
10 10
00 00
01 01
c c c c
01 01
d d d d
10 10
tn-1 tn tn+1
00 00 00 00 00
a 00
11 11 11 11
11
b 10 10 10 10
10
01 01
01
01 11 11
11
c 01
00 00 00
01 01 01
d 11
10 10 10
t1 t2 t3 t4 t5 t6
10 10 10 10
10
01 01 01
01 11 11
11
01 00 00 00
01 01 01
11
10 10 10
t1 t2 t3 t4 t5 t6
93
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Distance Prop. of Conv. Codes
The free distance, dfree, is the minimum Hamming distance between any two code
sequences.
Convolutional codes are linear. Therefore, the Hamming distance between any pair of
code sequences corresponds to the Hamming distance between the all-zero code
sequence and some nonzero code sequence.
The nonzero sequence of minimum Hamming weight diverges from the all-zero path
at some point and remerges with the all-zero path at some later point.
00 0
a a
Input is 0
11 2
Input is 1
2
11
b b
10 0
00
01
1
c c
1
01
1
d d
10 1
1 01 1 1 01
01
01 1 1
11 t
10 10 1 10 6
t1 t2 t3 t4 t5
The nonzero sequence of minimum Hamming weight diverges from the all-zero path
at some point and remerges with the all-zero path at some later point.
the minimum difference = df = Path metric of that trace with minimum value
the value of t applies to a quantity of errors located relatively near to each other.
That is, multiple groups of t errors can usually be fixed when they are relatively
far apart.
Message Bits 1 1 0 1 1
Step1. Compute the Hamming distance of the received code word with each of the
branch code words (branch metric) in the trellis.
Rx 11 01 01 10 01
00 2 00 1 00 1 00 1 00 1
00
0 1 1 11 11 1
11 11 11 1
1 1 1
10 10 10 10
1 1 10
2 01 1
01 01
2 2
01 0 11
11 11
0
01 0 2 0
00 00 00
0
2
0
01 01 01
2 0
11
10 10 10 2
t1 t2 t3 t4 t5 t6
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Decoding
Rx 11 01 01 10 01
00 2 00 1 00 1 00 1 00 1
00
0 1 1 11 11 1
11 11 11 1
1 1 1
10 10 10 10
1 1 10
2 01 1
01 01
2 2
01 0 11
11 11
0
01 0 2 0
00 00 00
0
2
0
01 01 01
2 0
11
10 10 10 2
t1 t2 t3 t4 t5 t6
3. Compute the accumulated path metric G , at each branch, from the branch metric.
Rx 11 01 01 10 01
00 2
00 Ga = 2
11
0
10 Gb = 0
01
11
t1 t2
101 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Decoding
Rx 11 01 01 10 01
00 2 00 1 00 1 00 1 00 1
00
0 1 1 11 11 1
11 11 11 1
1 1 1
10 10 10 10
1 1 10
2 01 1
01 01
2 2
01 0 11
11 11
0
01 0 2 0
00 00 00
0
2
0
01 01 01
2 0
11
10 10 10 2
t1 t2 t3 t4 t5 t6
01
01 Gc = 2
0
11 Gd = 0
t1 t2 t3
103 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Decoding
Rx 11 01 01 10 01
00 2 00 1 00 1 00 1 00 1
00
0 1 1 11 11 1
11 11 11 1
1 1 1
10 10 10 10
1 1 10
2 01 1
01 01
2 2
01 0 11
11 11
0
01 0 2 0
00 00 00
0
2
0
01 01 01
2 0
11
10 10 10 2
t1 t2 t3 t4 t5 t6
Add the third stage and Compute the accumulated path metric G .
Eliminate the path/paths that lead to higher accumulated path metric.
Rx 11 01 01 10 01
00 2 00 1 00 1
00 Ga= 4 , 3 Ga= 3
11
11 1
11 1
0
10 1 Gb= 4 , 3 Gb= 3
10
10
11 2
2 1
01 00 0
01 Gc= 5 , 0 Gc= 0
01
0 0
01
10 2 Gd= 2
11 Ga= 3 , 2
t1 t2 t3 t4
105ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Decoding
Decoded Bits 1
Rx 11 01 01 10 01
00 Ga= 3
11
0
10 1 Gb= 3
11
10
2 1
11
01
01 Gc= 0
0
0
01
10 2
11 Ga= 2
t1 t2 t3 t4
106 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Decoding
Decoded Bits 1 Eliminate the path/paths that lead to higher accumulated path metric.
Rx 11 01 01 10 01
Ga= 1
00 1
00 Ga= 4,1
11
11 1
0 1
1 Gb= 1
10 Gb= 4,1
11 11
10 1 10 1
2
11 0
01 00 Gc= 3
01
01 Gc= 3,4
0 2
0 2
01
01
Gc= 2
10 2 0
11 10 Gd= 5,2
t1 t2 t3 t4 t5 t6
107 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Decoding
Decoded Bits 1 Eliminate the path/paths that lead to higher accumulated path metric.
Rx 11 01 01 10 01
Ga= 2
00 1
00
11
11 Ga= 2
1
0
10 1 1
Gb= 2
00 1 G = 2,4
11 b
00 2
11 10
01 00 1
01
01
0 0 Gc= 2
0
01 Gc= 2,3
0
01
Gd= 1
10 2 10 0 10 2
11
Gd= 1,4
t1 t2 t3 t4 t5
108 ELECTRICAL ELECTRONICS COMMUNICATION t
INSTRUMENTATION
Decoding
11
10
00
1
01
01
01 0
0
01
0
Gd= 1
11
t1 t2 t3 t4 t5 t6
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
The Viterbi Algorithm
Walk through the trellis and compute the Hamming distance between received
code word and the branch word in the trellis ( Branch metric) .
Compute the accumulated path metric G , at each branch, from the branch
metric.
At each level, consider the two paths entering the same node and are identical
from this node onwards.
From these two paths, the one that has smallest G at this stage, will still be so at
any time in the future. This path is retained, and the other path is discarded.
Proceeding this way, at each stage one path will be saved for each node. These
paths are called the survivors. The decoded sequence is guaranteed to be one of
these survivors.
Carry out this process until the received sequence is considered completely.
Choose the survivor with the smallest metric.
110 ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Implementation of Viterbi Decoder
d aa d ca d ab d cb