CS 325: CS Hardware and Software Organization and Architecture

Slides:



Advertisements
Similar presentations
Noise, Information Theory, and Entropy (cont.) CS414 – Spring 2007 By Karrie Karahalios, Roger Cheng, Brian Bailey.
Advertisements

Hamming Code.
parity bit is 1: data should have an odd number of 1's
Introduction to Information Technologies
PART III DATA LINK LAYER. Position of the Data-Link Layer.
Error detection and correction
William Stallings Data and Computer Communications 7 th Edition (Selected slides used for lectures at Bina Nusantara University) Error Control.
7/2/2015Errors1 Transmission errors are a way of life. In the digital world an error means that a bit value is flipped. An error can be isolated to a single.
Unit 1 Protocols Learning Objectives: Understand the need to detect and correct errors in data transmission.
Error Detection and Correction Rizwan Rehman Centre for Computer Studies Dibrugarh University.
Hamming It Up with Hamming Codes CSE 461 Section Week 3.
Synchronous - Asynchronous Data Transmission. Asynchronous ► The sender and receiver are not Synchronised. ► The sender sends only one character at a.
Error Detection and Correction.  Corrupted files  Attachments that won’t open  Files that won’t download  Videos that won’t play Errors occur when.
+ CS 325: CS Hardware and Software Organization and Architecture Memory Organization.
Error Detection and Correction
CIT 307 Online Data Communications Error Detection Module 11 Kevin Siminski, Instructor.
Data and Computer Communications Chapter 6 – Digital Data Communications Techniques.
Data and Computer Communications by William Stallings Eighth Edition Digital Data Communications Techniques Digital Data Communications Techniques Click.
AS Computing Data Transmission and Networks. Transmission error Detecting errors in data transmission is very important for data integrity. There are.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Data Link Layer PART III.
Overview All data can be corrupted, for reliable communications we must be able to detect and correct errors implemented at the data link and transport.
Computer Communication & Networks Lecture 9 Datalink Layer: Error Detection Waleed Ejaz
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 Block Coding Messages are made up of k bits. Transmitted packets have n bits, n > k: k-data bits and r-redundant bits. n = k + r.
10.1 Chapter 10 Error Detection and Correction Data can be corrupted during transmission. Some applications require that errors be detected and.
Error Detection. Data can be corrupted during transmission. Some applications require that errors be detected and corrected. An error-detecting code can.
Error Detection and Correction – Hamming Code
Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.
Data Communications and Networking
Error-Detecting and Error-Correcting Codes
Hamming Distance & Hamming Code
Data Link Layer 1. 2 Single-bit error 3 Multiple-bit error 4.
Chi-Cheng Lin, Winona State University CS412 Introduction to Computer Networking & Telecommunication Error Correction/Detection.
ERROR DETECTION AND CORRECTION Chapter 8 Data Communications & Networking ERROR DETECTION AND CORRECTION Chapter 8 First Semester 2007/2008.
Data Transmission and Networks Transmission error checking & correcting.
10.1 Types of Errors 10.2 Detection 10.3 Error Correction.
Hamming Codes The Hamming Code is a Forward Error-correcting Code (FEC) that uses redundant bits to correct a single bit error For 4 bit codes, 3 redundant.
8 Coding Theory Discrete Mathematics: A Concept-based Approach.
parity bit is 1: data should have an odd number of 1's
Computer Architecture and Assembly Language
Introduction to Information Technologies
ERROR DETECTION AND CORRECTION
ERROR CORRECTING CODES
Communication Networks: Technology & Protocols
Error Correcting Code.
Advanced Computer Networks
CIS 321 Data Communications & Networking
Representing characters
Even/odd parity (1) Computers can sometimes make errors when they transmit data. Even/odd parity: is basic method for detecting if an odd number of bits.
Part III Datalink Layer 10.
Data Link Layer.
Error Detection Bit Error Rate(BER): It is the ratio of number Ne of errors appearing over a certain time interval t to the number Nt of 1 and 0 pulses.
Detecting and Correcting Bit Errors
Packetizing Error Detection
Chapter 6.
Packetizing Error Detection
Chapter 7 Error Detection and Correction
Introduction to Information Technologies
Information Redundancy Fault Tolerant Computing
RAID Redundant Array of Inexpensive (Independent) Disks
Packetizing Error Detection
Protocols and the TCP/IP Suite
Reliability and Channel Coding
Computer Architecture and Assembly Language
Reliability and Channel Coding
Error Detection and Correction
parity bit is 1: data should have an odd number of 1's
Error Detection and Correction
Error Detection Learning Objectives:
Presentation transcript:

