0% found this document useful (0 votes)
69 views42 pages

4 - Error Detection Schemes

The document discusses different error detection techniques used to identify errors in transmitted data. It describes parity checking which uses an additional parity bit to detect single bit errors. It also explains cyclic redundancy checks (CRC) which generate a mathematical signature of the data to detect errors.

Uploaded by

Play Store
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views42 pages

4 - Error Detection Schemes

The document discusses different error detection techniques used to identify errors in transmitted data. It describes parity checking which uses an additional parity bit to detect single bit errors. It also explains cyclic redundancy checks (CRC) which generate a mathematical signature of the data to detect errors.

Uploaded by

Play Store
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Faculty Of Engineering and Technology

Department of Computer Science


Course: Digital Logic and Design-I
Course Code : CS-105 (4)
(Lecture-3a)

Instructor: Wali Ullah


Department of Computer Science
Email: [email protected]
Mobile: +93(0) 704545238
CONTENTS

 Error Detection methods

2
OUTCOMES

At the end of this lecture, students will know;

• Error detection in different scenarios and their adequate usage

3
Error detection Techniques

"Data error" has become more common as data transfers over various network
channels have increased. Sensitive data might be lost when the data being
communicated is corrupted or damaged as a result of internal or external
interferences.
Error detection techniques are utilized to address this problem and identify whether
our data has been damaged or not.
Error detection techniques are responsible for checking whether any error has
occurred or not in the data that has been transmitted via network.

4
Error Detection Methods

Types of Error Detection methods


1) Parity Checking
2) Cyclic Redundancy Check (CRC)
3) Longitudinal Redundancy Check (LRC)
4) Check Sum
1) Parity Checking

Parity Checking:
 An easy-to-use approach of detecting errors in digital transmission is parity
checking.
 It involves adding an additional bit, known as the parity bit, to the right of a
binary message in order to guarantee that the total number of 1s in the
message, including the parity bit, is either even or odd, depending on the
parity type that has been selected (even or odd).
 By adding a parity bit, the received message's errors can be detected..
Parity Types

Even Parity:
In even parity, the total number of 1s, including the parity bit, is made even.
If the data already contains an even number of 1s, the parity bit is set to 0.
If the data contains an odd number of 1s, the parity bit is set to 1.
Odd Parity:
In odd parity, the total number of 1s, including the parity bit, is made odd.
If the data already contains an odd number of 1s, the parity bit is set to 0.
If the data contains an even number of 1s, the parity bit is set to 1.
Odd parity

Parity Checking:
 Odd Parity:
 In odd parity, an extra bit is added to the data so that the total number of bits in
resultant data (original data + parity bit) is an odd number.
 If the total count of set bits is already odd in the original data, the added parity
bit is set to 0. If it's even, the added parity bit is set to 1.
 The receiver checks the received data and parity bit. If the total count of set
bits (including the received parity bit) is an odd number, no error is detected.
If it's an even number, an error is detected.
Example of Odd Parity
• Let's say we want to transmit the 4-bit binary data 1011 using odd parity.
We add an extra bit to ensure an odd count of set bits. Since the original
data has three 1s (which is odd), we add a parity bit of 0.
• The transmitted message becomes 10110. If an error occurs during
transmission, such as flipping one of the bits to 10100, the receiver can
detect the error because the total number of set bits(1’s) (including the
parity bit) is now even.

9
Even Parity
• Even Parity:
• In even parity, an extra bit is added to the data so that the total number
of set bits in both the data bits and the added parity bit is an even
number.
• If the total count of set bits is already even in the original data, the added
parity bit is set to 0. If it's odd, the added parity bit is set to 1.
• The receiver checks the received data and parity bit. If the total count of
set bits (including the received parity bit) is an even number, no error is
detected. If it's an odd number, an error is detected.

