Anda di halaman 1dari 39

ERROR DETECTION

Bit errors are sometimes introduced into frames


Bit error simply means change from 0 to 1 or 1 to 0
This most of the time happens because of:
NOISE
Where noise is defined as the induction of unwanted signal into
data

ERROR DETECTION
Data is transmitted in form of signals
Process of translating binary data into signal is called
ENCONDING SCHEME
Most commonly the signal travelling on a wire is an
electrical or electromagnetic signal
Usually one bit is represented by one voltage value
And second bit by another voltage value
E.g. 1 = +5 Volt 0 = -5 Volt


Data 101010
10
10
10
0 1 0 1 0 1
ERROR DETECTION
In simple words electricity is flowing between the two PCs
Whenever electricity or electrical signal is flowing through a wire
It creates electromagnetic field around it
Simply the area around the wire in which current has its affect is
called electromagnetic field
Data 101010
10
10
10
0 1 0 1 0 1
10
10
10
0 1 0 1 0 1
Noise
0
ERROR DETECTION
This type of noise is called electrical interference
There are many other types of noise:
Thermal noise, Shot noise, Burst Noise, Flicker Noise
Bit errors are introduced into frames because of noise
Some strategy is needed to detect these errors
Parity
Checksum
CRC ( Cyclic Redundancy Check )


ERROR DETECTION
General steps in every error detection strategy:
Send extra information with data
This information is calculated from data
This information is generally called Redundant Information
Errors are detected in data by using Redundant Information
If error is detected in a frame
The frame is dropped
Sender retransmits the frame


ERROR DETECTION
Every strategy has its own way of calculating redundant
information and has its own name for it


Redundant
Information
Even
Parity
CRC
Number
Internet
Checksum
Odd Parity
ERROR DETECTION
ERROR DETECTION
Lets design a simple error detection strategy
In simplest case we can think of sending two frames
Original data frame
Copy of data frame ( Redundant Information )
Receiver compares the two frames
If the two match there is no error
Frame is accepted and copy is discarded
If the two do not match there is an error
Frame is rejected and both data and copy are discarded






101010 10
Data
10 10
10
10
10
10
Copy
10
10
Data
Copy
10
10
Receiver compares the two frames
If the two match there is no error
Frame is accepted and copy is discarded
If the two do not match there is an error
Frame is rejected and both data and copy are discarded







00
10
ERROR DETECTION
ERROR DETECTION
Is this a good Error Detection Strategy?
Too much redundant information


ERROR DETECTION
Parity Schemes
Even Parity
Check digit (1 or 0) is added to make sure there are an even
number of 1s
Odd Parity
Check digit (1 or 0) is added to make sure there are an odd
number of 1s
Two-Dimensional Parity
Add parity bits in both dimension i.e. row-wise and column-wise

ERROR DETECTION
Even Parity
With every 7 bits of data one parity bit is added to keep number of 1s even
When receiver receives the data, it checks the number of 1s
If number of 1s are even then, data is correct
If number of 1s are odd then there is an error

1 0 0 0 0 1 1
1
0 1 1 0 0 1 1
0
0
ERROR DETECTION
1 0 0 0 0 1 1
1
1
Even Parity
If more then one bits are corrupted in such a way that number of 1s stay
even, the error goes undetected

1
ERROR DETECTION
Is this a good Error Detection Strategy?
Cannot detect all types of errors


ERROR DETECTION
Two-Dimensional Parity
Divides data into blocks, where every block contains 7 groups of 7 bits
Adds parity bits both column-wise and row-wise
1 0 0 0 0 1 1
0 0 1 0 0 0 1
1 1 0 0 0 1 0
1 0 0 1 0 1 1
0 0 0 1 0 0 0
0 1 1 0 0 1 1
0 1 0 0 1 1 0
1 0 0 1 1 0 1
1
0
1
0
1
0
1
0
ERROR DETECTION
Is this a good Error Detection Strategy?
Can detect more types of errors as compared to simple
parity schemes
Sends more Redundant Information as compared to
simple parity scheme


