Download Codes - faraday

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Codes
Codes are used for the following purposes:
- to detect errors
- to correct errors after detection
Types:
-
Linear Block Codes
Cyclic Codes
Convolutional Codes
BCH Codes
Reed Solomone (RS) codes
Error Control Coding
© Erhan A. Ince
Block Error Control Codes
A block error control code C consists of a set of M code
words {c0,c1,c2,……,cM-1). Each code word is of the
form c = (c0,c1,…….,cn-1).
If the values are taken from the Galois field GF(q) then the
code is said to be q-ary
Error Control Coding
© Erhan A. Ince
Encoding Process
1.
Breaking up the data stream into blocks
2.
Mapping these blocks onto code words in C
Uncoded Data Stream
k-symbol block
Block Encoder
n-symbol block
Coded Data Stream
Error Control Coding
© Erhan A. Ince
Encoding process…
If M = qk then the encoder breaks the data stream into
symbol blocks.
If M is not in the above form the encoder must work on
messages of varying length.
Ex:
Binary Hadmard Code A12
Consists of 12 code words
of length 11. The information
Blocks must be of varying
length
Message Blocks
(000)
(001)
(010)
(011)
(100)
(101)
(1100)
(1101)
(11100)
(11101)
(11110)
(11111)
Error Control Coding
© Erhan A. Ince
k-
Code Words
(00000000000)
(10100011101)
(11010001110)
(10001110110)
(01000111011)
There are (qn-M) n-symbol patterns which are not associated
with data blocks and thus are not valid code words. The code C is
said to contain redundancy.
Since # of valid code words < # of possible n-symbol blocks
redundancy = r = n – logq M
If M = qk , then r simplifies to the difference
r=(n-k)
Error Control Coding
© Erhan A. Ince
Rate of a Block Code
If M represents the number of code words each of length
n in a code C
The rate of C is :
 For M =qk
then
log M
R 2
n
Rk
n
Error Control Coding
© Erhan A. Ince
e =(e0 ,e1,…..en-1)
Error pattern
c =(c0 ,c1,…..cn-1)
Transmitted
Codeword
r =(r0 ,r1,…..rn-1)
Received Codeword
Comm Channel
If the received word is found to be invalid, then receiver assumes that
channel has caused multiple symbol errors.
The determination of whether errors are present is ERROR DETECTION
An error pattern is undetectable if it causes the received word to be a valid
code other than the one transmitted.
Given a transmitted code word c there are (M-1) code words other than c
hence (M-1) undetectable error patterns.
Error Control Coding
© Erhan A. Ince
The decoder may react in a number of ways
Request a retransmission of the word (ARQ)
(automatic repeat request)
Tag the word as being incorrect and pass it
along the datasink
(muting )
Attempt to correct the errors in the received word
Final option is referred to as :
FORWARD ERROR CORRECTION (FEC)
Error Control Coding
© Erhan A. Ince
Code Weight
The weight of a code word or error pattern is the number of
nonzero coordinates in the code word or error pattern.
Weight of a codeword is generally shown as w(c)
Example:
w(1,0,0,1,1,0,1,1,1,1) = 7
w(3,29,0,0,1, 6,0) = 4
Error Control Coding
© Erhan A. Ince
Distance between codes
Assume we have a pair of n-symbol blocks:
v = (v0,v1,……, vn-1)
w=(w0,w1,……,wn-1)
We can discuss the distance , d(v,w), between these two blocks
in a number of ways:
If we talk about Euclidean distance
d
v, w 
Euclidean
v  w 

0 
 0
2
  v  w 
1
 1
2
 ....   v  w 
n1
 n1
Euclidean distance is used extensively in the analysis of
convolutional and trellis codes
Error Control Coding
© Erhan A. Ince
2
Distance of codes …
With block codes we talk more of the time about
Hamming Distance.
This is the number of coordinates in which the two blocks
differ:
d
Hammin g


v, w   d v, w   i | v  w ,i  0,1,2,....., n 1
i
i
Error Control Coding
© Erhan A. Ince
Minimum Distance
The minimum distance of a block code C is the minimum
Hamming distance between all distinct pairs of code words
in C. This minimum distance is denoted as dmin .
A transmitted codeword is guaranteed to differ in at least dmin
coordinates from any other code word.
For an error pattern to be undetectable it must change the
symbol values in the transmitted code word in at least dmin
coordinates.

A code with minimum distance dmin can detect all error
patterns of weight less than or equal to (dmin –1)
Error Control Coding
© Erhan A. Ince
In FEC systems goal is to minimize the probability of decoder
error given a received word r.
The maximum a posteriori decoder identifies the code word ci that
maximize :
p(c=ci | r)
p(c| r) is the probability that code word c is transmitted on receipt of
code word r.
The maximum likelihood decoder (ML) identifies the code word ci
that maximizes:
p(r| c=ci ) . p(c|r)
p c pr | c
pc | r   c
p r 
R
Two expressions can be related by Baye’s rule
Error Control Coding
© Erhan A. Ince
The conditional probability p(r|c) is equal to the probability of
occurrence of the error pattern e= (r - c) given that c has been
transmitted
since lower-weight error patterns are more likely to occur than the
higher weight ones
 The codeword ci that maximizes p(r|ci) is the codeword that
minimize the d(r,ci)=w(r-c)
The maximum likelihood transmitted codeword is thus the code
word that is closest in Hamming distance to the received word r.
Error Control Coding
© Erhan A. Ince
A decoder error occurs when the received word is closer to an
incorrect code word than to the correct code word.
By definition incorrect code words are at least dmin away from
the transmitted code word
Therefore decoder errors are possible only if the weight of the
error pattern induced by the channel is greater than or equal to
dmin /2
 A code with minimum distance dmin can correct all error