10
Example of Even Parity
• Let's transmit the 4-bit binary data 1100 using even parity. We add an
extra bit to ensure an even count of set bits. Since the original data has
two 1s (which is even), we add a parity bit of 0 to the left of the data and
data becomes as 11000. The message to be transmitted would be 11000.
• If an error occurs during transmission, such as flipping one of the bits to
11001, the receiver can detect the error because the total number of set
bits(1’s) (including the parity bit) is now odd.

11
Cont.…
NOTE: The counting of data bits will include the parity bit also.
 The circuit which adds a parity bit to the data at transmitter is called “Parity
generator”.
 The parity bits are transmitted and they are checked at the receiver.
 If the parity bits sent at the transmitter and the parity bits received at receiver
are not equal then an error is detected.
 The circuit which checks the parity at receiver is called “Parity checker”.
Exercise
Exercise 1: Given the data 1101101 and using even parity, calculate the transmitted
message.
Data to be transmitted: 1101101
As the total number of 1s in the data are = 5 (odd)
Since even parity is chosen, add a parity bit of 1 to make it even.
Transmitted message: 11011011
Exercise 2: Given the data 1010011 and using odd parity, calculate the transmitted message.
Data to be transmitted: 1010011
Total number of 1s in the data = 4 (even)
Since odd parity is chosen, add a parity bit of 1 to make it odd.
Transmitted message: 11010011

14
Messages with even parity and odd parity Exercise?

NOTE: For even parity


the total one’s should
be even whereas for
odd parity the total
one’s should be odd. If
not then you have to
add 1 or zero to the
right of the message to
be transmitted.
Advantages of Parity Checking
• Simplicity: Parity checking is an easy-to-implement error detection method,
making it suitable for simple digital systems.
• Low Overhead: It adds minimal overhead to the transmitted data because only
one extra bit (the parity bit) is added.
• Detection of Single-Bit Errors: Parity checking is effective at detecting single-bit
errors in data. If any single bit is flipped during transmission, the parity check can
catch it.
• Real-Time Error Detection: Errors can be detected in real-time, as parity is
checked during transmission. This allows for immediate identification of data
corruption.
• Cost-Effective: It is cost-effective because it requires minimal hardware resources
and computational power to implement.
16
Disadvantages of Parity Checking
• Limited Error Detection: Parity checking can only detect single-bit errors. It is ineffective at
detecting multiple-bit errors, which are more common.
• No Error Correction: Parity checking can only detect errors; it does not provide the
capability to correct them. When an error is detected, the receiver must request
retransmission of the data, leading to potential delays.
• Limited Error Localization: Parity checking can determine that an error exists but cannot
tell us the exact bit that is in error. This makes it challenging to correct the error.
• Not Suitable for Critical Applications: In critical systems where high levels of error
detection and correction are required, such as aerospace or medical devices, parity
checking may not provide sufficient reliability.
• Limited Applicability: Parity checking is most suitable for simple communication channels
with low error rates. In high-noise or high-error-rate environments, more advanced error
detection and correction methods are used.
17
2) Cyclic Redundancy Check (CRC):

 A mathematical method called the Cyclic Redundancy Check (CRC) is used in


computer networks and data storage systems to find errors or changes in data
while it is being sent or stored.
 A cyclic redundancy check (CRC) is a data verification method your
computer uses to check the data on your disks (hard disks like your hard drive
and optical disks like CDs and DVDs).
 Consider sending a message to a friend and wanting to make sure it wasn't
altered in any way during delivery. Before sending the message, you may add
a special signature or a secret code to it. Knowing this code, your friend can
verify that it matches when they receive the message. Because only you and
your friend know the code, if it matches, it's probably because the message
hasn't been changed.
How it detects errors?
• Based on the data's contents, a particular CRC value is generated when
the data is transferred or stored.
• The data is delivered or saved with the CRC value. The CRC value is
recalculated when the data is received, and if it matches the CRC value
that was originally transmitted, it is quite likely that the data wasn't
corrupted or changed while being transmitted or stored.
• The term CRC is used to describe this method because Check represents
the “data verification,” Redundancy refers to the “recheck method,” and
Cyclic points to the “algorithmic formula.”