ERROR DETECTION
When the logic for detecting errors is based on addition, such
strategies may be called checksum
Internet Checksum Algorithm
Add up all the words of sending data and then transmit the
result of that sum ( R.I ) with data
A word can be 1,2 or 4 bytes of data
The receiver performs the same calculation on the received data
and compares the result with the received checksum
If answers match there is no error otherwise error detected

ERROR DETECTION
1 0 1 0 0 1 1 1
0 1 0 0 1 1 0 0
1 0 1 1 0 1 1 0
Sum
Add
Words
Transmitted
Data
Sum
Compare
Recalculate
Sum
1 0
1 1
0
1
1
1 0
1 1
1
1
0
1
1
0
1
1 0 1 0 1 0 1
0 1 0 1 0 1 0 1
ERROR DETECTION
This strategy is implemented at network layer
Sends less redundant information
A very weak strategy for Error Detection
If bits are corrupted in such a way that sum does not change
error will go undetected
ERROR DETECTION
CRC ( Cyclic Redundancy Check)
Before communication sender and receiver agree on a divisor
Before sending the data CRC number is combined with data
It makes the data completely divisible by divisor
On Receiver Side
If data is again completely divisible, no Error detected
If data is not completely divisible, Error is detected


ERROR DETECTION
CRC process is usually carried in polynomial form
Polynomial Form is used for two reasons
Polynomial mathematics is easy and efficient
Long binary messages can be represented by short polynomials
Conversion Process
Start from right side and write x under each binary digit with
powers in sequence
Multiply them with binary digits
Add all the terms
Highest power in a polynomial is the DEGREE of polynomial
0 1 1 0
1
5 bits Polynomial Of Degree 4
1 1 0 1
0 1
6 bits Polynomial Of Degree 5
1 0 0 0
0 0
7 bits Polynomial Of Degree 6
1
ERROR DETECTION
CRC Process:
n + 1 bits of data (Message) M(x) is represented by a polynomial of degree n
For Calculating CRC:
Both sender and receiver choose a common divisor C(x) with degree k
Any number can be chosen as a divisor as long as k < n
Multiply M(x) into x
k

to obtain T(x), can also be called zero-extended
message. T(x) = M(x) * x
k

Divide T(x) by C(x) and find remainder. T(x) / C(x) => Remainder


Subtract Remainder from T(x). T(x) - Remainder
At this point we get data combined with CRC , which is completely
divisible by divisor


T(x) = 10011010 000
T(x) = (x
7
+ x
4
+ x
3
+ x
1
) *

x
3
T(x) = x
7
.x
3
+ x
4
.x
3
+ x
3
.x
3
+ x
1
.x
3
T(x) = x
7+3
+ x
4+3
+ x
3+3
+ x
1+3
T(x) = x
10
+ x
7
+ x
6
+ x
4
M(x) Where
n = 7
C (x) k=3
agreed ,k < n
M(x) = 10011010
x
7
+ x
4
+ x
3
+ x
1
C(x) = 1101
C(x) = 1101
x
3
+ x
2
+ 1

T(x) = M(x) * x
k
T(x) Zero
Extended
Message
(x
10
+ x
7
+ x
6
+ x
4
) /

( x
3
+ x
2
+ 1 ) = Remainder

x
10
+ x
7
+ x
6
+ x
4
x
3

+

x
2

+

1

x
7
x
10
+ x
9
+ x
7


x
9
+ x
6
+ x
4
- x
6
x
9
x
8
x
6
x
8
+ 2x
6
+ x
4
+ x
5
x
8
+ x
7
+ x
5
x
7
x
5
+ x
4
x
4
x
7
x
6
x
4
0

x
6
x
5
+ 2x
4
0

+ x
3
x
6
+ x
5
+ x
3
2x
5
+ x
3
0

