ERROR DETECTION & ERROR CORRECTION
MSRIT INFORMATION SCIENCE
1
AMAK A-> ANKITA (1MS07IS133) M-> MAYANK (1MS07IS047) A-> ANSHUJ (1MS07IS011) K-> KRISH (1MS07IS038)
MSRIT INFORMATION SCIENCE
2
TABLE OF CONTENTS:
INTRODUCTION TO ERROR
REDUNDANCY
CODING
• LINEAR BLOCK CODING • HAMMING CODE • CYCLIC REDUNDANCY CHECK(CRC) • IMPLEMENTATION OF HAMMING CODE •
MSRIT INFORMATION SCIENCE
3
INTRODUCTION •
What is an error???
Unpredictable change of bits from 1->0 or 0->1.
•
Types
o Single bit error o Burst error(Multiple) o ØRedundancy: Correction or detection of errors. MSRIT INFORMATION SCIENCE
4
Forward error correction: Method of Guessing the actual message using the redundant bits.
Retransmission: Repeated sending of message until error free.
Modulo Arithmetic: • Modulo 2- Remainder after division can be either 0 or1. • Modulo 3- Remainder after division can be either 0,1 or 2. • . • . • . • Modulo n- Remainder after division can be either 0,1,2….n-1.
MSRIT INFORMATION SCIENCE
5
Adding :
0+0=0 0+1=1 1+0=1 1+1=0
Subt:
0-0=0 0-1=1 1-0=1 1-1=0
XOR operation:
• •
1 0 1 1 0
•
1 1 1 0 0
•
0 1 0 1 0
MSRIT INFORMATION SCIENCE
6
CODING: Redundancy is achieved through coding.
•
qBLOCK CODING: Message divided into blocks. •
k bit datawords
•
r redundant bits
•
n= k+r, n>k,n bit codeword.
•
2k total datawords(equal to number of valid codewords.)
•
2n total codewords
•
2n -2k invalid codewords MSRIT INFORMATION SCIENCE
7
ERROR DETECTION
o If resulting codeword is invalid. o If multiple errors in the codeword result in valid codeword. •
ERROR CORRECTION
o More difficult. o Need more number of redundant bits than for detection.
o Involves error detection as well as finding the position(s) where error has occurred. MSRIT INFORMATION SCIENCE
8
HAMMING CODE GENERATION •
Generation of codewords for each dataword: C(7,4)
•
n ,k
•
Codeword is generated by the generator which appends 3 redundant bits at the end of the dataword. •R Modulo-2 o =a2 + a1 + a0
R1= a3 + a2 + a1
•
R2= a1+ a0 + a3
• •
Modulo-2
Modulo-2 MSRIT INFORMATION SCIENCE
9
A CRC CODE WITH C(7,4) DATAWO RD 0000 0001 0010 0011 0100 0101 0110 0111
CODEWOR DATAWOR CODEWORD D D 0000000 1000 1000110 0001101 1001 1001011 0010111 1010 1010001 0011010 1011 1011100 0100011 1100 1100101 0101110 1101 1101000 0110100 1110 1110010 0111001 1111 1111111
MSRIT INFORMATION SCIENCE
10
checker on the receiver side will generate a 3bit syndrome by the formulae given below:
•
s0 = b2 + b1 + b0 + q0
modulo-2
•
s1 = b3 + b2 + b1 + q1
modulo-2
•
s2 = b1 + b0 + b3 + q2
modulo-2
• •
•
If the syndrome i.e s2s1s0 is 000 then data is error free…or undetected.
• •
Otherwise, received codeword has an error(s). MSRIT INFORMATION SCIENCE
11
•
MAGIC TABLE
• •
SYNDRO 000 001 010 011 100 101 • ME ERROR None q0 q1 b2 q2 b0
110 111 b3 b1
• • •
Depending upon the value of syndrome we can find the position of occurrence of error and then the bit position where error has occurred is flipped.
•
• • • •
MSRIT INFORMATION SCIENCE
12
CODEWORD NOTATION ON SENDER’S AND RECEIVER’S SIDE
CODEWO 1 RD SENT
1 0 1 0 0 0
a3 a2 a1 a0 R2 R1 R0
RECEIVED 0 CODEWO RD
1 0 1 0 0 0
b3 b2 b1 b0 q2 q1 q0
MSRIT INFORMATION SCIENCE
13
HAMMING DISTANCE
• • •
Number of bit change occurring between two codewords. 0111010 10111 11 0100101
• •
The total number of ones is equal to the number of bit changes between two codewords.
•
• •
MSRIT INFORMATION SCIENCE
14
MINIMUM HAMMING DISTANCE
Smallest Hamming Distance between all sets of codewords.
•
Ex-
•
d(0000000,0001101) = 3
•
d(0001100,0111001) = 4
•
d(0110100,0111001) =3
•
d(11111111,0000000) =7…. & so on..
•
•
Dmin = 3 for the above set of codewords. MSRIT INFORMATION SCIENCE
15
Suppose ‘s’ errors are to be detected, then dmin should be s+1.
•
for the example taken, it can detect upto a maximum of 2 errors.
•
•
Suppose ‘t’ errors are to be corrected, then the dmin should be 2t+1.
in the above example, it can correct upto only 1 error.
MSRIT INFORMATION SCIENCE
16
CYCLIC CODE
Linear block code?
Linear block code with an extra property: code word is cyclically rotated that generates another codeword.
1010110 is a codeword on rotating 0101101 which is another codeword.
•
MSRIT INFORMATION SCIENCE
17
CYCLIC REDUNDANCY CHECK (CRC)
Type of linear block code which only detects errors.
Its computation resembles a long division operation in which the quotient is discarded and the remainder becomes the result.
MSRIT INFORMATION SCIENCE
18
CRC ENCODER AND DECODER
MSRIT INFORMATION SCIENCE
19
Encoder on sender’s side generates codeword.
Dataword size is k bits.
Desired codeword is n bits.
Augment dataword by appending n-k 0’s.
Divisor (predefined) of size n-k+1, divides augmented dataword in generator.
Obtained remainder is appended to dataword. MSRIT INFORMATION SCIENCE
20
The generated codeword is sent to receiver via some transmission medium. Decoder on receiver’s side checks for errors. The checker divides the codeword by the same divisor. This generates a remainder which is called a syndrome. If the syndrome is 0 then there is no error or the error is undetected. If syndrome is non zero, error has been detected and data is discarded.
MSRIT INFORMATION SCIENCE
21
POLYNOMIAL REPRESENTATION Cyclic codes can be represented using polynomials. Special polynomials in which co-efficient can be either 0 or 1. The bit position of dataword indicates power of the polynomial. • Ex:- 1 0 0 1 1 0 1 1
• • •
x7 x6 x5 x4 x3 x2 x1 x0
equivalent polynomial expression x7+x4+x3+x+1. MSRIT INFORMATION SCIENCE
22
CODEWORD GENERATION
The given dataword can be represented in polynomial terms.
Multiply the dataword with xn-k to generate augmented dataword.
The augmented dataword is divided by the generator polynomial g(x) and the resulting remainder is added to the augmented dataword.
Note in division when we subtract we actually perform XOR operation. MSRIT INFORMATION SCIENCE
23
ERROR DETECTION
The divisor on the receiving side divides the received code word and generates a remainder. Remainder is also called as a syndrome. If the syndrome generated is 0 then there is no error in transmission or undetected error. Non zero syndrome means that error has been detected. No error correction is possible using CRC. MSRIT INFORMATION SCIENCE
24
Received codeword can be represented as • Received codeword=c(x)+e(x) where c(x) is original codeword • e(x) is the error. The error is detected if • received codeword=c(x)+e(x) is not divisible. • g(x) If e(x) is divisible by g(x) then error goes undetected. ØSingle bit error: • e(x)=xi. • xi should not be divisible by g(x). • x0 term should be 1 so that we can catch the error.
MSRIT INFORMATION SCIENCE
25
•
Two Isolated bit errors:
e(x)=xi+xj. e(x)=xi(1+xj-i ) where i<j.
• •
let j-i=t so, e(x)=xi(1+xt)
•
§ To catch xi the generator should have x0=1. § To catch error of 1+xt the generator polynomial should not divide 1+xt for 0
Generator polynomial should be a factor of x+1.
• MSRIT INFORMATION SCIENCE
26
PROPERTIES OF GOOD GENERATOR POLYNOMIAL
Polynomial term. Polynomial 1. Polynomial Polynomial 0
should contain more than one should have the x0 term equal to should contain x+1 as a factor. should not divide 1+xt for
MSRIT INFORMATION SCIENCE
27
ACKNOWLEDGEMENT •We would like to thank Mydhili Ma’m for giving us an opportunity to present this presentation and for the support extended by her. • •We would also like to thank Mr. Mohan Kumar our project incharge. MSRIT INFORMATION SCIENCE
28
QUESTIONS
??? MSRIT INFORMATION SCIENCE
29