patterns of weight less than or equal to (dmin –1) /2
Error Control Coding
© Erhan A. Ince
DEFINITION
 Consider a block code U
 consisting of n-tuples {V1,V2,……Vn-1}of symbols
from FG(q). U is a q-ary linear code if and only if U
forms a vector subspace over GF(q)
FG(q) is a Galois Field
Error Control Coding
© Erhan A. Ince
Linear Block Codes
- are a class of parity check codes that can be characterized by the
(n,k) notation
- The encoder transforms a block of k message digits into a longer
block code of n codeword digits (a code vector)
- If the alphabet consists of two elements (0 and 1) the code is a
binary code
- k-bit messages form 2k distinct message sequences referred to as
the k-tuples.
- the n-bit blocks can form as many as 2n distinct sequences known
as n-tuples.
Error Control Coding
© Erhan A. Ince
 The encoding process assigns to each of the 2k message k-tuples
one of the 2n n-tuples.
 The mapping is accomplished by a look-up table.
For linear codes the mapping transformation is of course linear
VECTOR SPACES
The set of all binary n-tuples, Vn, is called a vector space over the
binary field of two elements (0 and 1).
A binary field has two operations, addition and multiplication such
that the results of all operations are in the same set of two elements.
The arithmetic operations of addition and multiplication are defined
by the conventions of the algebraic field.
Error Control Coding
© Erhan A. Ince

In a binary field the rules are:
0
1
0
0
1
1
1
0
0
1
0
0
0
1
0
1
VECTOR SUBSPACES
A subset S of the vector space Vn is called the subspace if the
following two conditions are satisfied:
1.
2.
The all-zero vector is in S
The sum of any two vectors in S is also in S
(known as closure property)
Error Control Coding
© Erhan A. Ince
2n n-tuples
Entire space Vn
2k n-tuples
Constitude subspace of code words
Error Control Coding
© Erhan A. Ince
Linear Code

If Vi and Vj are two code words in an (n,k) binary block
code the
code is said to be linear only if (Vi  Vj ) is also a code vector.
 Vectors outside the subspace can not be created
by the addition of legitimate code vectors (members
of the subspace)
Example: vector space V4 is populated by the following 24 4-tuples
0000 0001
1000 1001
0010
1010
0011
1011
0100
1100
Error Control Coding
© Erhan A. Ince
0101
1101
0110
1110
0111
1111
Example ofa subset of V4 is :
0000
0101
1010
0000
0101
0101
1111
1010
1111
0101
A set of 2k n-tuples is called a linear block code if and only if it is a
subspace of the vector space Vn of all n-tuples.
Error Control Coding
© Erhan A. Ince
Example:
Assume that we have a (6,3) code
There are 2k = 23 = 8 message vectors
there are 2n = 26 = 64 6-tuples in the V6 vector space
message vector
000
100
010
110
001
101
011
111
code vector
000000
110100
011010
101110
101001
011101
110011
000111
It is easy to check that the eight code vectors form a subspace
of V6 (all-zeros vector is present and the sum of any two code
words yields an other one which is a member of the subspace.
Error Control Coding
© Erhan A. Ince
Generator Matrix
 If for an (n,k) code k is large a table look-up implementation is not
feasible.
i.e for (127,92) code there are 292 or approximately 5x2027 code
vectors. Table-lookup brings the need for a large amount of
memory
 Fortunately it is possible to only generate code vectors as they are
required.
Since a set of code vectors that form a linear block code is a
k-dimensional subspace of the n-dimensional binary vector space
(k<n), it is always possible to find a set of n-tuples, fewer than 2k, that
can generate all the 2k vectors in the subspace. The generating set of
vectors is said to span the subspace.
Error Control Coding
© Erhan A. Ince
 Smallest linearly independent set that spans the subspace is called a
basis of the subspace.
 number of vectors in this basis set is the dimension of the subspace.
 Any basis set of the k linearly independent n-tuples V1, V2, ….., Vk
can be used to generate the required linear block code vectors since
each code word is a linear combination of V1, V2, ….., Vk
That is each of the set of 2k code vectors U can be described as:
U = m1V1 + m2V2 + ………+ mkVk
where mi = ( 0 or 1) and i= 1,……,k
Error Control Coding
© Erhan A. Ince
Generator matrix….
In general we can define a generator matrix as a (k  n) array:
 V  V
 1   11
 V  V
G   2    21
 


 
 V  V
 k   k1
V
 V 
12
1n 
V
 V 
22
2n 



V
 V 
k2
kn 
The message m is shown as a row vector with (1  k) dimensions :
m  m , m ,, m
1 2
k
The generation of the code vector U is denoted as:
U=mG
Error Control Coding
© Erhan A. Ince
Ex: Assume a generator matrix as below:


 V1  1

 
G   V   0
2 

 V  1
 3
1 0 1 0 0

1 1 0 1 0

0 1 0 0 1
Where V1,V2 and V3 are the three linearly independent vectors ( a
subset of the eight code vectors ) that can generate all code vectors.
Assuming message vector is ( 1 1 0) we can use G to generate the
code vector for this message:
U  1 1
V 
 1
0  V   1 V  1 V  0  V
2
1
2
3
V 
 3 

=110100 + 011010+000000
= 1 0 1 1 1 0 ( code vector for message 110)
* Linear combination of the rows
of G
Error Control Coding
© Erhan A. Ince