19
Example on CRC
Sender Side (CRC Generator and Division):
i. A fixed divisor is chosen as 1101.
ii. The first step is to add the no. of zeroes to the data to be sent, calculated using
k-1, where k is size of divisor.
iii. Applying the Binary Division and obtaining the remainder from the division.
iv. The last step is to append the remainder(CRC) to the end of the data bits and
share it with the receiver.
• A string of n 0s is added to the data unit. The number n is one smaller than the
number of bits in the fixed divisor (usually 1101).
• The new data unit is divided by a chosen divisor Using XOR based division, the
remainder appearing from the division is CRC.
20
Example on CRC
Receiver Side (Checking for errors in the received data):
To check the error, the received data bits are divided again by chosen
divisor and
If the remainder is 0, the data bit received is correct, without any errors.
If the remainder is not 0, The receiver may then send an
acknowledgement back to the sender for retransmission.

21
Example 1 (No error in transmission):
Data word to be sent = 100100
Key/CRC Selected = 1101
Add k-1 zeros to the original data to be transmitted.
So k=4 , zeros = k-1 = 4-1= 3
Sender Side:
Dividend = 100100000
100100000 ÷ 1101 (Appended Zeros)

22
Sender side will send?

XOR (exclusive OR) is a logical operation that is


used to compare two binary digits or bits. It
While performing
produces an output of "1" if the two bits being
division if you get
compared are different (one is "0" and the
two zero to the left
other is "1"), and it produces an output of "0"
you have to retain
if the two bits are the same (both "0" or both
one zero in the
"1").
dividend for
further division,
similarly if you get
Therefore, the remainder is 001 so we have to append remainder two zero in
with original input data and hence the encoded data to be sent is remainder one has
100100001(sender will sent this value) to be retained as a
part of remainder.

23
Receiver Side will verify as?
Receiver Side: Code word received at the receiver side 100100001

Therefore, the remainder is all zeros. Hence, the


data received has no error.

As 0110 is smaller than 1101 so we


have to multiply 1101 by 0, and will
write below 0111 the value 0000.

24
Example 2: (Error in transmission)
• Data word to be sent = 100100
• Key/CRC = 1101
• Sender Side:

Therefore, the remainder is 001 and hence the


code word sent is 100100001.

25
Receiver Side verify as:
Receiver Side: Let there be an error in transmission media Coded data
received at the receiver side = 100000001

Since the remainder is not all zeroes,


the error is detected at the receiver side.

26
Example:
 At the receiver side, we divide the
received code word with the same
divisor to get the actual code word.
 For an error free reception of data, the
reminder is 0.
 If the reminder is a non – zero, that
means there is an error in the received
code / data sequence.
3) longitudinal redundancy check (LRC)
longitudinal redundancy check (LRC) or horizontal redundancy check is a
type of redundancy check that is applied independently to each parallel
group of bit streams. The data should be split into transmission blocks
and additional check data should be added to it.
LRC is used to detect burst errors.

29
Example on longitudinal redundancy check (LRC)
Example 1: Suppose you want to transmit three 8-bit data bytes: 00110101,
11001010, and 01011100.
Step 1: Data Division:
Data 1: 00110101
Data 2: 11001010
Data 3: 01011100