CS 325: CS Hardware and Software Organization and Architecture Error Detection and Correction

Error Detection and Correction Bits are occasionally flipped in transmission. For example: 1101001 is sent, but 0101011 is received. Adding redundancy can allow us to detect, and possibly correct, some errors of this type.

Error Detection and Correction Simple approach: Repeat each bit Repeat each bit twice. For bit a, transmit aa. If the receiver gets two different bits, it requests a retransmission. This is an error detecting code. Allows for one error to be detected, but is not error correcting since retransmission is necessary Repeat each bit three times. For each bit a, transmit aaa. Now the receiver can correct a single error. Why?

Problem with the simple approach The receiver can detect and correct bit errors if each bit is transmitted three times. How does this affect performance? Bus bandwidth efficiency = 33% Better approach Parity check codes Has the ability to detect odd number of bit flips using a single parity bit.

Calculating bit string parity A bit string has odd parity if the number of 1s in the string is odd. 100011, 1, 000010 have odd parity A bit string has even parity if the number if 1s in the string is even. 01100, 000, 11001001 have even parity Assume 0 is an even number

Parity check code Assume we are transmitting blocks of k bits. A block (w) of length (k) is encoded as (wa), where the value of the parity bit (a) is chosen so that (wa) has even parity. Example: If w = 10110, we send wa = 101101, which has even parity With no bit flips in the transmission, the receiver gets the bit string exactly as it was sent by the sender. Bit string has even parity. If there are an odd number of bit flips in the transmission, the receiver gets a bit string with odd parity. Retransmission is requested. If there are an even number of bit flips in the transmission, the receiver gets a bit string with even parity. The error(s) go undetected. Ex: 011101 Another solution?

2D parity check code Blocks of bits are organized in rows and columns m x n matrix The parity bit of each row is calculated, and appended to the row before it is transmitted. The parity of each column is calculated, and appended to the column before it is transmitted. The parity bit of the entire matrix is computed.

2D parity check Example (even parity): Original data: 1100, 1011, 0111, 0101 MN + M + N + 1 bits transferred. 4*4 + 4 + 4 + 1 = 25 bits 16/25  64% bus bandwidth efficiency Row Parity 1 Column Parity Matrix Parity bit

2D parity check code Data bits: mn Parity bits: m + n + 1 Total # of bits sent: mn + m + n + 1 Efficiency becomes greater as block size increases Ex: 2x2 block 2*2 + 2 + 2 + 1 = 9, 4/9 bits are data: 44% efficient Ex: 6x6 block 6*6 + 6 + 6 + 1 = 49, 36/49 bits are data: 73.5% efficient Ex: 10x10 block 10 * 10 + 10 + 10 + 1= 121, 100/121 bits are data: 82.6% efficient Problem with large block size: Higher probability of errors transmitted due to smaller number of parity bits/data bit

2D parity check Another Example (even parity): Original data: 1100, 1011, 0111, 0101 Row Parity 1 Column Parity Matrix Parity bit

2D parity check Another Example (even parity): Original data: 1100, 1011, 0111, 0101 Row Parity 1 Column Parity Matrix Parity bit

2D parity check Another Example (even parity): Received data: 1100, 1011, 0111, 0111 Row Parity 1 Column Parity Matrix Parity bit

2D parity check Another Example (even parity): Received data: 1100, 1011, 0111, 0111 Possible to fix the problem without retransmitting the data Row Parity 1 Column Parity Matrix Parity bit

2D parity check Another Example (even parity): Received data: 1100, 1011, 0111, 0111 Possible to fix the problem without retransmitting the data Row Parity 1 Column Parity Matrix Parity bit

2D parity check 2D parity check can detect and correct all 1 bit errors. Error bit 1

2D parity check 2D parity check can detect all 2 bit errors. Can’t correct all 2 bit errors. Data must be resent. Error bits 1

2D parity check 2D parity check can detect all 3 bit errors. Can’t correct all 3 bit errors. Data must be resent. Error bits 1

2D parity check 2D parity check can detect most 4 bit errors. Can’t correct all 4 bit errors. Data must be resent. Example of a 4 bit error that is NOT detected: Error bits 1

