Hamming Code.

Slides:



Advertisements
Similar presentations
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.
Advertisements

I/O Errors 1 Computer Organization II © McQuain RAID Redundant Array of Inexpensive (Independent) Disks – Use multiple smaller disks (c.f.
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 12 ERROR DETECTION & CORRECTION.
parity bit is 1: data should have an odd number of 1's

Parity Generator and Checker
Parity. 2 Datasheets TTL:  CMOS: 
Error Detection / Correction
PART III DATA LINK LAYER. Position of the Data-Link Layer.
Practical Session 11 Codes. Hamming Distance General case: The distance between two code words is the amount of 1-bit changes required to reach from one.
Unit 1 Protocols Learning Objectives: Understand the need to detect and correct errors in data transmission.
Forward Error CORRECTION A little magic. Hamming in perspective Typically errors are corrected with retransmission. Hamming lets the receiver determine.
Stuart Hansen University of Wisconsin - Parkside.
Error Detection/Correction Section 1.7 Section 3.9 Bonus Material: Hamming Code.
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
E RROR D ETECTION A ND C ORRECTION C ODES Error Detection Code (Parity bit) Error Correction Code ( Hamming Code)
Information Coding in noisy channel error protection:-- improve tolerance of errors error detection: --- indicate occurrence of errors. Source.
PART III DATA LINK LAYER. Position of the Data-Link Layer.
British Computer Society
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.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Copyright © Curt Hill Error detection and correction Techniques to Increase the Reliability.
1. Number Systems Chapt. 2 Location in course textbook.
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.
1 © Unitec New Zealand CRC calculation and Hammings code.
CS 111 – Sept. 13 Error detection Error correction Review/practice chapter 1 questions Commitment: –Please read sections 2.1 and 2.2.
Error-Detecting and Error-Correcting Codes
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
Reasons to  Binary With Mrs
Computer Architecture Error Correcting Codes Ralph Grishman Oct (Text pp and B-65-67) NYU.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 Product Codes An extension of the concept of parity to a large number of words of data 0110… … … … … … …101.
Hamming (4,7) Code Binary Linear Codes Hamming Distance Weight of BLC
Data Link Layer 1. 2 Single-bit error 3 Multiple-bit error 4.
The ASCII Alphanumeric Code What is it? Why use it? How do we use it?
ERROR DETECTION AND CORRECTION Chapter 8 Data Communications & Networking ERROR DETECTION AND CORRECTION Chapter 8 First Semester 2007/2008.
CS Introduction to Operating Systems
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.
parity bit is 1: data should have an odd number of 1's
ERROR DETECTION AND CORRECTION
Character coding schemes
… General Decoder for a Linear Block Code … …
Error detection and correction
ERROR DETECTION AND CORRECTION
Error Correcting Code.
OCR AS Level F451: Data transmission
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.
Chapter 1 Number Systems, Number Representations, and Codes
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.

Welcome to the presentation. Linear Block Codes Almost all block codes used today belong to a subset called linear block codes. The exclusive OR of two.
Binary Code  
Chapter 3 The Data Link Layer.
Chapter 9 Error Detection and Correction
The Data Link Layer Chapter
RAID Redundant Array of Inexpensive (Independent) Disks
Error Correction Codes

DATA COMMUNICATION Lecture-33.
Protocols and the TCP/IP Suite
COMPUTER NETWORKS CS610 Lecture-5 Hammad Khalid Khan.
LAB 7.
Chapter 9 Error Detection and Correction
CS 325: CS Hardware and Software Organization and Architecture
parity bit is 1: data should have an odd number of 1's
Error Detection and Correction
Presentation transcript:

Hamming Code

Error Detecting and Correcting Code Parity code Detect odd number of errors Cannot correct any errors Hamming Code Detect up to two simultaneous bit errors Correct single-bit errors

Hamming Code For each integer m > 2 Basically Code exists with m parity bits and 2m – m – 1 Basically Parity bit for odd bits Parity bit for each two bits Parity bit for each four bits Parity bit for each eight bits Parity bit for each group of bits that are power of 2 1, 2, 4, 8, 16, 32, …

Calculating Hamming Code Mark all bit positions that are powers of two parity bit 1, 2, 4, 8, 16, 32, 64, etc All other bit positions are for the data to be encoded 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, etc. Each parity bit calculates the parity for some of the bits in the code word The position of the parity bit determines the sequence of bits that it alternately checks and skips Position 1: check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, etc. (1,3,5,7,9,11,13,15,...) Position 2: check 2 bits, skip 2 bits, check 2 bits, skip 2 bits, etc. (2,3,6,7,10,11,14,15,...) Position 4: check 4 bits, skip 4 bits, check 4 bits, skip 4 bits, etc. (4,5,6,7,12,13,14,15,20,21,22,23,...) Position 8: check 8 bits, skip 8 bits, check 8 bits, skip 8 bits, etc. (8-15,24-31,40-47,...) Set a parity bit to 1 if the total number of ones in the positions it checks is odd. Set a parity bit to 0 if the total number of ones in the positions it checks is even

Hamming Code Layout 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Pos 20=1 21=2 22=4 23=8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Even parity calculated for each bit position P1 (1, 3, 5, 7, 9, 11, 13, 15) P2 (2, 3, 6, 7, 10, 11, 14, 15) P4 (4, 5, 6, 7, 12, 13, 14, 15) P8(8, 9, 10, 11, 12, 13, 14, 15)

Hamming Code Layout 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 P1 P2 P4 P8 P1 P2 P4 P8 P1 = 1 P2 = 1 P4 = 0 P8 = 1 For code: 10101101011 Even parity calculated for each bit position P1 (1, 3, 5, 7, 9, 11, 13, 15) P2 (2, 3, 6, 7, 10, 11, 14, 15) P4 (4, 5, 6, 7, 12, 13, 14, 15) P8(8, 9, 10, 11, 12, 13, 14, 15)

Hamming Code (1 error) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 P1 P2 P4 P8 P1 P2 P4 P8 Xmit Rec A S P1 = 1 1 P2 = 1 0 P4 = 0 1 P8 = 1 0 A = Actual Parity S = Should be Parity Even parity calculated for each bit position P1 (1, 3, 5, 7, 9, 11, 13, 15) P2 (2, 3, 6, 7, 10, 11, 14, 15) P4 (4, 5, 6, 7, 12, 13, 14, 15) P8(8, 9, 10, 11, 12, 13, 14, 15) 2, 4, and 8 incorrect 2 + 4 + 8 = 14

Hamming Code (2 errors) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 P1 P2 P4 P1 P2 P4 P8 Xmit Rec A S P1 = 1 0 P2 = 1 0 P4 = 0 1 P8 = 1 1 A = Actual Parity S = Should be Parity Even parity calculated for each bit position P1 (1, 3, 5, 7, 9, 11, 13, 15) P2 (2, 3, 6, 7, 10, 11, 14, 15) P4 (4, 5, 6, 7, 12, 13, 14, 15) P8(8, 9, 10, 11, 12, 13, 14, 15) 1,2, and 4 incorrect 1 + 2 + 4 = 7 Fix 7, will still have parity problem

Example A byte of data: 10011010 Create the data word, leaving spaces for the parity bits: _ _ 1 _ 0 0 1 _ 1 0 1 0 Calculate the parity for each parity bit (a ? represents the bit position being set): Position 1 checks bits 1,3,5,7,9,11: ? _ 1 _ 0 0 1 _ 1 0 1 0. Even parity so set position 1 to a 0: 0 _ 1 _ 0 0 1 _ 1 0 1 0 Position 2 checks bits 2,3,6,7,10,11: 0 ? 1 _ 0 0 1 _ 1 0 1 0. Odd parity so set position 2 to a 1: 0 1 1 _ 0 0 1 _ 1 0 1 0 Position 4 checks bits 4,5,6,7,12: 0 1 1 ? 0 0 1 _ 1 0 1 0. Odd parity so set position 4 to a 1: 0 1 1 1 0 0 1 _ 1 0 1 0 Position 8 checks bits 8,9,10,11,12: 0 1 1 1 0 0 1 ? 1 0 1 0. Even parity so set position 8 to a 0: 0 1 1 1 0 0 1 0 1 0 1 0 Code word: 011100101010

Finding and Fixing a Bad Bit 123456789012 Transmitted word: 011100101010 Received word: 011100101110 Calculate the parity bits from received word SB A P1 (1, 3, 5, 7, 9, 11) = 0 0 1 P2 (2, 3, 6, 7, 10, 11) = 0 1 2 P4 (4, 5, 6, 7, 12) = 1 1 4 P8 (8, 9, 10, 11, 12) = 1 0 8 2 + 8 = 10 Bit position 10 is incorrect

Finding and Fixing a Bad Bit 123456789012 Transmitted word: Received word: 010101100011 Calculate the parity bits from received word SB A P1 (1, 3, 5, 7, 9, 11) = 0 0 P2 (2, 3, 6, 7, 10, 11) = 0 1 P4 (4, 5, 6, 7, 12) = 0 1 P8 (8, 9, 10, 11, 12) = 0 0 Bit positions 2 & 4 are incorrect 2 + 4 = 6 Correct code is 010100100011

Finding and Fixing a Bad Bit 123456789012 Transmitted word: Received word: 111110001100 Calculate the parity bits from received word SB A P1 (1, 3, 5, 7, 9, 11) = 0 1 P2 (2, 3, 6, 7, 10, 11) = 1 1 P4 (4, 5, 6, 7, 12) = 0 1 P8 (8, 9, 10, 11, 12) = 0 0 Bit positions 1 & 4 are incorrect 1 + 4 = 5 Correct code is 111100001100

Finding and Fixing a Bad Bit 123456789012 Transmitted word: Received word: 000010001010 Calculate the parity bits from received word SB A P1 (1, 3, 5, 7, 9, 11) = 1 0 P2 (2, 3, 6, 7, 10, 11) = 1 0 P4 (4, 5, 6, 7, 12) = 1 0 P8 (8, 9, 10, 11, 12) = 0 0 Bit positions 1, 2 & 4 are incorrect 1 + 2 + 4 = 7 Correct code is: 000010101010