ECE 7670 Lecture 5 - Cyclic Codes
ECE 7670 Lecture 5 - Cyclic Codes
ECE 7670 Lecture 5 - Cyclic Codes
= (c
n1
, c
0
, . . . , c
n2
)
that is also in C. (c
g(x)
xg(x)
.
.
.
x
k1
g(x)
g
0
g
1
g
r
g
0
g
1
g
r
g
0
g
1
g
r
.
.
.
.
.
.
.
.
.
g
0
g
1
g
r
g
0
g
1
g
r
= mG
So we have a linear code, and can write the generator matrix corresponding to it.
Note: G is k n.
Let h(x) be parity check polynomial, that is a polynomial such that
x
n
1 = g(x)h(x).
Since codewords are multiples of g(x), then for a codeword,
c(x)h(x) = m(x)g(x)h(x) = m(x)(x
n
1) 0 (mod x
n
1).
We let
s(x) = c(x)h(x) (mod x
n
1).
be the syndrome polynomial. If s(x) is identically zero, then c(x) is a codeword.
Now lets put this in matrix form.
s(x) = c(x)h(x) =
n1
i=0
c
i
x
i
n1
j=0
h
j
x
j
(mod x
n
1).
Performing the multiplication,
s
k
=
n1
i=0
c
i
h
((ki))n
k = 0, 1, . . . , n 1.
Writing the last n k of these out, we have
[s
k
, s
k+1
, . . . , s
n1
] = [c
0
, c
1
, . . . , c
n1
]
h
k
h
k1
h
1
h
0
h
k
h
k1
h
1
h
0
.
.
.
.
.
.
h
k
h
k1
h
1
h
0
h
k
h
k1
h
1
h
0
T
= cH
T
.
Note: H is n k n
Example 2 Some cyclic codes of length 7. In GF(8) we have elements of order 7.
The minimal polynomials are
x + 1 x
3
+x + 1 x
3
+x
2
+ 1
We can choose any combination of these factors as factors of g(x). Let us take
g(x) = (x
3
+x + 1)(x + 1) = x
4
+x
3
+x
2
+ 1
Then h(x) = x
3
+x
2
+ 1. Here is the list of codewords
m(x)g(x) code polynomial code word
0g(x) 0 0000000
1g(x) 1 +x
2
+x
3
+x
4
1011100
xg(x) x +x
3
+x
4
+x
5
0101110
x
2
g(x) x
2
+x
4
+x
5
+x
6
0010111
(x
2
+ 1)g(x) 1 +x
3
+x
5
+x
6
1001011
(x
2
+x + 1)g(x) 1 +x +x
4
+x
6
1100101
(x + 1)g(x) 1 +x +x
2
+x
5
1110010
(x
2
+x)g(x) x +x
2
+x
3
+x
6
0111001
ECE 7670: Lecture 5 Cyclic codes 4
The corresponding generator and parity check matrix are
G =
1 0 1 1 1 0 0
0 1 0 1 1 1 0
0 0 1 0 1 1 1
H =
1 1 0 1 0 0 0
0 1 1 0 1 0 0
0 0 1 1 0 1 0
0 0 0 1 1 0 1
2
The codes to this point have not been systematic, but are easy to produce. We
will now do some tricks to make the code be systematic. We take the message block
m = (m
0
, m
1
, . . . , m
k1
) m(x) = m
0
+m
1
x + +m
k1
x
k1
.
Now take the code polynomial and shift it:
x
nk
m(x) = m
0
x
nk
+m
1
x
nk+1
+ +m
k1
x
n1
.
Observe that the code sequence corresponding to this is
(0, 0, . . . , 0, m
0
, m
1
, . . . , m
k1
)
Now we employ the division algorithm (this is the trick) to write
x
nk
m(x) = q(x)g(x) +d(x),
where d(x) has degree less than n k. That is, d(x) has the code sequence
(d
0
, d
1
, . . . , d
nk1
, 0, 0, . . . , 0)
Now form
x
nk
(x) d(x) = q(x)g(x).
Since the LHS is a multiple of g(x), it is a codeword. It has the form
(d
0
, d
1
, . . . , d
nk1
, m
0
, m
1
, . . . , m
k1
)
We have thus obtained a codeword in which the message data appears explicitly.
We have obtained by this trick a systematic code.
Example 3 We will demonstrate systematic coding in the (7, 3) code from before.
Let m(x) = 1 +x
2
from (1,0,1).
1. Compute x
nk
m(x) = x
4
m(x) = x
6
+x
4
.
2. Employ the division algorithm:
x
6
+x
4
= (x
2
+x + 1)(x
4
+x
3
+x
2
+ 1) + (x + 1).
3. Then our code polynomial is
c(x) = x
nk
m(x) d(x) = (1 +x) + (x
6
+x
4
) (1, 1, 0, 0, 1, 0, 1).
We can still explicitly see the message part. 2
2 Some hardware considerations
One of the justications for using cyclic codes, and using the polynomial repre-
sentation in general, is that there are some interesting and ecient hardware con-
gurations for performing the encoding operation. This has been of particularly
historical importance.
ECE 7670: Lecture 5 Cyclic codes 5
2.0.1 Galois eld operations
If we represent elements in a Galois eld using the m-tuple representation, addition
is easy, element-by element, using exclusive-or gates to perform the addition.
Multiplication by a xed Galois eld element is also fairly straightforward. Let
us take, as an example, multiplication in GF(2
4
). Let be in GF(2
4
), and represent
it as
= b
0
+b
1
+b
2
2
+b
3
3
.
That is, has the m-tuple representation (b
0
, b
1
, b
2
, b
3
). Let g be a xed element in
GF(2
4
), and suppose for this example, that g = 1 +. Let = g. Then
= c
0
+c
1
+c
2
2
+c
3
3
= (b
0
+b
1
+b
2
2
+b
3
3
)(1 +)
= b
0
+ (b
0
+b
1
) + (b
1
+b
2
)
2
+ (b
2
+b
3
)
3
+b
3
4
= (b
0
+b
3
) + (b
0
+b
1
+b
3
) + (b
1
+b
2
)
2
+ (b
2
+b
3
)
3
.
A hardware implementation is straightforward. (Draw a diagram.)
2.0.2 Polynomial multiplication
Now to compute m(x)g(x). This is simply a feed-forward (FIR) lter. The message
bits are fed in in descending order: m
k1
, m
k2
, . . . , m
0
:
As a specic example, we have, for g(x) = 1 +x
2
+x
3
+x
4
the following
Consider a specic example: m(x) = m
0
+m
1
x+m
2
x
2
and g(x) = g
0
+g
1
x+g
2
x
2
.
What about further shifts?
For the systematic encoding, we have three steps:
ECE 7670: Lecture 5 Cyclic codes 6
1. Multiply by x
nk
. This is accomplished by feeding into the middle of the shift
register:
2. Divide by g(x). Polynomial division is obtained using LFSR. To forma(x)/g(x),
we recognize (from signal processing experience) that division is accomplished
using a feedback connection.
The inputs are fed in in decreasing index order: a
n1
, a
n2
, . . . , a
0
. After the
last symbol has been fed in, the LFSR contains the remainder of a(x)/g(x).
ECE 7670: Lecture 5 Cyclic codes 7
3. Set c(x) = x
nk
m(x)d(x). Here we simply employ some switching circuitry:
Start in X: pass in message, which appears at output and goes into divider.
Then switch to Y and read out the parity bits.
3 Syndrome decoding
We now examine the question of decoding cyclic codes. Recall that for any linear
code, we can form a standard array; or we can use the reduced standard array using
syndromes. We will be able to exploit the cyclic structure of the codes to decrease
the memory requirements.
Consider the systematically-encoded codeword
c = (d
0
, d
1
, . . . , d
nk1
, m
0
, m
1
, . . . , m
k1
) = (d, m)
We can perform error detection as follows:
1. Estimate a message based on the systematic message part. Call this m
.
2. We then encode m