Non-ECC vs. ECC RAM Non-Error-Correcting Code Memory Can’t detect errors Most standard DDR SDRAM is Non-ECC Memory Cheaper, but susceptible to errors Error-Correcting Code (ECC) Memory Used where data corruption can’t be tolerated Most RAM used by servers and high end computers are ECC RAM More expensive than Non-ECC memory

Hamming Code Error detecting/correcting codes invented by Richard Hamming in 1950. Solution for error-prone punched card readers at Bell Labs Still used today Can correct 1 bit errors Can detect up to 2 bit errors

Hamming Code – Parity bits Hamming code works by placing parity bits throughout a bit string of size (w) (p) parity bits creates a bit string of size 2m – 1, of which 2m – m – 1 bits can be used for data. Common Hamming code sizes: Hamming(3,1), 2 parity bits, 33% efficiency Hamming(7,4), 3 parity bits, 57% efficiency Hamming(15,11), 4 parity bits, 73% efficiency Hamming(31,26), 5 parity bits, 84% efficiency Read as Hamming(total bits, data bits)

Hamming Code Example: Using Hamming(7,4), create the Hamming codeword for the following 4 bit string: 0101 Hamming(7,4) 7 total bits 4 data bits 3 parity bits Parity bits are always located in the codeword at positions of 2n. P1 = 20 = 1 P2 = 21 = 2 P3 = 22 = 4

Hamming Code Example: Using Hamming(7,4), create the Hamming codeword for the following 4 bit string: 0101 1 2 3 4 5 6 7 P1 P2 P3

Hamming Code Example: Using Hamming(7,4), create the Hamming codeword for the following 4 bit string: 0101 Now, calculate the parity bits 1 2 3 4 5 6 7 P1 P2 P3

Hamming Code To calculate P1: find parity of substring(1,3,5,7) 1 2 3 4 5 6 7 P1 P2 P3 To calculate P1: find parity of substring(1,3,5,7)

Hamming Code To calculate P1: find parity of substring(1,3,5,7) 2 3 4 5 6 7 P1 P2 P3 To calculate P1: find parity of substring(1,3,5,7) 20 = 1, so check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, … P1 0 1 1 = 0

Hamming Code To calculate P1: find parity of substring(1,3,5,7) 2 3 4 5 6 7 P1 P2 P3 To calculate P1: find parity of substring(1,3,5,7) 20 = 1, so check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, … P1 0 1 1 = 0 To calculate P2: find the parity of substring(2,3,6,7)

Hamming Code To calculate P1: find parity of substring(1,3,5,7) 2 3 4 5 6 7 P1 P2 P3 To calculate P1: find parity of substring(1,3,5,7) 20 = 1, so check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, … P1 0 1 1 = 0 To calculate P2: find the parity of substring(2,3,6,7) 21 = 2, so check 2 bits, skip 2 bits, check 2 bits, skip 2 bits, … P2 0 0 1 = 1

Hamming Code To calculate P1: find parity of substring(1,3,5,7) 2 3 4 5 6 7 P1 P2 P3 To calculate P1: find parity of substring(1,3,5,7) 20 = 1, so check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, … P1 0 1 1 = 0 To calculate P2: find the parity of substring(2,3,6,7) 21 = 2, so check 2 bits, skip 2 bits, check 2 bits, skip 2 bits, … P2 0 0 1 = 1 To calculate P3: find the parity of substring(4,5,6,7)

Hamming Code To calculate P1: find parity of substring(1,3,5,7) 2 3 4 5 6 7 P1 P2 P3 To calculate P1: find parity of substring(1,3,5,7) 20 = 1, so check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, … P1 0 1 1 = 0 To calculate P2: find the parity of substring(2,3,6,7) 21 = 2, so check 2 bits, skip 2 bits, check 2 bits, skip 2 bits, … P2 0 0 1 = 1 To calculate P3: find the parity of substring(4,5,6,7) 22 = 4, so check 4 bits, skip 4 bits, check 4 bits, skip 4 bits, … P3 1 0 1 = 0

