Linear Block Codes: Cyclic Codes: R Q NK N R N
Linear Block Codes: Cyclic Codes: R Q NK N R N
1
2 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
1
1 log note: (1 )
C C
t
i
n
i
R q n k n R
n
=
( | |
= =
| (
\ .
1
C
R
min
( 1) / 2 t d =
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 of R
c
=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
1
1 log
1 /
( , )
1
log
1 2
C
t
i
n
i
R
n
k n
n k
n n
n
=
( | |
| (
\ .
=
( | | | |
+
( | |
\ . \ .
= + + + +
= + + + +
= + + + +
X
X
X
1 1 1
( ) '( ) ( 1)
n n
n n n
p p p x p x x p
+ = + = + X X
Right rotated
Right shifted by multiplication
Unshifted
Factoring cyclic code generator polynomial
Any factor of p
n
+1 with the degree q=n-k generates an (n,k) cyclic code
Example: Consider the polynomial p
7
+1. This can be factored as
For instance the factors 1+p+p
3
or 1+p
2
+p
3,
can be used to generate an
unique cyclic
code. For a message polynomial 1+p
2
the following
encoded word is generated:
and the respective code vector (of degree n-1, in this case) is
7 3 2 3
1 (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)
Obtaining a cyclic code from another cyclic code
Therefore unity cyclic shift is obtained by multiplication by p 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 mod p
n
+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
2
101 ( ) 1 p p = + X
3
( ) p p p p = + X
3 3
( )
1 110
1 1
1 p p
p p
p
= +
+
+
+
X
not a three-bit code,
divide by the common factor
3 3
3
1
1
1
1
p p p
p
p
+ +
+
+
Using shift registers for multiplication
Figure shows a shift register to realize multiplication by 1+p
2
+p
3
In practice, multiplication can be realized by two equivalent topologies:
Example: multiplication by using a shift register
2 3
2 3
(1 )(1 )
1
p p p
p p
+ + +
= + +
3
p p + +
4
2 4
1 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 0
determined by
the tapped connections
word to be
encoded
Encoded word
Examples of cyclic code generator polynomials
The generator polynomial for a (n,k) cyclic code is defined by
and G(p) is a factor of p
n
+1. Any factor of p
n
+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 of k message bits. Hence this gives a criterion to
select the generating polynomial, e.g. it must be a factor of p
n
+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
q
p 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
Systematic cyclic codes
Define the length q=n-k check vector C and the length-k message
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
q
p 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 p
c c p c p
p p p
= + + +
+ + + +
= +
X
M C
= C M G
check bits
message bits
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
check message
3 2
3
7 4 6 4
( ) 1
( )
( )
p p p
p p p
p p p p
= + +
= +
= +
G
M
M
3 2
3 3 6 4
3 2 3 2 6 4
( )
( )
( ) / ( ) 1 1
( ) ( ) ( ) 1 1
( ) ( ) ( 1)( 1) 1
n k
n k
p
p
p p p p p
p p p p p p p p
p p p p p p p p
= + + +
+ = + + = + +
= + + + + = + +
C
Q
M G
M C
Q G
=
1 1 2 2 3 3
' '' ' '' ' '' ...
out
X x x x x x x =
(n,k,L) = (2,1,2) encoder
(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 of n(L+1)=3(1+1)=6
successive output bits
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 the
generator matrix
Encoded convolutional code is produced by matrix multiplication of the
input and the generator matrix
1 2
, ,...
n
g g g
1
2
[1 011]
[1111]
=
g
g
(2,1, 3) encoder
Note that the generator sequence length
exceeds register depth by 1
Encoding equations
Encoder outputs are formed by modulo-2 discrete convolutions:
Therefore the l:th bit of the j: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 g
v u g
( ) ( ) ( ) ( ) ( )
0
0 1 1
... , 1, 2... , 2
j j j j j m
i
l l i i l l l m m
v u g u g u g u g j m m L
=
= = + + + = = +
,
0, otherwise
l i
i l i
u
(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:
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 =
2 1
'
j j j j
x m m m
=
2
''
j j j
x m m
=
1 1 2 2 3 3
' '' ' '' ' '' ...
out
X 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
Representing convolutional codes compactly:
code trellis and state diagram
Shift register states
Input state 1
indicated by dashed line