Error Detection. Hamming Codes 1

Similar documents
falling edge Intro Computer Organization

UNIT 7A Data Representation: Numbers and Text. Digital Data

CMSC 2833 Lecture 18. Parity Add a bit to make the number of ones (1s) transmitted odd.

Chapter 10 Error Detection and Correction 10.1

The Data Link Layer. CS158a Chris Pollett Feb 26, 2007.

12/2/2016. Error Detection May Not Be Enough. ECE 120: Introduction to Computing. Can We Use Redundancy to Correct Errors?

CS/MA 109 Fall Wayne Snyder Computer Science Department Boston University

CSE 123: Computer Networks

Describe the two most important ways in which subspaces of F D arise. (These ways were given as the motivation for looking at subspaces.

Chapter 10 Error Detection and Correction. Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Error-Correcting Codes

From last time to this time

Hamming Codes. s 0 s 1 s 2 Error bit No error has occurred c c d3 [E1] c0. Topics in Computer Mathematics

Chapter Six. Errors, Error Detection, and Error Control. Data Communications and Computer Networks: A Business User s Approach Seventh Edition

For this assignment, you will implement a collection of C functions to support a classic data encoding scheme.

ENEE x Digital Logic Design. Lecture 3

Error Detection And Correction

Errors. Chapter Extension of System Model

ECE 333: Introduction to Communication Networks Fall Lecture 6: Data Link Layer II

PART III. Data Link Layer MGH T MGH C I 204

Error Correction continued and start on FPGA architecture

FAULT TOLERANT SYSTEMS

ECE 331 Hardware Organization and Design. UMass ECE Discussion 11 4/12/2018

ECE331: Hardware Organization and Design

Inst: Chris Davison

15110 Principles of Computing, Carnegie Mellon University - CORTINA. Digital Data

Dependability and ECC

Chapter 3. The Data Link Layer. Wesam A. Hatamleh

Implementation of Hamming code using VLSI

Wednesday, April 25, Discs RAID: Introduction Error detection and correction Error detection: Simple parity Error correction: Hamming Codes

CS Computer Architecture

Topic Notes: Building Memory

Some announcements. Announcements for game due (via ) on Wednesday, March 15 Homework 6 due on March 15 Exam 3 on March 17

2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLS Collision Free Protocols 2.3 FDDI 2.4 DATA LINK LAYER DESIGN ISSUES 2.5 FRAMING & STUFFING

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Building Memory

CS254 Network Technologies. Lecture 2: Network Models & Error Detection and Correction. Dr Nikos Antonopoulos

MITOCW watch?v=sdw8_0rdzuw

Detecting and correcting mistakes

ELG3175 Introduction to Communication Systems. Introduction to Error Control Coding

Guerrilla 7: Virtual Memory, ECC, IO

Black Problem 2: Huffman Compression [75 points] Next, the Millisoft back story! Starter files

Digital Fundamentals

Problem Set Name the 7 OSI layers and give the corresponding functionalities for each layer.

The Data Link Layer Chapter 3

DATA LINK LAYER UNIT 7.

P( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16

CS103 Spring 2018 Mathematical Vocabulary

MEMORY AND PROGRAMMABLE LOGIC

P( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16

ELEC 691X/498X Broadcast Signal Transmission Winter 2018

Digital Fundamentals

1 Counting triangles and cliques

TECH TIP. Tritex Modbus Protocol Specification

Advanced Computer Networks. Rab Nawaz Jadoon DCS. Assistant Professor COMSATS University, Lahore Pakistan. Department of Computer Science

CSE 380 Computer Operating Systems

CSE 123: Computer Networks Alex C. Snoeren. HW 1 due Thursday!

Error Correcting Codes

Chapter 5 B. Large and Fast: Exploiting Memory Hierarchy

15110 PRINCIPLES OF COMPUTING SAMPLE EXAM 2

Monday, May 4, Discs RAID: Introduction Error detection and correction Error detection: Simple parity Error correction: Hamming Codes

Exploiting Unused Spare Columns to Improve Memory ECC

Chapter 8. I/O operations initiated by program instructions. Requests to processor for service from an I/O device

Read this before starting!

Outline. EEC-484/584 Computer Networks. Data Link Layer Design Issues. Framing. Lecture 6. Wenbing Zhao Review.

EC500. Design of Secure and Reliable Hardware. Lecture 1 & 2

Link Layer: Error detection and correction

Data Link Layer. Srinidhi Varadarajan

Reflected Number Systems

Dependability tree 1

CS 43: Computer Networks The Link Layer. Kevin Webb Swarthmore College November 28, 2017

AN EFFICIENT DESIGN OF VLSI ARCHITECTURE FOR FAULT DETECTION USING ORTHOGONAL LATIN SQUARES (OLS) CODES

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

ECE251: Thursday November 8

Error Checking Codes

UNIT-II 1. Discuss the issues in the data link layer. Answer:

COMPUTER NETWORKS UNIT I. 1. What are the three criteria necessary for an effective and efficient networks?

CSE123A discussion session

Chapter 8. Input and Output

CHAPTER NINE. 9.1 Bitwise Operations. Binary Operation Applications

Hierarchical Parallel Evaluation of a Hamming Code

Administrivia. CMSC 411 Computer Systems Architecture Lecture 19 Storage Systems, cont. Disks (cont.) Disks - review

RAID. Redundant Array of Inexpensive Disks. Industry tends to use Independent Disks

CS 373: Combinatorial Algorithms, Spring 1999

Ch. 7 Error Detection and Correction

Computer Systems C S Cynthia Lee Today s materials adapted from Kevin Webb at Swarthmore College

CHW 261: Logic Design

Implementing Relational Operators: Selection, Projection, Join. Database Management Systems, R. Ramakrishnan and J. Gehrke 1

EDAC FOR MEMORY PROTECTION IN ARM PROCESSOR

Where we are in the Course

DirectNET Host. Communications Programs. In This Chapter...

Redundancy in fault tolerant computing. D. P. Siewiorek R.S. Swarz, Reliable Computer Systems, Prentice Hall, 1992

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5

Data Link Layer (1) Networked Systems 3 Lecture 6

Error Detecting and Correcting Code Using Orthogonal Latin Square Using Verilog HDL

Chapter 6 Digital Data Communications Techniques

271/471 Verilog Tutorial

Design and Implementation of Hamming Code using VHDL & DSCH

Homework, etc. Computer Science Foundations

I/O, Disks, and RAID Yi Shi Fall Xi an Jiaotong University

MITOCW watch?v=yarwp7tntl4

Transcription:

Error Detection Hamming Codes 1 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 1101 0001 0000 1101 0000 1111 0010 1 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.

Parity Bits Hamming Codes 2 Two common schemes (for single parity bits): - even parity 0 parity bit if data contains an even number of 1's - odd parity 0 parity bit if data contains an odd number of 1's We will apply an even-parity scheme. 1011 1101 0001 0000 1101 0000 1111 0010 1 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 (7,4) Code Hamming Codes 3 Richard Hamming (1950) described a method for generating minimum-length errordetecting codes. Here is the (7,4) Hamming code for 4-bit words: Say we receive the data word 0100 and parity bits 011. Those do not match (see the table). Data bits d 4 d 3 d 2 d 1 Parity bits P 3 p 2 p 1 0000 000 0001 011 0010 101 0011 110 Therefore, we know an error has occurred. But where? 0100 110 0101 101 0110 011 0111 000 1000 111 1001 100 1010 010 1011 001 1100 001 1101 010 1110 100 1111 111

Hamming (7,4) Code Hamming Codes 4 Suppose the parity bits are correct (011) and the data bits (0100) contain an error: 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. Data bits d 4 d 3 d 2 d 1 Parity bits p 3 p 2 p 1 0000 000 0001 011 0010 101 0011 110 0100 110 0101 101 0110 011 0111 000 1000 111 1001 100 1010 010 1011 001 1100 001 1101 010 1110 100 1111 111

Hamming (7,4) Code Hamming Codes 5 Suppose the data bits (0100) are correct and the parity bits (011) contain an error: The received data bits 0100 would match parity bits 110. That would mean two parity bits flipped. Data bits d 4 d 3 d 2 d 1 Parity bits p 3 p 2 p 1 0000 000 0001 011 0010 101 0011 110 0100 110 0101 101 If we assume that only one bit flipped, we can conclude the correction is that the data bits should have been 0110. 0110 011 0111 000 1000 111 1001 100 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. 1010 010 1011 001 1100 001 1101 010 1110 100 1111 111

Hamming (7,4) Code Details Hamming Codes 6 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 Hamming encoding: Parity bits: 010 p 3 p 2 p 1 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 Code Details Hamming Codes 7 But, how are the parity bits defined? - p 1 : all higher bit positions k where the 2 0 bit is set (1's bit) - p 2 : all higher bit positions k where the 2 1 bit is set (2's bit) - p n : all higher bit positions k where the 2 n bit is set Hamming encoding: b 111 b 110 b 101 b 100 b 011 b 010 b 001 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 (7,4) Code Details Hamming Codes 8 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 3 == 0 2 ones: p 2 == 0 So the Hamming encoding would be : 1010101

Error Correction Hamming Codes 9 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 (11,7) Code Hamming Codes 10 Suppose have a 7-bit data word and use 4 Hamming parity bits: 0001 P1 : depends on D1, D2, D4, D5, D7 0010 P2 : depends on D1, D3, D4, D6, D7 0011 D1 0100 P3 : depends on D2, D3, D4 0101 D2 0110 D3 0111 D4 1000 P4 : depends on D5, D6, D7 1001 D5 1010 D6 1011 D7 Note that each data bit, Dk, is involved in the definition of at least two parity bits. And, note that no parity bit checks any other parity bit.

Hamming (11,7) Code Hamming Codes 11 Suppose have a 7-bit data word and use 4 Hamming parity bits: 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 Note that each data bit, Dk, is involved in the definition of at least two parity bits. And, note that no parity bit checks any other parity bit.

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 Hamming Codes 12 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 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. And, notice that: 0001 0010 0100 == 0111 binary indices of the incorrect parity bits binary index of the bit to be corrected QTP: what if the flipped data bit were D3?

Hamming (11,7) Code What if a single parity bit, say P3, flips?. Then the other parity bits will all still match the data: P1 P2 P4 Hamming Codes 13 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 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.

Why (11,7) is a Poor Fit Hamming Codes 14 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 (12,8) SEC Code Hamming Codes 15 Suppose have an 8-bit data word and use 4 Hamming parity bits: 0001 P1 : depends on D1, D2, D4, D5, D7 0010 P2 : depends on D1, D3, D4, D6, D7 0011 D1 0100 P3 : depends on D2, D3, D4, D8 0101 D2 0110 D3 0111 D4 1000 P4 : depends on D5, D6, D7, D8 1001 D5 1010 D6 1011 D7 1100 D8

Hamming (12,8) SEC Code Correction Hamming Codes 16 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 WRONG WRONG OK OK 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).

SEC-DEC Hamming (12,8) Hamming Codes 17 What if we add a "master" parity bit instead of a data bit: 0000 P0 : depends on ALL other bits 0001 P1 : depends on D1, D2, D4, D5, D7 0010 P2 : depends on D1, D3, D4, D6, D7 0011 D1 0100 P3 : depends on D2, D3, D4 0101 D2 0110 D3 0111 D4 1000 P4 : depends on D5, D6, D7 1001 D5 1010 D6 1011 D7 Now, the "master" parity bit makes it possible to detect the difference between 1-bit and 2- bit errors...... why?