Hamming Code To calculate P1: find parity of substring(1,3,5,7) 2 3 4 5 6 7 P1 P2 P3 To calculate P1: find parity of substring(1,3,5,7) 20 = 1, so check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, … P1 0 1 1 = 0 To calculate P2: find the parity of substring(2,3,6,7) 21 = 2, so check 2 bits, skip 2 bits, check 2 bits, skip 2 bits, … P2 0 0 1 = 1 To calculate P3: find the parity of substring(4,5,6,7) 22 = 4, so check 4 bits, skip 4 bits, check 4 bits, skip 4 bits, … P3 1 0 1 = 0 Now we know P1, P2, and P3 and can calculate the codeword: 0 1 0 0 1 0 1

Hamming Code Another Example: Using Hamming(15,11), create the Hamming codeword for the following 11 bit string: 00110110010 Hamming(15,11) 15 total bits 11 data bits 4 parity bits Parity bits are always located in the codeword at positions of 2n. P1 = 20 = 1 P2 = 21 = 2 P3 = 22 = 4 P4 = 23 = 8

Hamming Code Example: Using Hamming(15, 11), create the Hamming codeword for the following 11 bit string: 00110110010 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 P1 P2 P3 P4

Hamming Code Example: Using Hamming(15, 11), create the Hamming codeword for the following 11 bit string: 00110110010 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 P1 P2 P3 P4

Hamming Code Codeword: 010101110110010 To calculate P1: find parity of substring(1,3,5,7,9,11,13,15) P1 0 0 1 0 1 0 0 = 0 To calculate P2: find parity of substring(2,3,6,7,10,11,14,15) P2 0 1 1 1 1 1 0 = 1 To calculate P3: find parity of substring(4,5,6,7,12,13,14,15) P3 0 1 1 0 0 1 0 = 1 To calculate P4: find parity of substring(8,9,10,11,12,13,14,15) P4 0 1 1 0 0 1 0 = 1 Codeword: 010101110110010 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 P1 P2 P3 P4

Hamming Code Try: Using Hamming(7,4), create the Hamming codeword for the following 4 bit string: 1100 P1 1 1 0 = 0 P2 1 0 0 = 1 P3 1 0 0 = 1 1 2 3 4 5 6 7 P1 P2 P3 1 2 3 4 5 6 7

Checking Hamming Code for Correctness Example: Using Hamming(7,4), check the Hamming codeword for correctness. 1 2 3 4 5 6 7

Checking Hamming Code for Correctness Example: Using Hamming(7,4), check the Hamming codeword for correctness. P1 1 1 0 = 0 P2 1 0 0 = 1 P3 1 0 0 = 1 1 2 3 4 5 6 7

Checking Hamming Code for Correctness Example: Using Hamming(15,11), check the Hamming codeword for correctness. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Checking Hamming Code for Correctness Example: Using Hamming(15,11), check the Hamming codeword for correctness. P1 0 0 1 0 1 0 1 = 1 P2 0 1 1 0 1 0 1 = 0 P3 0 1 1 1 0 0 1 = 0 P4 0 0 1 1 0 0 1 = 1 How to find flipped bit? Just add wrong parity bit offsets: 2 + 4 + 8 = 14 Flip bit at position 14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Checking Hamming Code for Correctness Example: Using Hamming(15,11), check the Hamming codeword for correctness. P1 0 0 1 0 1 0 1 = 1 P2 0 1 1 0 1 0 1 = 0 P3 0 1 1 1 0 0 1 = 0 P4 0 0 1 1 0 0 1 = 1 How to find flipped bit? Just add wrong parity bit offsets: 2 + 4 + 8 = 14 Flip bit at position 14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Checking Hamming Code for Correctness Example: Using Hamming(15,11), check the Hamming codeword for correctness. P1 0 0 1 0 1 0 1 = 1 P2 0 1 1 0 1 0 1 = 0 P3 0 1 1 1 0 0 1 = 0 P4 0 0 1 1 0 0 1 = 1 How to find flipped bit? Just add wrong parity bit offsets: 2 + 4 + 8 = 14 Flip bit at position 14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 P1 0 0 1 0 1 0 1 = 1 P2 0 1 1 0 1 1 1 = 1 P3 0 1 1 1 0 1 1 = 1 P4 0 0 1 1 0 1 1 = 0

Checking Hamming Code for Correctness Example: Using Hamming(15,11), check the Hamming codeword for correctness. State whether or not the codeword is correct. If the codeword is not correct, determine the mistake (flipped- bit) and generate the correct codeword Turn in your work for this problem before leaving class Name at the top Graded as a quiz 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15