error control coding2
TRANSCRIPT
-
8/2/2019 Error Control Coding2
1/27
Linear block codes: Cyclic codes
For practical applications rather large n and kmust be used. This is
because in order to correct up to terrors lhs and rhs of the followingshould be as close as possible:
Hence for large n and kmust be used
Advantages of cyclic codes: Encoding and syndrome computation easy by shift registers
Handy decoding schemes exist due to inherent algebraic structure
For most of the linear codes there exist cyclic codes, as for instance for
Hamming, BCH and Golay codes
12 1 ...
1 2
n k
n
t
i
n
i
n n n
t
=
=
+ + + =
number of syndromes
(or check bit error patterns)
number of error patters
that can be corrected
in an encoded word
2 1
11 log note: (1 )
C C
t
i
n
i R q n k n R
n =
= =
1C
R
min
( 1) / 2t d=
-
8/2/2019 Error Control Coding2
2/27
Example
Consider a relatively high SNR channel such that only 1 or 2 bit errors
are likely to happen. Consider the ration
Take a constant code rate ofRc=0.8 and consider with some values of
larger n and k:
This demonstrates that long codes are more advantages when a high
code rate and high error correction capability is required
2
2
1
11 log
1 /( , )
1log
1 2
C
t
i
n
iR
n
k nn k
n n
n
=
=
+
(10,8) 0.35, (32,24) 0.89, (50,40) 0.97 = = =
-
8/2/2019 Error Control Coding2
3/27
Defining cyclic codes: code polynomial
An (n,k) linear code X is called a cyclic code when every cyclic shift of
a code X, as for instance X, is also a code, e.g.
Each cyclic code has the associated code vector with the polynomial
Note that the (n,k) code vector has the polynomial of degree ofn-1 or
less. Mapping between code vector and code polynomial is one-to-one,
e.g. they specify the same code uniquely
Manipulation of the associated polynomial is done in a Galois field(forinstance GF(2)) having elements {0,1}, where operations are performed
mod-2
For each cyclic code, there exist only one generator polynomial whose
degree equals the number of check bits in the encoded word
2 1
0 1 2 1( ) n n
n np x x p x p x p
= + + + +X
0 1 2 1( )
n n x x x x
=X
1 0 3 2' ( )
n n nx x x x
=X
-
8/2/2019 Error Control Coding2
4/27
An example of a (7,4) cyclic code,
generator polynomial G(p)=1+p+p3( )pM ( )pX ( ) ( )p pM G
( )( )31 1
1
X X X
X
+ + +
= + 3X X+ + 2 4X X+ +
-
8/2/2019 Error Control Coding2
5/27
-
8/2/2019 Error Control Coding2
6/27
Factoring cyclic code generator polynomial
Any factor ofpn+1 with the degree q=n-kgenerates an (n,k) cyclic code
Example: Consider the polynomialp7+1. This can be factored as
For instance the factors 1+p+p3 or 1+p2+p3, can be used to generate an
unique cycliccode. For a message polynomial 1+p2 the following
encoded word is generated:
and the respective code vector (of degree n-1, in this case) is
7 3 2 31 (1 )(1 )(1 ) p p p p p p+ = + + + + +
2 3 2 5(1 )(1 ) 1 p p p p p p+ + + = + + +
(111 0 0 1 0)
-
8/2/2019 Error Control Coding2
7/27
Obtaining a cyclic code from another cyclic code
Therefore unity cyclic shift is obtained by multiplication byp where
after division by the common factor yields a cyclic code
and by induction, any cyclic shift is obtained by
Example:
right shift 101
Important point is that division by modpn+1 and multiplication by the
generator polynomial is enabled by tapped shift register.
'( ) ( )mod( 1)n p p p p= +X X
( ) ( )( ) ( )mod( 1)i i n p p p p= +X X
2101 ( ) 1p p = +X3( ) p p p p= +X
3 3
( )
1 1101 1
1p p
p p
p
= + +
+
+
X
not a three-bit code,
divide by the common factor
33
3
1
1
1
1
p pp
p
p
++
+
+
-
8/2/2019 Error Control Coding2
8/27
Using shift registers for multiplication
Figure shows a shift register to realize multiplication by 1+p2+p3
In practice, multiplication can be realized by two equivalent topologies:
-
8/2/2019 Error Control Coding2
9/27
Example: multiplication by using a shift register
2 3
2 3
(1 )(1 )
1
p p p
p p
+ + +
= + + 3p p+ + 4
2 41 11101
p
p p p
+
= + + +
out
1 1 0 0 0 0 0 1
0 1 1 0 0 0 0 1
0 0 1 1 0 0 0 1
0 0 0 1 1 0 0 0
0 0 0 0 1 1 0 1
0 0 0 0 0 1 1 0determined by
the tapped connectionsword to be
encoded
Encoded word
-
8/2/2019 Error Control Coding2
10/27
Examples of cyclic code generator polynomials
The generator polynomial for a (n,k) cyclic code is defined by
and G(p) is a factor ofpn+1. Any factor ofpn+1 that has the degree q
may serve as the generator polynomial. We noticed that a code is
generated by the multiplication
where M(p) is a block ofkmessage bits. Hence this gives a criterion to
select the generating polynomial, e.g. it must be a factor ofpn+1.
Only few of the possible generating polynomials yield high quality
codes (in terms of their minimum Hamming distance)
1
1 1( ) 1 ,q q
qp g p g p p q n k = + + + + = G
( ) ( ) ( ) p p p=X M G
Some cyclic codes:
3( ) 0 1 p p p= + + +G
-
8/2/2019 Error Control Coding2
11/27
Systematic cyclic codes
Define the length q=n-kcheck vector C and the length-kmessage
vector M by
Thus the systematic n:th degree codeword polynomial is
1
0 1 1( )k
k p m m p m p = + + +M
1
0 1 1( ) q
qp c c p c p
= + + +C
1
0 1 1
1
0 1 1
( ) ( )
( ) ( )
n k k
k
q
q
q
p p m m p m pc c p c p
p p p
= + + ++ + + +
= +
X
M C
Check bits determined by:
Question: Why these denote the message bits still
the message bits are M(p) ???
[ ]( ) mod ( ) / ( )n k p p p p=C M G
check bits
message bits
-
8/2/2019 Error Control Coding2
12/27
Determining check-bits
Prove that the check-bits can be calculated from the message bits
M(p) by [ ]( ) mod ( ) / ( )n k p p p p=C M G
( ) / ( ) ( ) ( ) / ( )n k p p p p p p = +M G Q C G
0
( ) / ( ) ( ) / ( ) ( ) ( ) / ( ) ( ) / ( )n k p p p p p p p p p p
=
+ = + +M G C G Q C G C G
( )
( ) ( ) ( ) ( )n k
p
p p p p p
=
+ =X
M C G Q
checkmessage
3 2
3
7 4 6 4
( ) 1( )
( )
p p p p p p
p p p p
= + += +
= +
GM
M
3 2
3 3 6 4
3 2 3 2 6 4
( )( )
( ) / ( ) 1 1
( ) ( ) ( ) 1 1
( ) ( ) ( 1)( 1) 1
n k
n k
pp
p p p p p
p p p p p p p p
p p p p p p p p
= + + +
+ = + + = + + = + + + + = + +
CQ
M G
M C
Q G
Example: (7,4) Cyclic code:
must be a systematic code
based on its definition
(previous slide)
10 / 2 / 4 42= +
( )pC
-
8/2/2019 Error Control Coding2
13/27
Example: Encoding of systematic cyclic codes
-
8/2/2019 Error Control Coding2
14/27
Circuit for encoding systematic cyclic codes
We noticed earlier that cyclic codes can be generated by using shift
registers whose feedback coefficients are determined directly by the
generating polynomial
For cyclic codes the generator polynomial is of the form
In the circuit, first the message flows to the transmitter, and feedback
switch is set to 1, where after check-bit-switch is turned on, and the
feedback switch to 0, enabling the check bits to be outputted
2 1
1 2 1( ) 1 q q q
q qp g p g p g p p
= + + + + +G
1
0
-
8/2/2019 Error Control Coding2
15/27
Decoding cyclic codes
Every valid, received code word R(p) must be a multiple ofG(p),
otherwise an error has occurred. (Assume that the probability for noiseto convert code words to other code words is very small.)
Therefore dividing the R(p)/G(p) and considering the remainder as a
syndrome can reveal if the error has happened and sometimes also to
reveal in which bit (depending on code strength)
Division is accomplished by a shift registers with reversedtap order (why?)
The error syndrome ofn-k-1 degree is therefore
This can be expressed also in terms of error E(p) and the
code wordX(p)
[ ]( ) mod ( ) / ( ) p p p=S R G
( ) ( ) ( ) p p p= +R X E
[ ]{ }
[ ]
( ) mod ( ) ( ) / ( )
( ) mod ( ) / ( )
p p p p
p p p
= +
=
S X E G
S E G
hence
-
8/2/2019 Error Control Coding2
16/27
Decoding cyclic codes: example
[ ]16.20 ( ) mod ( ) / ( )s x e x g x=Using denotation of this example:
-
8/2/2019 Error Control Coding2
17/27
( )g x
[ ]( ) mod ( ) / ( )s x r x g x=
Table 16.6Decoding cyclic codes (cont.)
-
8/2/2019 Error Control Coding2
18/27
Decoding circuit for (7,4) code
syndrome computation
While first receiving the code, switch is set to 0
The shift register is stepped until all the received code bits have entered
the register
This results 3-bit syndrome (n - k= 3 ) that is then left to the register
Then the switch is turned to the direction 1 that drives the syndrome
out of the register
3( ) 1 p p p= + +G
1
0
received code syndrome
-
8/2/2019 Error Control Coding2
19/27
Convolutional coding
Block codes are memoryless
Convolutional codes have memory that utilizes previous bits to encodeor decode following bits
Convolutional codes are specified by n, kand constraint length that is
the maximum number of information symbols upon which the symbol
may depend
Thus they are denoted by (n,k,L), whereL is the code memory depth
Convolutional codes are commonly used in applications that require
relatively good performance with low implementation cost
Convolutional codes are encoded by circuits based on shift registers and
decoded by several methods as
Viterbi decoding that is a maximum likelihood method
Sequential decoding (performance depends on decoder
complexity)
Feedback decoding (simplified hardware, lower performance)
-
8/2/2019 Error Control Coding2
20/27
Example: convolutional encoder
Convolutional encoder is a finite state machine processing information
bits in a serial manner
Thus the generated code word is a function of input and the state of the
machine at that time instant In this (n,k,L)=(2,1,2) encoder each message bit influences a span of
n(L+1)=6successive output bits that is the code constraint length
Thus (n,k,L) convolutional code is produced that is a 2n(L-1) state finite-
state machine
2 1' j j j j
x m m m
=
2'' j j j x m m=
1 1 2 2 3 3' '' ' '' ' '' ...
outX x x x x x x= (n,k,L) = (2,1,2) encoder
-
8/2/2019 Error Control Coding2
21/27
(3,2,1) Convolutional encoder
3 2' j j j j
x m m m
=
3 1''
j j j j x m m m
=
2'''
j j j x m m
=
Here each message bit influences
a span ofn(L+1)=3(1+1)=6
successive output bits
-
8/2/2019 Error Control Coding2
22/27
Generator sequences
(n,k,L) Convolutional code can be described by the generator sequences
that are the impulse responses for each coder output branch:
Generator sequences specify convolutional code completely by thegenerator matrix
Encoded convolutional code is produced by matrix multiplication of the
input and the generator matrix
1 2, ,... ng g g
1
2
[1 0 11]
[1111]
=
=
g
g
(2,1,3) encoder
Note that the generator sequence length
exceeds register depth by 1
-
8/2/2019 Error Control Coding2
23/27
Encoding equations
Encoder outputs are formed by modulo-2 discrete convolutions:
Therefore the l:th bit of thej:th output branch is
Input for extraction of generator sequences is
Hence for this circuit the following equations result:
(1) (1)
( 2) ( 2)
**
==
v u gv u g
( ) ( ) ( ) ( ) ( )
0 0 1 1... , 1,2... , 2 j j j j jmil l i i l l l m mv u g u g u g u g j m m L= = = + + + = = +
,
0,otherwisel i
i l iu
=
(1)
2 3
( 2)
1 2 3
l l l l
l l l l l
v u u u
v u u u u
= + +
= + + +
1
2
[1 0 11]
[111 1]
= =
g
g
(1) ( 2 ) (1) ( 2 ) (1) ( 2)
0 0 1 1 2 2[ ...]v v v v v v=v
Encoder output:
-
8/2/2019 Error Control Coding2
24/27
-
8/2/2019 Error Control Coding2
25/27
Example of using generator matrix
1
2
[1 0 11]
[111 1]
= =
g
g
Verify that you can obtain the result shown!
11 10
01
11 00 01 11 01 =
-
8/2/2019 Error Control Coding2
26/27
2 1' j j j j
x m m m
=
2''
j j j x m m
=
1 1 2 2 3 3' '' ' '' ' '' ...outX x x x x x x=Tells how one input bit
is transformed into two output bits
(initially register is all zero)
Representing convolutional code: code tree
-
8/2/2019 Error Control Coding2
27/27
Representing convolutional codes compactly:
code trellis and state diagram
Shift register states
Input state 1
indicated by dashed line