30
Example on LRC….
Step 2: Bitwise XOR Operation:
For each bit position (bit 0 to bit 7), perform XOR on the corresponding bits of all
data bytes: Step 3: Appending LRC:
Combine the XOR results to form the LRC:
Bit 0: (0 XOR 1 XOR 0) = 1
LRC = 10100011.
Bit 1: (0 XOR 1 XOR 1) = 0 Step 4: Sending Data:
Bit 2: (1 XOR 0 XOR 0) = 1 Send the original data along with the LRC:
00110101 11001010 01011100 10100011.
Bit 3: (1 XOR 0 XOR 1) = 0
Step 5 and 6: Receiving and Error Detection:
Bit 4: (0 XOR 1 XOR 1) = 0
Upon receiving the data, the receiver performs the same
Bit 5: (1 XOR 0 XOR 1) = 0 XOR operation on the first three bytes (data only), excluding
the received LRC. If the calculated LRC matches the
Bit 6: (0 XOR 1 XOR 0) = 1 received LRC (10100011), no errors are detected. If there's a
mismatch, an error is detected.
Bit 7: (1 XOR 0 XOR 0) = 1
31
Example on LRC…..
0 0 1 1 0 1 0 1 (data1)
1 1 0 0 1 0 1 0 (data2)
XOR of data1 & data2 = 1 1 1 1 1 1 1 1
0 1 0 1 1 1 0 0 (data3)
XOR of above three = 1 0 1 0 0 0 1 1
NOTE: As the LRC code at the receiver end exactly match the LRC code
obtained at the sender side so there is no data corruption occurred.

32
Longitudinal Redundancy Check (LRC):
 In longitudinal redundancy method, a
BLOCK of bits are arranged in a table
format (in rows and columns) and we will
calculate the parity bit for each column
separately.
 The set of these parity bits are also sent
along with our original data bits.
 Longitudinal redundancy check is a bit by bit
XOR computation, as we calculate the XOR
of each column individually.
4) Checksum method of error detection
The checksum method is an error detection technique used to verify the
integrity of transmitted data by adding a special value, known as the
checksum, to the data.
This checksum is computed based on the data's content and is sent along
with the data.
Upon receiving the data, the receiver recalculates the checksum and
compares it with the received checksum. If they match, the data is
assumed to be error-free; otherwise, an error is detected. Here's how the
checksum method works:

34
Checksum method working steps
Step 1: At the Sender Side

Divide the original data into the ‘m’ number of blocks of size K.

Adding all the ‘m’ data blocks bit by bit.

The addition result should never exceed size K, if exceeds then you have wrap up
the extra bits on the right to bits on the left of the sum.

The addition result is complemented using 1’s complement.

The obtained data is known as the Checksum.


35
Checksum method working…….
Step 2: Data Transmission

Append the checksum value to the original data bit. Checksum value was
the the 1’s complement of the sum of the original data blocks. The
checksum size and the block size should always match.

Begin the transmission of data to the receiver side.

36
Checksum method working…….
Step 3: At the Receiver Side

Divide the receive data into the ‘m’ number of blocks of size K

Adding all the ‘k’ data blocks along with the checksum value.

The obtained addition result is complemented again using 1’s complement


method.

If the result of 1’s complement is all zeros then data received have not been
tempered otherwise a request for retransmission is sent by the receiver.
37
Checksum method working…….
Two possible cases after 1’s complement:

Case 1: If the result is 0.

No errors in the received data from the sender side.

The receiver accepts the data.

Case 2: If the result is not 0.

Errors in the received data from the sender side.

The receiver discards the data and requests for retransmission of data.
38
Example on checksum error detection method
Example:
 Consider the data unit to be transmitted is:
10011001111000100010010010000100
 Consider 8 bit checksum is used.
Step-01: At sender side,
• The given data unit is divided into segments of 8 bits as:

• Now, all the segments are added and the result is obtained as:
• 10011001 + 11100010 + 00100100 + 10000100 = 10 00100011
• Since the result consists of 10 bits, so extra 2 bits on right side of the sum
are wrapped around.
Cont.…
• 00100011 + 10 = 00100101 (8 bits)
• Now, 1’s complement is taken which is 11011010.
• Thus, checksum value = 11011010
Step-02:
 The data along with the checksum value is transmitted to the receiver.
i.e.
10011001 11100010 00100100 10000100 11011010
Step-03: At receiver side,
• The received data unit is divided into segments of 8 bits.
• All the segments along with the checksum value are added.
Cont.…
 Sum of all segments + Checksum value
 => 00100101 + 11011010 = 11111111.
 Complemented value = 00000000
 Since the result is 0, receiver assumes no error occurred in the data and
therefore accepts it.
Thank You…!

You might also like