+1

x
3
+ x
2
+ 1

x
2
1

Remainder = 101
T(x) Remainder

(x
10
+ x
7
+ x
6
+ x
4
) ( x
2
1)

x
10
+ x
7
+ x
6
+ x
4
+ x
2
+ 1

10011010 101
Data + CRC
CRC 101
10011010 101
Complete Division =
No Error
Incomplete Division =
Error Detected
Completely
Divisible On
Divisor
ERROR DETECTION

ERROR DETECTION
BISYNC protocol uses two dimensional parity
IP uses Internet Checksum
HDLC, DDCMP, use CRC
Ethernet and 802.5 networks use CRC-32, while HDLC
uses CRC-CCITT. ATM uses CRC-8, CRC-10, and CRC-32.

ERROR CORRECTION
Error correction are more complex schemes then detection
We need to know the exact position of corrupted bits
Hamming Codes:
Developed by Richard Hamming
Can correct up to one bit-error ( one we will study )
Takes help from simple parity
Redundant bits are placed at every 2
K
position
Data is placed in between redundant bits
Every redundant bit is responsible for checking bits at some
position
CORRECTION comes after DETECTION


ERROR CORRECTION
R parity bits are required for 2
R
-R-1 data bits
Parity bits are placed at position 2
K
i.e. 1,2,4,8,16,..
Parity bit at position k is responsible for every k bit(s)
starting from position k and at a gap of k bits. e.g.
Parity bit 1 is responsible for bits at position [1], [3], [5], [7]
Parity bit 2 is responsible for bits at position [2,3], [6,7], [10,11]
Parity bit 4 is responsible for bits at position [4,5,6,7], [12,13,14,15]..
Data is placed in between the Redundant Bits. i.e. any
position 2
k

e.g. 3,5,6,7,9,10,11,12,13,14,15,17.

ERROR CORRECTION
Sender:
Separate parity checking is done for every redundant bit
and the bits that it is responsible for
By using even parity, number of 1s are kept even
Receiver:
Recalculates parity bit in received data for every redundant
bit and its responsible bits
By combining these recalculated parity bits we get the
position of corrupted bit
The bit at that position is simply flipped
ERROR CORRECTION
R parity bits are required for 2
R
-R-1 data bits
E.g. for 7 data bits.
For R = 1, 2
1
1 1 = 0
For R = 2, 2
2
2 1 = 1

For R = 3, 2
3
3 1 = 4
For R = 4, 2
4
4 1 = 11
So total of 11 bits with 7 data bits and 4 parity bits
Parity bits are placed at position 2
k
and data bits between
them

Parity bit at position k is responsible for every k bit(s) starting from position
k and at a gap of k bits.
ERROR CORRECTION
Insert
Data at
position
2
k
Separate
Parity
Checking
Transmission
Recalculate
Parity Bits
Combine
Bits =
Position
Flip Bit
Sender Receiver
1 0 1 1 0 0 1 Data
11 10 9 8 7 6 5 4 3 2 1
1 0 1 1 0 0 1 1 0 0 1
1
0
1
1
0
0
1
1
0
0
1
0
0
1 1 1 0
Position =7
Insert
Data at
position
2
k
Separate
Parity
Checking
Transmission
Recalculate
Parity Bits
Combine
Bits =
Position
Flip Bit
Sender Receiver
1 0 1 1 0 0 1 Data
11 10 9 8 7 6 5 4 3 2 1
1 0 1 1 0 0 1 1 0 0 1
1
0
1
1
0
0
1
1
0
0
1
0 0 0 0
Position = 0
HAMMING DISTANCE
To find the hamming distance we exclusively or every
code word with the code word below it
The minimum distance is then called
d
min
= Hamming Distance
Any error detection scheme having a minimum hamming
distance of d
min
is guaranteed to:
Detect errors up to : d
min
1
Correct errors up to: (d
min
1) / 2

Anda mungkin juga menyukai