Sie sind auf Seite 1von 29

S.

72-227 Digital Communication Systems

Cyclic Codes

S.72-227 Digital Communication Systems

Lectures: Timo O. Korhonen, tel. 09 451 2351, Michael


Hall, tel. 09 451 2343
Course assistants: Seppo Saastamoinen (seppo.saastamoinen
@hut.fi), tel. 09 451 5417, Naser Tarhuni (ntarhuni
@pop.hut.fi ), tel. 09 451 2255
Study modules: Examination /Tutorials /Project work
NOTE: Half of exam questions directly from tutorials
Project work guidelines published later in course homepage

Timo O. Korhonen, HUT Communication Laboratory

Practicalities

References:
A. B. Carlson: Communication Systems (4th ed.)
J. G. Proakis, Digital Communications (4th ed.)
L. Ahlin, J. Zander: Principles of Wireless
Communications
Prerequisites: S-72.245 Transmission Methods in
Telecommunication Systems
Homepage: http://www.comlab.hut.fi/opetus/227/
Timetables:
Lectures: Tuesdays 14-16 S3, Wednesdays 12-14 I346
Tutorials: Mondays 14-16 S2, starting 21.3.05

Timo O. Korhonen, HUT Communication Laboratory

Targets today

Taxonomy of coding
How cyclic codes are defined?
Systematic and nonsystematic codes
Why cyclic codes are used?
How their performance is defined?
How practical encoding and decoding circuits are realized?
How to construct cyclic codes?

Timo O. Korhonen, HUT Communication Laboratory

Taxonomy of Coding

Error
Correction
Coding
= FEC
- no feedback
channel
- quality paid
by redundant
bits

Cryptography
(Ciphering)
- Secrecy/ Security
- Encryption (DES)

Timo O. Korhonen, HUT Communication Laboratory

Source
Coding
- Makes bits
equal
probable

Compression
Coding

Error
Detection
Coding
- used
in ARQ
as in TCP/IP
- feedback channel
- retransmissions
- quality paid by delay

Error Control
Coding
- Strives to
utilize
channel
capacity by
adding
extra bits

- Redundancy removal:
- Destructive (jpeg, mpeg)
- Non-destructive (zip)

Line Coding
- for baseband
communications
- RX synchronization
- Spectral shaping
for BW requirements
- error detection

FEC: Forward Error Correction


ARQ: Automatic Repeat Request
DES: Data Encryption Standard

Background

Coding is used for


error detection and/or error correction (channel coding)
ciphering (security) and compression (source coding)
In coding extra bits are added or removed in data transmission
Channel coding can be realized by two approaches
FEC (forward error coding)
block coding, often realized by cyclic coding
convolutional coding
ARQ (automatic repeat request)
stop-and-wait
go-back-N
selective repeat etc.
Note: ARQ applies FEC for error detection

Timo O. Korhonen, HUT Communication Laboratory

Block and
convolutional coding

k bits

(n,k)
(n,k)
encoder
encoder

n bits

Block coding: mapping of source bits of length k into (binary) channel


input sequences n (>k) - realized by cyclic codes!
Binary coding produces 2k code words of length n. Extra bits in the code
words are used for error detection/correction
k input bits
(1) block, and (2) convolutional codes:
(n,k) block codes: Encoder output of
n bits depends only on the k input bits
n output bits
(n,k,L) convolutional codes:
each source bit influences n(L+1)
input bit
encoder output bits
n(L+1) is the constraint length
L is the memory depth
n(L+1) output bits
Essential difference of block and conv. coding
is in simplicity of design of encoding and decoding circuits

Timo O. Korhonen, HUT Communication Laboratory

Why cyclic codes?

For practical applications rather large n and k must be used. This is because
in order to correct up to t errors it must be that
t n
n n n
nk

1
...

i1

