We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byHope Saylor
Modified about 1 year ago
Hamming Codes 1 Computer Organization II CS@VT ©2005-2013 McQuain Error Detection Error detecting codes enable the detection of errors in data, but do not determine the precise location of the error. -store a few extra state bits per data word to indicate a necessary condition for the data to be correct -if data state does not conform to the state bits, then something is wrong -e.g., represent the correct parity (# of 1’s) of the data word -1-bit parity codes fail if 2 bits are wrong… 1011 11010001 00001101 00001111 00101 parity bit is 1: data should have an odd number of 1's A 1-bit parity code is a distance-2 code, in the sense that at least 2 bits must be changed (among the data and parity bits) produce an incorrect but legal pattern. In other words, any two legal patterns are separated by a distance of at least 2.
Hamming Codes 2 Computer Organization II CS@VT ©2005-2013 McQuain Parity Bits 1011 11010001 00001101 00001111 00101 Two common schemes (for single parity bits): -even parity0 parity bit if data contains an even number of 1's -odd parity0 parity bit if data contains an odd number of 1's We will apply an even-parity scheme. The parity bit could be stored at any fixed location with respect to the corresponding data bits. Upon receipt of data and parity bit(s), a check is made to see whether or not they correspond. Cannot detect errors involving two bit-flips (or any even number of bit-flips).
Hamming Codes 3 Computer Organization II CS@VT ©2005-2013 McQuain Hamming (7,4) Code Data bits d 4 d 3 d 2 d 1 Parity bits P 3 p 2 p 1 0000000 0001011 0010101 0011110 0100110 0101101 0110011 0111000 1000111 1001100 1010010 1011001 1100001 1101010 1110100 1111111 Say we receive the data word 0100 and parity bits 011. Those do not match (see the table). Therefore, we know an error has occurred. But where? Richard Hamming (1950) described a method for generating minimum-length error- detecting codes. Here is the (7,4) Hamming code for 4-bit words:
Hamming Codes 4 Computer Organization II CS@VT ©2005-2013 McQuain Hamming (7,4) Code Data bits d 4 d 3 d 2 d 1 Parity bits p 3 p 2 p 1 0000000 0001011 0010101 0011110 0100110 0101101 0110011 0111000 1000111 1001100 1010010 1011001 1100001 1101010 1110100 1111111 The received parity bits 011 suggest the data bits should have been 0001 or 0110. The first case would mean two data bits flipped. The second would mean that one data bit flipped. Suppose the parity bits are correct ( 011 ) and the data bits ( 0100 ) contain an error:
Hamming Codes 5 Computer Organization II CS@VT ©2005-2013 McQuain Hamming (7,4) Code Data bits d 4 d 3 d 2 d 1 Parity bits p 3 p 2 p 1 0000000 0001011 0010101 0011110 0100110 0101101 0110011 0111000 1000111 1001100 1010010 1011001 1100001 1101010 1110100 1111111 The received data bits 0100 would match parity bits 110. That would mean two parity bits flipped. Suppose the data bits ( 0100 ) are correct and the parity bits ( 011 ) contain an error: If we assume that only one bit flipped, we can conclude the correction is that the data bits should have been 0110. If we assume that two bits flipped, we have two equally likely candidates for a correction, and no way to determine which would have been the correct choice.
Hamming Codes 6 Computer Organization II CS@VT ©2005-2013 McQuain Hamming (7,4) Code Details Hamming codes use extra parity bits, each reflecting the correct parity for a different subset of the bits of the code word. Parity bits are stored in positions corresponding to powers of 2 (positions 1, 2, 4, 8, etc.). The encoded data bits are stored in the remaining positions. Data bits: 1011 d 4 d 3 d 2 d 1 Parity bits: 010 p 3 p 2 p 1 Hamming encoding: b 7 b 6 b 5 b 4 b 3 b 2 b 1 101?1?? d 4 d 3 d 2 p 3 d 1 p 2 p 1
Hamming Codes 7 Computer Organization II CS@VT ©2005-2013 McQuain Hamming Code Details - p 1 : all higher bit positions k where the 2 0 bit is set (1) - p 2 : all higher bit positions k where the 2 1 bit is set … - p n : all higher bit positions k where the 2 n bit is set But, how are the parity bits defined? Hamming encoding: b 111 b 110 b 101 b 100 b 11 b 10 b 1 101?1?? d 4 d 3 d 2 p 3 d 1 p 2 p 1 This means that each data bit is used to define at least two different parity bits; that redundancy turns out to be valuable.
Hamming Codes 8 Computer Organization II CS@VT ©2005-2013 McQuain Hamming (7,4) Code Details So, for our example: Hamming encoding: b 111 b 110 b 101 b 100 b 11 b 10 b 1 101?1?? 1 0 1 p 3 1 p 2 p 1 3 ones: p 1 == 1 2 ones: p 2 == 0 2 ones: p 3 == 0 So the Hamming encoding would be : 1010101
Hamming Codes 9 Computer Organization II CS@VT ©2005-2013 McQuain Error Correction A distance-3 code, like the Hamming (7,4) allows us two choices. We can use it to reliably determine an error has occurred if no more than 2 received bits have flipped, but not be able to distinguish a 1-bit flip from a 2-bit flip. We can use to determine a correction, under the assumption that no more than one received bit is incorrect. We would like to be able to do better than this. That requires using more parity bits. The Hamming (8,4) allows us to distinguish 1-bit errors from 2-bit errors. Therefore, it allows to reliably correct errors that involve single bit flips. The Hamming Code pattern defined earlier can be extended to data of any width, and with some modifications, to support correction of single bit errors.
Hamming Codes 10 Computer Organization II CS@VT ©2005-2013 McQuain Hamming (11,7) Code Suppose have a 7-bit data word and use 4 Hamming parity bits: 0001P1 : depends on D1, D2, D4, D5 0010P2 : depends on D1, D3, D4, D6 0011D1 0100P3 : depends on D2, D3, D4, D7 0101D2 0110D3 0111D4 1000P4 : depends on D5, D6, D7 1001D5 1010D6 1100D7 Note that each data bit, Dk, is involved in the definition of at least to parity bits. And, note that no parity bit checks any other parity bit.
Hamming Codes 11 Computer Organization II CS@VT ©2005-2013 McQuain Hamming (11,7) Code Suppose have a 7-bit data word and use 4 Hamming parity bits: P1 : depends on D1, D2, D4, D5 P2 : depends on D1, D3, D4, D6 P3 : depends on D2, D3, D4, D7 P4 : depends on D5, D6, D7 Note that each data bit, Dk, is involved in the definition of at least to parity bits. And, note that no parity bit checks any other parity bit.
Hamming Codes 12 Computer Organization II CS@VT ©2005-2013 McQuain Hamming (11,7) Code Suppose that a 7-bit value is received and that one data bit, say D4, has flipped and all others are correct. Then D4 being wrong will cause three parity bits to not match the data: P1 P2 P3 So, we know there’s an error… And, assuming only one bit is involved, we know it must be D4 because that’s the only bit involved in all three of the nonmatching parity bits. QTP: what if the flipped data bit were D3 ? And, notice that: 0001 | 0010 | 0100 == 0111 binary indices of the incorrect parity bits binary index of the bit to be corrected P1 : depends on D1, D2, D4, D5 P2 : depends on D1, D3, D4, D6 P3 : depends on D2, D3, D4, D7 P4 : depends on D5, D6, D7
Hamming Codes 13 Computer Organization II CS@VT ©2005-2013 McQuain Hamming (11,7) Code P1 : depends on D1, D2, D4, D5, D7 P2 : depends on D1, D3, D4, D6, D7 P3 : depends on D2, D3, D4 P4 : depends on D5, D6, D7 What if a single parity bit, say P3, flips?. Then the other parity bits will all still match the data: P1 P2 P4 So, we know there’s an error… And, assuming only one bit is involved, we know it must be P3 because if any single data bit had flipped, at least two parity bits would have been affected.
Hamming Codes 14 Computer Organization II CS@VT ©2005-2013 McQuain Why (11,7) is a Poor Fit Standard data representations do not map nicely into 11-bit chunks. More precisely, a 7-bit data chunk is inconvenient. If we accommodate data chunks that are some number of bytes, and manage the parity bits so that they fit nicely into byte-sized chunks, we can handle the data + parity more efficiently. For example: (12,8) 8-bit data chunks and 4-bits of parity, so… 1 byte of parity per 2 bytes of data (72,64)9-byte data chunks per 1 byte of parity bits
Hamming Codes 15 Computer Organization II CS@VT ©2005-2013 McQuain Hamming (12,8) Code Suppose have an 8-bit data word and use 4 Hamming parity bits: 0001P1 : depends on D1, D2, D4, D5, D7 0010P2 : depends on D1, D3, D4, D6, D7 0011D1 0100P3 : depends on D2, D3, D4, D7, D8 0101D2 0110D3 0111D4 1000P4 : depends on D5, D6, D7, D8 1001D5 1010D6 1011D7 1100D8
Hamming Codes 16 Computer Organization II CS@VT ©2005-2013 McQuain Hamming (12,8) Code Correction Suppose we receive the bits: 0 1 1 1 0 1 0 0 1 1 1 0 How can we determine whether it's correct? Check the parity bits and see which, if any are incorrect. If they are all correct, we must assume the string is correct. Of course, it might contain so many errors that we can't even detect their occurrence, but in that case we have a communication channel that's so noisy that we cannot use it reliably. 0 1 1 1 0 1 0 0 1 1 1 0 OK WRONG So, what does that tell us, aside from that something is incorrect? Well, if we assume there's no more than one incorrect bit, we can say that because the incorrect parity bits are in positions 4 (0100) and 8 (1000), the incorrect bit must be in position 12 (1100). OK WRONG
I/O Errors 1 Computer Organization II © McQuain RAID Redundant Array of Inexpensive (Independent) Disks – Use multiple smaller disks (c.f.
Memory Intro Computer Organization 1 Computer Science Dept Va Tech March 2006 ©2006 McQuain & Ribbens Built using D flip-flops: 4-Bit Register Clock input.
VLSI AND INTELLIGENT SYTEMS LABORATORY 12 Bit Hamming Code Error Detector/Corrector December 2nd, 2003 Department of Electrical and Computer Engineering.
Error Detecting and Error Correcting Codes By R. W. Hamming.
Practical Session 10 Computer Architecture and Assembly Language.
Error Detection and Correction Rizwan Rehman Centre for Computer Studies Dibrugarh University.
Error Detection and Correction Parity and Hamming Code.
ERROR DETECTING AND CORRECTING CODES -BY R.W. HAMMING PRESENTED BY- BALAKRISHNA DHARMANA.
Stuart Hansen University of Wisconsin - Parkside.
Information Coding in noisy channel error protection:-- improve tolerance of errors error detection: --- indicate occurrence of errors. Source.
Quantum Error Correction SOURCES: Michele Mosca Daniel Gottesman Richard Spillman Andrew Landahl.
Hamming Code. Error Detecting and Correcting Code Parity code ◦ Detect odd number of errors ◦ Cannot correct any errors Hamming Code ◦ Detect up to two.
ERROR CORRECTION. Error Correction Two ways of handling error correction –The receiver can have the sender retransmit the entire data unit –The receiver.
Practical Session 10 Error Detecting and Correcting Codes.
MAT 1000 Mathematics in Today's World Winter 2015.
Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.
Error detection and correction How can the receiver determine if there was an error in the message the sender sent? How can these errors be fixed?
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.
Error Correction Lecture 6 Hamming Distance & Hamming Code.
Lecture Focus: Data Communications and Networking Data Link Layer Error Control Error Correction Lecture 20 CSCS 311.
Introduction to Coding Theory. p2. Outline  Introduction  Basic assumptions  Correcting and detecting error patterns  Information rate 
Spring 2015 Mathematics in Management Science Parity-Check Sums Hamming (4,7) Code Binary Linear Codes Hamming Distance Weight of BLC.
Chapter 10 Error Detection and Correction Data can be corrupted during transmission. Some applications require that errors be detected and corrected. Data.
T305: DIGITAL COMMUNICATIONS 1 Arab Open University-Lebanon Tutorial Topic 3: Information Theory.
CHAPTER 3: DATA LINK CONTROL Flow control, Error detection – two dimensional parity checks, Internet checksum, CRC, Error control, Transmission efficiency.
ENEE244-02xx Digital Logic Design Lecture 3. Announcements Homework 1 due next class (Thursday, September 11) First recitation quiz will be next Monday,
Unit 1 Protocols Learning Objectives: Understand the need to detect and correct errors in data transmission.
Noise, Information Theory, and Entropy (cont.) CS414 – Spring 2007 By Karrie Karahalios, Roger Cheng, Brian Bailey.
NETWORKING CONCEPTS. ERROR DETECTION Error occures when a bit is altered between transmission& reception ie. Binary 1 is transmitted but received is binary.
Hamming Code A Hamming code is a linear error-correcting code named after its inventor, Richard Hamming. Hamming codes can detect up to two bit errors,
Cyclic Code. Linear Block Code Hamming Code is a Linear Block Code. Linear Block Code means that the codeword is generated by multiplying the message.
GCP, DoI, AUEBComputer System Organization11.1 Error-Detecting and Error-Correcting Codes l Motivation u Computers make errors occasionally (data gets.
Error Control Code. Widely used in many areas, like communications, DVD, data storage… In communications, because of noise, you can never be sure that.
Error Detection / Correction Reference: Computer Organization & Architecture 7 th Edition William Stallings Prentice Hall 2006.
15-853Page :Algorithms in the Real World Error Correcting Codes I – Overview – Hamming Codes – Linear Codes.
1 © Unitec New Zealand CRC calculation and Hammings code.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
10.1 Chapter 10 Error Detection and Correction INTRODUCTION some issues related, directly or indirectly, to error detection and correction.
14/04/2015Applied Algorithmics - week71 Huffman Coding David A. Huffman (1951) Huffman coding uses frequencies of symbols in a string to build a variable.
Computer Architecture Error Correcting Codes Ralph Grishman Oct (Text pp and B-65-67) NYU.
Shashank Srivastava Motilal Nehru National Institute Of Technology, Allahabad Error Detection and Correction : Data Link Layer.
Lecture 10: Error Control Coding I Chapter 8 – Coding and Error Control From: Wireless Communications and Networks by William Stallings, Prentice Hall,
CS 111 – Sept. 13 Error detection Error correction Review/practice chapter 1 questions Commitment: –Please read sections 2.1 and 2.2.
1 Product Codes An extension of the concept of parity to a large number of words of data 0110… … … … … … …101.
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 12 ERROR DETECTION & CORRECTION.
Basic Concepts of Encoding Codes and Error Correction 1.
Exercise in the previous class (1) Consider an “odd” parity check code C whose codewords are (x 1, …, x k, p) with p = x 1 +…+x k +1. Is C a linear code?
© 2017 SlidePlayer.com Inc. All rights reserved.