i
{1 2 t
number of syndromes n
number of error patters
(or check-bit error patterns)
in encoded word
t n

1
1 RC log 2
note: q n k n(1 RC )

1
n
i

Hence for R k / n 1, large n and k


k-bits
n-bits
(n,k)
C
(n,k)
must be used
block
blockcoder
coder
Cyclic codes are
linear: sum of any two code words is a code word
cyclic: any cyclic shift of a code word produces another code word
Advantages: Encoding, decoding and syndrome computation easy by shift
registers

Timo O. Korhonen, HUT Communication Laboratory

Example

Consider a relatively high SNR channel such that only 1 or 2 bit errors
are likely to happen. Consider the ration

1
1 RC log 2
n

(n, k )
log 2

n

i

t
i1

nk
n n
1 2

k-bits

n-bits
(n,k)
(n,k)
block
blockcoder
coder

Number of check-bits
Number of error patterns

Take a constant code rate of Rc=k/n=0.8 and consider with some


values of larger n and k :

(10,8) 0.35, (32, 24) 0.89, (50, 40) 0.97

This demonstrates that long codes are more advantages when a high
code rate and high error correction capability is required

Timo O. Korhonen, HUT Communication Laboratory

Some block codes that can be realized by cyclic codes

(n,1) Repetition codes. High coding gain, but low rate


(n,k) Hamming codes. Minimum distance always 3. Thus can detect 2
errors and correct one error. n=2m-1, k = n - m, m 3
Maximum-length codes. For every integer k 3 there exists a
maximum length code (n,k) with n = 2k - 1,dmin = 2k-1. Hamming codes
are dual1 of of maximal codes.
BCH-codes. For every integer m 3 there exist a code with n = 2m-1,
k n mt and d min 2t 1 where t is the error correction capability
(n,k) Reed-Solomon (RS) codes. Works with k symbols that consists of
m bits that are encoded to yield code words of n symbols. For these
m
codes n 2 1, number of check symbols n k 2t and d min 2t 1
Nowadays BCH and RS are very popular due to large dmin, large number
of codes, and easy generation
For further code references have a look on self-study material!

Timo O. Korhonen, HUT Communication Laboratory

1: Task: find out from literature what is meant by dual codes!

10

Defining cyclic codes: code polynomial


and generator 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.

X ( xn1 xn2 L x1 x0 )
X ' ( xn2 xn3 L x0 xn1 )

Each (n,k) cyclic code has the associated code vector with the n-bit code
polynomial

X( p ) xn1 p n1 xn2 p n2 L x1 p x0

Note that the (n,k) code vector has the polynomial of degree of n-1 or
less. Mapping between code vector and code polynomial is one-to-one,
e.g. they specify each other uniquely
Manipulation of the associated polynomial is done in a Galois field (for
instance GF(2)) having elements {0,1}, where operations are performed
mod-2. Thus results are always {0,1} -> binary logic circuits applicable
For each cyclic code, there exists only one generator polynomial whose
degree equals the number of check bits q=n-k in the encoded word

Timo O. Korhonen, HUT Communication Laboratory

11

Example: Generating of (7,4) cyclic code,


by generator polynomial G(p)=p3 +p+1
M (1101) p 3 p 2 1 <- message
G (1011) p 3 p 1 <- generator
X MG p 3 ( p 3 p 2 1 ) p ( p 3 p 2 1 ) p 3 p 2 1
p6 p5 p3 p4 p3 p p3 p 2 1
p 6 p 5 p 4 p 3 p 2 p 1 (1111111)

Timo O. Korhonen, HUT Communication Laboratory

<- encoded word

12

The common factor of cyclic codes

GF(2) operations (XOR and AND):


Modulo-2 Addition
+
0
1
0
0
1
1
1
0

Modulo-2 Multiplication
*
0
1
0
0
0
1
0
1

Cyclic codes have a common factor pn+1. In order to see this we consider
summing two cyclic code vectors:

X( p ) xn1 p n1 xn2 p n2 L x1 p x0

Unshifted

X '( p ) xn2 p n1 L x1 p 2 x0 p xn1

Left rotated

pX( p ) xn1 p n xn2 p n1 L x1 p 2 x0 p Left shifted by multiplication


Question is how to make the n-1 degree cyclic code from the multiplied code?
Adding them should yield a cyclic code:

Result can be forced to be a cyclic coden of at most of n-1n degree by dividing by


pX( p ) X '( p ) xn1 p xn1 xn1 ( p 1)
the underlined common factor!

Timo O. Korhonen, HUT Communication Laboratory

13

Obtaining a cyclic code from another cyclic code

Unity cyclic shift is obtained by multiplication by p where after division


by the common factor yields a cyclic code at the remainder

X '( p ) pX( p ) mod( p n 1)


and by induction, any cyclic shift is obtained by

X ( p ) p X( p ) mod( p 1)
(i )

Example:
shift 101

(i )

p3 1 p3 p
p3 1
p 1

101 X( p) p 2 1
pX( p ) p 3 p

pX( p )
1

011
3
p 1
p 1

not a three-bit code (1010),


divide by the common factor

Important point of implementation is is that the division by pn+1 can be


realized by a tapped shift register

Timo O. Korhonen, HUT Communication Laboratory

14

Factoring cyclic code generator polynomial

Any factor of pn+1 with the degree of q=n-k


generates an (n,k) cyclic code*
Example: Consider the polynomial p7+1. This can be factored as

p 7 1 ( p 1)( p 3 p 1)( p 3 p 2 1)

For instance the factors p3+p+1 or p3,+p2+1 can be used to generate an


unique cyclic code. For a message polynomial p2 +1 the following
encoded word is generated:

( p 2 1)( p 3 p 1) p 5 p 2 p 1
and the respective code vector (of degree n-1 or smaller) is
100111

Hence, in this example


q 3 nk

n7k 4

Timo O. Korhonen, HUT Communication Laboratory

k-bits

0101

n-bits
(n,k)
(n,k)
block
blockcoder
coder

100111

15

Using shift registers for multiplication

Figure shows a shift register to realize multiplication by p3 +p+1

unit delay
element

In practice, multiplication can be realized by two equivalent topologies:

alternate
notation of
XOR-circuit
Timo O. Korhonen, HUT Communication Laboratory

16

Multiplication by a shift register

word to be
encoded

generator polynomial
determines connection
of taps

( p 1)( p 3 p 1)

1
0
0
0
0
0
0
0
0

1
1
0
0
0
0
0
0
0

0
1
1
0
0
0
0
0
0

0
0
1
1
0
0
0
0
0

0
0
0
1
1
0
0
0
0

0
0
0
0
1
1
0
0
0

0
0
0
0
0
1
1
0
0

0
0
0
0
0
0
1
1
0

0
0
0
0
0
0
0
1
1

0
0
0
0
0
0
0
0
1

out
0
0
0
1
1
1
0
1
0

p 4 p 2 p p3 p 1
p 4 p 3 p 2 1 11101

Timo O. Korhonen, HUT Communication Laboratory

Encoded word

17

Calculating the remainder

Adding the dashed-line (feedback)


enables division by pn+1

0
0
0
0
0
0

Word to be rotated
(divided by the common factor)

0
0
1
0
0
0

A
0
1
1
0
1
0

B
0
0
1
1
0
1

C
0
0
0
1
1
0

D
0
1
1
1
0
1

Remainder is left to the


shift register

101 X( p) p 2 1
Determines tap
connections

0
1
0
0
0
0

X
0
1
0
1
0
0

pX( p ) p 3 p
pX( p )
1
1
011
p3 1
p 1
Remainder

Timo O. Korhonen, HUT Communication Laboratory

18

Examples of cyclic code generator polynomials

The generator polynomial for an (n,k) cyclic code is defined by

G ( p ) p q p q1 g q1 L pg1 1, q n k
and G(p) is a factor of pn+1. Any factor of pn+1 that has the degree q
(the number of check bits) may serve as the generator polynomial. We
noticed earlier that a cyclic code is generated by the multiplication

X ( p ) M ( p )G ( p )

where M(p) is the k-bit message to be encoded


Only few of the possible generating polynomials yield high quality
codes (in terms of their minimum Hamming distance)

G ( p) p 3 0 p 1
Some cyclic codes:

Timo O. Korhonen, HUT Communication Laboratory

19

Systematic cyclic codes

Define the length q=n-k check vector C and the length-k message
vector M by M ( p ) m p k 1 L m p m
k 1

C( p ) cq1 p q1 L c1 p c0

Thus the systematic n:th degree codeword polynomial is

X( p ) p nk (mk 1 p k 1 L m1 p m0 )
cq1 p q1 L c1 p c0
p q M ( p ) C( p )

message bits
check bits

How to determine the check-bits??


Question: Why these denote the message bits still
the message bits are M(p) ???
Timo O. Korhonen, HUT Communication Laboratory

20

Determining check-bits
X( p ) M ( p)G ( p) p q M ( p) C( p)
p nk M ( p )
C( p )

M( p)
G ( p)
G ( p)

7
7 5 1
1
5
5
Definition of systematic cyclic code

Note that the check-vector polynomial C( p ) is the remainder left over


after dividing p nk M ( p ) / G ( p ) C( p ) mod p nk M ( p ) / G ( p )
Example: (7,4) Cyclic code:

1010 -> 1010001


Timo O. Korhonen, HUT Communication Laboratory

21

Division of the generated code by the generator


polynomial leaves no reminder

p3 p 2 1
p3 p 2 1 p6 p 4 1
p6 p5 p3
p5 p 4 p3 1
p5 p 4 p 2
p3 p2 1
p3 p2 1
Timo O. Korhonen, HUT Communication Laboratory

This can be used for error


detection/correction as we inspect later

22

Example: Encoding of systematic cyclic codes

Timo O. Korhonen, HUT Communication Laboratory

23

Circuit for encoding systematic cyclic codes


0
1

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
G ( p ) p q p q1 g q1 p q2 g q2 L pg1 1
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

Timo O. Korhonen, HUT Communication Laboratory

24

Decoding cyclic codes

Every valid, received code word R(p) must be a multiple of G(p),


otherwise an error has occurred. (Assume that the probability for noise
to 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 an error has happed and sometimes also to reveal
in which bit (depending on code strength)
Division is accomplished by a shift registers whose tap order is reversed
The error syndrome of q=n-k bits is therefore

S( p ) mod R ( p) / G ( p )

This can be expressed also in terms of the error E(p) and the
code word X(p) while noting that the received word is in terms of error

R ( p ) X ( p ) E( p )
hence

S( p ) mod X( p ) E( p) / G ( p)
S( p ) mod E( p) / G ( p)
Timo O. Korhonen, HUT Communication Laboratory

25

Decoding cyclic codes: example

Using denotation of this example:

16.20 s ( x) mod e( x) / g ( x)

Timo O. Korhonen, HUT Communication Laboratory

26

Decoding cyclic codes (cont.)

Table 16.6

s ( x) mod r ( x) / g ( x)

g ( x)

Timo O. Korhonen, HUT Communication Laboratory

27

Decoding circuit for (7,4) code


syndrome computation
0

received code

syndrome

G ( p) p 3 p 1

To start with, the switch is at 0 position


Then shift register is stepped until all the received code bits have entered
the register
This results is a 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
Note that the tap order is reversed, why?

Timo O. Korhonen, HUT Communication Laboratory

28

Lessons learned

You can construct cyclic codes starting from a given factored pn+1
polynomial by doing simple calculations in GF(2)
You can estimate strength of designed codes
You understand how to apply shift registers with cyclic codes
You understand how syndrome decoding works with cyclic codes
You can design encoder and decoder circuits for your cyclic codes

Timo O. Korhonen, HUT Communication Laboratory

29

Das könnte Ihnen auch gefallen