Positional Number System

Similar documents
Fundamentals of Programming (C)

DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

Data Representation and Binary Arithmetic. Lecture 2

Number Systems Base r

Digital Fundamentals

Chapter 2 Bits, Data Types, and Operations

Chapter 2 Number System

Chapter 2 Bits, Data Types, and Operations

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

CPS 104 Computer Organization and Programming Lecture-2 : Data representations,

Fundamentals of Programming

CHW 261: Logic Design

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes

Bits and Bytes. Data Representation. A binary digit or bit has a value of either 0 or 1; these are the values we can store in hardware devices.

Number System. Introduction. Decimal Numbers

BINARY SYSTEM. Binary system is used in digital systems because it is:

Chapter 2 Bits, Data Types, and Operations

Number System (Different Ways To Say How Many) Fall 2016

UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES

Chapter 2 Bits, Data Types, and Operations

Unit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

Chapter 2 Bits, Data Types, and Operations

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012

EE 109 Unit 2. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

CHAPTER 2 Data Representation in Computer Systems

3.1. Unit 3. Binary Representation

CHAPTER 2 Data Representation in Computer Systems

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

EE 109 Unit 3. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras

Lecture 2: Number Systems

Number Representations

DIGITAL SYSTEM DESIGN

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, SPRING 2013

Logic and Computer Design Fundamentals. Chapter 1 Digital Computers and Information

Number Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers

MYcsvtu Notes DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012

EE 109 Unit 2. Binary Representation Systems

DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM

Chapter 3. Information Representation

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

Chap 1. Digital Computers and Information

Numbering systems. Dr Abu Arqoub

Digital Fundamentals

Korea University of Technology and Education

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

Review of Number Systems

Under the Hood: Data Representation. Computer Science 104 Lecture 2

CS 121 Digital Logic Design. Chapter 1. Teacher Assistant. Hadeel Al-Ateeq

Logic Circuits I ECE 1411 Thursday 4:45pm-7:20pm. Nathan Pihlstrom.

Imperial College London Department of Computing

Binary Systems and Codes

Digital Systems and Binary Numbers

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Source coding and compression

Computer Organization

Binary Numbers. The Basics. Base 10 Number. What is a Number? = Binary Number Example. Binary Number Example

Lecture (09) x86 programming 8

2a. Codes and number systems (continued) How to get the binary representation of an integer: special case of application of the inverse Horner scheme

D I G I T A L C I R C U I T S E E

Digital Fundamentals

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Lecture (02) Operations on numbering systems

Unit 3, Lesson 2 Data Types, Arithmetic,Variables, Input, Constants, & Library Functions. Mr. Dave Clausen La Cañada High School

ASSIGNMENT 5 TIPS AND TRICKS

Digital Systems and Binary Numbers

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Universal Asynchronous Receiver Transmitter Communication

User s Manual. Xi3000 Scanner. Table of Contents

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Chapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.

Do not start the test until instructed to do so!

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.

CS341 *** TURN OFF ALL CELLPHONES *** Practice NAME

PureScan - ML1. Configuration Guide. Wireless Linear Imager Wireless Laser scanner - 1 -

Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

Number Systems CHAPTER Positional Number Systems

COMP Overview of Tutorial #2

Digital Systems COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

Do not start the test until instructed to do so!

Chapter 1. Digital Systems and Binary Numbers

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

Chapter 2. Data Representation in Computer Systems

Serial I/O. 4: Serial I/O. CET360 Microprocessor Engineering. J. Sumey

Semester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC

MACHINE LEVEL REPRESENTATION OF DATA

Xi2000-BT Series Configuration Guide

Number representations

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Configuration Manual PULSAR C CCD SCANNER. Table of Contents

Do not start the test until instructed to do so!

Module 2: Computer Arithmetic

Data Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?

Data Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?

The Binary Number System

Chapter 2. Data Representation in Computer Systems

ECE 20B, Winter Purpose of Course. Introduction to Electrical Engineering, II. Administration

Transcription:

Positional Number System A number is represented by a string of digits where each digit position has an associated weight. The weight is based on the radix of the number system. Some common radices: Decimal. Binary. Octal. Hexadecimal.

Notation Decimal. W = 123 10 = 123d = 123 Binary. X = 10 2 = 10b Octal. Y = 45 8 = 45q = 45o Hexadecimal. Z = 0A3 16 = 0A3h = 0xA3

Radix 10 Numbers Decimal. Here the base or radix is 10. Digits used. 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. D = 217 D D = 200+ 10 + 7 2 1 0 = 2 10 + 1 10 + 7 10

Radix 2 Numbers Binary. Here the base or radix is 2. Digits used: 0, and 1. B= 101.1 B= 1 2 2 2 + 0 2 1 + 1 2 0 + 1 2 1 B = 5.5

Octal. Radix 8 Numbers Here the base or radix is 8. Digits used: 0,1,2,3,4,5,6, and 7. O = 32.5 8 O = 3 8 1 + 2 8 0 + 5 8 1 O = 26.625

Radix 16 Numbers Hexadecimal. Here the base or radix is 16. Digits used: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. H H H H = 3 C.8 16 = 3 16 + C 16 + 8 16 1 0 1 = 3 16 + 12 16 + 8 16 = 60.5 1 0 1

Radix r Numbers A= a Ka a. a Ka n 1 0 1 m = + K+ + + + K+ n 1 0 1 m A ar n ar 1 ar 0 a 1r a mr n A= ai r i= m i

Conversion Table F 17 1111 15 E 16 1110 14 D 15 1101 13 C 14 1100 12 B 13 1011 11 A 12 1010 10 9 11 1001 9 8 10 1000 8 7 7 111 7 6 6 110 6 5 5 101 5 4 4 100 4 3 3 11 3 2 2 10 2 1 1 1 1 0 0 0 0 Hexadecimal Octal Binary Decimal

Binary to Octal, Octal to Binary Conversions Substitute a three binary digit string with an octal digit. 1 001. 1 2 = 11.4 8 754 8 = 111 101 100 2

Binary to Hexadecimal, Hexadecimal to Binary Conversions Substitute a four binary digit string, called a nibble, with a hexadecimal digit. 8A.C = 1000 1010. 11 16 2 1 1110 1011 =1EB 2 16

Simple Conversions The conversions just described are simple due to the fact that the radices are all powers of two. 2 1 = binary. 8 = 2 3 = octal. 16 = 2 4 = hexadecimal.

Radix r to Decimal Conversions A = n i= m n n a r i A = ar + K + a r i m m Ex: 101 2 = 1X2 2 + 0X2 1 + 1X2 0 = 5 432 5 = 4X5 2 + 3X5 1 + 2X5 0 = 117 75 8 = 7X8 1 + 5X8 0 = 61 1A 16 = 1X16 1 + 10X16 0 = 26

Decimal to Radix r Conversions A= n i= m i i n n 1 0 1 m n n 1 0 1 m I a r A = ar + a r + K+ ar + a r + K+ a r A= A + A F Integral part A = a r + a r + K + a r n n 1 0 I n n 1 0 Fractional part = + K + 1 m AF a 1r a mr

Decimal to Radix r Conversions Integral part A = a r + a r + K+ ar + a r n n 1 1 0 I n n 1 1 0 A = (( a r+ a ) r+ K+ a ) r+ a I n n 1 1 0 A I / r = (a n r+ a n-1 )r+ + a 1 as the quotient and a 0 as the remainder. Divide the result repeatedly until a zero quotients is reached. The remainders of the consecutive divisions form the numbers in base r.

Decimal to Radix r Conversions Convert 26 decimal to binary. Quotient Remainder 26/2 13 0 LSB 13/2 6 1 6/2 3 0 3/2 1 1 1/2 0 1 MSB 26 = 11010 2

Decimal to Radix r Conversions Fractional Part A A F F = a = r 1 1 r 1 a r m m ( 1( ( 1 a + r a + K+ r a ) 1 + 2 2 + K+ 2 a r m A F * r = r -1 (a -1 + r 1 (a -2 + )) * r =a -1 + r 1 (a -2 + ) Multiplying the fractional part by r results in a mixed number. The integral part of this mixed number is the conversion s required digit.

Decimal to Radix r Conversions This algorithm is not guaranteed to terminate, since a finite fraction in one number system may correspond to an infinite one in another number system.

Decimal to Radix r Conversions Convert 0.75 decimal to binary. Mixed no. Integral part 0.75 X 2 1.5 1 MSB 0.5 X 2 1.0 1 LSB 0.75 = 0.11 2

Decimal to Radix r Conversions Convert 46.375 to binary. Integral part : 46/2 = 23 0 23/2 = 11 1 11/2 = 5 1 5/2 = 2 1 2/2 = 1 0 1/ 2 = 0 1 Fractional part : 0.375 2 = 0.75 0.75 2 = 1.5 0.5 2 = 1.0 LSB MSB 0 MSB 1 1 LSB 46.375 = 101110.011 2

Decimal to Radix r Conversions Convert 465.56 to octal. Integral part : 465/8 = 58 58/8 = 7 7/8 = 0 Fractional part 0.56 8 = 0.48 8 = 0.84 8 = 4.48 3.84 6.72 1 2 7 : LSD MSD 4 MSB 3 6 LSB 465.5625 = 721.446 8

Binary Addition Table Carry in X Y Sum Carry out 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1

Binary Subtraction Table Borrow in X Y Difference Borrow out 0 0 0 0 0 0 0 1 1 1 0 1 0 1 0 0 1 1 0 0 1 0 0 1 1 1 0 1 0 1 1 1 0 0 0 1 1 1 1 1

Negative Number Representation Signed magnitude. Complement number system: Radix-complement. Diminished radix-complement. Excess representation.

Signed Magnitude Representation A = a n a K a 1 n 2 0 A is a n digit number, where a n-1 is the sign, and the remaining n 1 bits are the magnitude. a n-1 Positive if equal to 0. Negative if equal to 1 or r-1 for r greater than 2. Range is (2 n-1-1) to (2 n-1-1). Two zero representations: 00 0 2 = +0 10 0 2 = -0

Addition and Subtraction Check sign. If equal. Add magnitudes and give the result the same sign. If different. Compare magnitudes. Subtract the smaller from the larger and give the result the sign of the larger.

Complement Representation Negation is accomplished by taking the complement of the numbers. Two numbers in complement representation may be added or subtracted directly without sign and magnitude checks. Numbers in complement representation may be sign extended.

Diminished Radix Complement Also known as: One s complement (r = 2). Nine s complement (r = 10). 1 s Complement of A = (2 n -1) A n is the numbers of digits in A. Example : Compute the complement of A, for A = 11100010 2 B = Complement of A B B B B = = = = (2 8 1) 11100010 (100000000 11111111 00011101 2 2 2 1 2 2 11100010 ) 11100010 2 2

Diminished Radix Complement The easy way to get the one s complement of a binary number is by complementing each individual digit of that number. Ex: A = 11100010 2 B = One s complement of A B = 00011101 2

Diminished Radix Complement Range is (2 n-1-1) to (2 n-1-1). Two zero representations: 00 0 2 = +0 11 1 2 = -0

Radix Complement Also known as: Two s complement (r = 2). Ten s complement (r = 10). 2 s Complement of A = 2 n A n is the numbers of digits in A. B = 2 s Complement of A = 2 n A B = 2 n A 1 + 1 B = (2 n 1 A) + 1 Ex: A = 11100010 2 B = Two s complement of A B = 00011101 2 + 1 2 B = 00011110 2

Radix Complement The easy way to get the two s complement of a binary number is to search that number starting with the LSB until you find the rightmost one digit. Leave that digit and all other digits to the right of it unchanged. Complement all digits to the left of that one digit. Ex: A = 11101000 2 B = Two s complement of A B = 00011000 2

Radix Complement Range is 2 n-1 to 2 n-1-1. One zero representation: 00 0 2 = 0

Excess Representation ED is an unsigned integer, represented by a n-bit string, such that 0 ED < 2 n. EB represents the signed integer ED - B, where B is the bias of the number system. ED EB Excess-3 Excess-4 0 000-3 -4 1 001-2 -3 2 010-1 -2 3 011 0-1 4 100 1 0 5 101 2 1 6 110 3 2 7 111 4 3

Negative Number Representation Two's One's Signed Excess Decimal Complement Complement Magnitude 2 m-1-8 1000 0000-7 1001 1000 1111 0001-6 1010 1001 1110 0010-5 1011 1010 1101 0011-4 1100 1011 1100 0100-3 1101 1100 1011 0101-2 1110 1101 1010 0110-1 1111 1110 1001 0111 0 0000 1111 or 0000 1000 or 0000 1000 1 0001 0001 0001 1001 2 0010 0010 0010 1010 3 0011 0011 0011 1011 4 0100 0100 0100 1100 5 0101 0101 0101 1101 6 0110 0110 0110 1110 7 0111 0111 0111 1111

Two s Complement Addition Simply add the numbers ignoring any carries beyond the MSB. The result will always be correct as long as the range of the number system is not exceeded. Example: 2 0010 2 1110 5 + 0101+ 5 + 0101+ 7 0111 3 0011

Overflow Overflow occurs when the result of an addition exceeds the range of the number system. So, will overflow occur when numbers with different signs are added? Detection of an overflow: Compare the carries into and out of the sign bit, if they are different an overflow has occurred. The sign of the addends are the same and they differ from the sums sign. Ex: - 4 + ( -5 ) = -9 4 + 5 = 9

Overflow 4 0100 4 1100 5 + 0101 + 5 + 1011 + 9 1001 9 0111

Two s Complement Subtraction Subtraction is performed by negating the subtrahend by taking its two s complement, then adding it to the minuend using normal two s complement addition rules. Ex: 4 0100 0100 2 0010 1110 + 2 0010 0010

Graphical View 1111 0000 0001 1110 1101 2 3 1 +0 +1 0010 +2 0011 +3 Subtraction of ositive numbers 1100 4 +4 0100 Addition of positive numbers 5 1011 6 1010 7 8 +7 +5 0101 +6 0110 1001 1000 0111 1111 0000 0001 1110 14 1101 13 15 0 1 2 0010 0011 3 Subtraction 1100 12 4 0100 Addition 11 1011 10 1010 9 8 7 6 5 0110 0101 1001 1000 0111 Copyright 2000 by Prentice Hall, Inc. Digital Design Principles and Practices, 3/e

One s Complement Addition Perform addition; If there is a carry out of the sign bit, add one to the result. This is called the end-around carry. Ex: - 3 + ( -4 ) = -7

One s Complement Subtraction Subtraction is performed by negating the subtrahend by taking its one s complement, then adding it to the minuend using normal one s complement addition rules. Ex: - 3 ( -4 ) = 1

Multiplication Performed just like you would performed it in decimal, except the additions are in binary. Ex: 11 X 13= 143 Signed (2 s comp.) multiplication can be performed by the addition of shifted multiplicands, except for the last multiplicand which should be negated then shifted. Ex: -3 X 5 = 15

Division Use the shift and subtract method you learned in grammar school. Ex: 217 / 11 = 19 with 8 remaining 217 = 11011001 2 Signed division can be performed by dividing the numbers as unsigned numbers then given them a + sign if the operands have the same sign and if the operands have different signs.

Binary Codes For Decimal Numbers Decimal BCD Digit 8421 2421 Excess-3 Biquinary 1-out-of-10 0 0000 0000 0011 0100001 1000000000 1 0001 0001 0100 0100010 0100000000 2 0010 0010 0101 0100100 0010000000 3 0011 0011 0110 0101000 0001000000 4 0100 0100 0111 0110000 0000100000 5 0101 1011 1000 1000001 0000010000 6 0110 1100 1001 1000010 0000001000 7 0111 1101 1010 1000100 0000000100 8 1000 1110 1011 1001000 0000000010 9 1001 1111 1100 1010000 0000000001 Unused codes words 1010 0101 0000 0000000 0000000000 1011 0110 0001 0000001 0000000011 1100 0111 0010 0000010 0000000101 1101 1000 1101 0000011 0000000110 1110 1001 1110 0000101 0000000111 1111 1010 1111

Binary Coded Decimal Also known as BCD or 8421 weighted code. BCD encodes the decimal digits 0 9 with their unsigned binary representation, 0000 2 1001 2. Packed BCD a byte represents two BCD numbers. Unpacked BCD - a byte represents only one BCD number.

BCD Addition Similar to unsigned binary addition, except that a correction is required should the result exceed 1001 2. The correct result may be obtained by adding 0110 2. Ex: 6 + 8 = 14 3 + 3 = 6 9 + 9 = 18

Self Complementing Codes A code that the 9 s complement of their decimal representation may be obtained by simply complementing the individual bits of the code word. Ex: 2421. Excess-3. Decimal 2421 Excess-3 6 1100 2 1001 2 9-6=3 0011 2 0110 2

Code Representations With More Than 4 Bits Biquinary. XXYYYYY XX 01 = Numbers 0-4 10 = Numbers 5-9 YYYYY Advantages. Indicates which of the five numbers from the above ranges is represented. Easier to detect errors.

Gray Code The codes were patented in 1953 by Frank Gray, a Bell Labs researcher. A binary sequence with the property that only one bit changes between any two consecutive elements. Used in electromechanical applications of digital systems, like copiers, brake systems, machine tools, etc.

Gray Code 111 000 110 001 0 0 1 101 010 100 011 100 000 101 001 0 0 1 111 011 110 010 Copyright 2000 by Prentice Hall, Inc. Digital Design Principles and Practices, 3/e

Gray Code How to construct a Gray code. 1 st Method - Reflected Code. A one bit Gray code has two words, 0 and 1. The first 2 n code words of a n + 1 bit Gray code equal the code words of the n bit Gray code written in order with a leading 0 appended. The last 2 n code words of a n + 1 bit Gray code equal the code words of the n bit Gray code written in reverse order with a leading 1 appended.

Gray Code 2 nd Method Direct derivation from corresponding binary representation. The bits of a n bit binary or Gray codes are numbered from right to left as 0 to n-1. Bit i of a Gray code word is 0 if bits i and i + 1 of the corresponding binary code are the same, else bit i is 1. When i + 1 = n then bit n of the binary code word is considered to be 0.

Character Codes ASCII American Standard Code for Information Interchange. Control (0x0 0x20). Alphabet and alphanumeric characters (0x21 0x7f). Special characters (0x80 0xff). EBCDIC. IBM. Baudot. TDDs telecommunication devices for the deaf. HAM radio applications.

ASCII Table 0H 1H 2H 3H 4H 5H 6H 7H 0H NUL DLE SP 0 @ P ` p 1H SOH DC1! 1 A Q a q 2H STX DC2 " 2 B R b r 3H ETX DC3 # 3 C S c s 4H EOT DC4 $ 4 D T d t 5H ENQ NAK % 5 E U e u 6H ACK SYN & 6 F V f v 7H BEL ETB ' 7 G W g w 8H BS CAN ( 8 H X h x 9H HT EM ) 9 I Y I y 0AH LF SUB * : J Z j z 0BH VT ESC + ; K [ k { 0CH FF FS, < L \ l 0DH CR GS - = M ] m } 0EH SO RS. > N ^ n ~ 0FH SI US /? O _ o DEL

Codes For Actions, Conditions, and States For n actions, conditions, and/or states, a code with b bits, where b = log 2 n, may be used. Ligths N-S E-W Code State Green Yellow Red Green Yellow Red Word N-S Go ON off off off off ON 000 N-S Wait off ON off off off ON 001 N-S Delay off off ON off off 0 010 E-W Go off off ON ON off off 100 E-W Wait off off ON off ON off 101 E-W Delay off off ON off off ON 110

Codes For Actions, Conditions, and States Control Unit binary-coded device select (a) compare device ID compare device ID compare device ID Device device enable Device device enable Device device enable 1-out-of-n coded device select Copyright 2000 by Prentice Hall, Inc. Digital Design Principles and Practices, 3/e Control Unit (b) device enable device enable device enable Device Device Device

n-cubes And Distance An n-cube has 2 n vertices. Each vertex is labeled with an n bit string. n-cubes makes it easy to visualize certain coding and logic minimization problems. Copyright 2000 by Prentice Hall, Inc. Digital Design Principles and Practices, 3/e 10 11 0 1 1-cube 00 01 2-cube 1110 1111 110 111 010 011 0010 0110 0111 1010 1011 1100 100 101 0011 0100 0101 1000 1001 1101 000 001 0000 0001 3-cube 4-cube

n-cubes And Distance They provide a geometrical interpretation for the concept of distance. Hamming distance is the number of positions in which two n bit strings differ. The distance between adjacent vertices is one. m-subcube of an n- cube is a set of 2 m vertices in which n-m bits, of the bit strings representing those vertices, have the same value at each vertex. Copyright 2000 by Prentice Hall, Inc. Digital Design Principles and Practices, 3/e 10 11 0 1 1-cube 00 01 2-cube 1110 1111 110 111 010 011 0010 0110 0111 1010 1011 1100 100 101 0011 0101 0100 1000 1001 1101 000 001 0000 0001 3-cube 4-cube

Codes For Detecting And Correcting Errors Error corruption of data caused by physical failures. The effect failures on data are predicted by error models, and the independent error model is the simplest one. In this model, a single physical failure is assumed to affect a single bit of data. Notice that multiple failures may cause multiple errors, but multiple errors are normally assumed to be less likely to occur, than single errors.

Codes For Detecting And Correcting Errors Code word a valid representation of the code. Non-code word an invalid representation of the code. An n bit string does not have 2 n code words. An error detecting code only generates, transmits and stores code words, so errors can be detected by verifying if the bit string is a code word. If a noncode word is found then that word has an error.

Codes For Detecting And Correcting Errors A code detects all single errors if the minimum distance between all possible pairs of code words is 2. No single error can change one code word into another. 110 111 110 111 = code word = noncode word 010 011 100 101 010 011 100 101 000 001 (a) 000 001 (b)

Codes For Detecting And Correcting Errors In general n + 1 bits are needed to construct a single-error-detecting code with 2 n code words. XXXXX XP Where XXXXX X are the information bits, and P is the parity bit. Information Even-parity Odd-parity Bits Code Code 000 000 0 000 1 001 001 1 001 0 010 010 1 010 0 011 011 0 011 1 100 100 1 100 0 101 101 0 101 1 110 110 0 110 1 111 111 1 111 0

Error Correcting And Multiple Error Detecting Codes 2c + 1 is the minimum distance for an error correcting code capable of correcting c bits. 2c + d + 1 is the minimum distance for an error code capable of correcting up to c errors and detecting up to d additional errors.

Error Correcting And Multiple Error Detecting Codes 0001010 1011000 1001011 0001001 1011011 0011001 0001011 0001111 1011001 1111001 0101011 0000011 1011101 1001001 0011011 0010010 1010011 1010000 1010001 1010010 1010110 = code word = noncode word 1110010 1000010 1011010 Copyright 2000 by Prentice Hall, Inc. Digital Design Principles and Practices, 3/e

Error Correcting And Multiple Error Detecting Codes (a) detectable 2-bit errors 00101010 11010011 00101011 00100011 10100011 11100011 11000011 detectable 2-bit errors correctable 1-bit errors (b) 00101010 11010011 00101011 00100011 10100011 11100011 11000011 3-bit error looks like a 1-bit error (c) 00101011 11000011 all 1- to 3-bit errors are detectable Copyright 2000 by Prentice Hall, Inc. Digital Design Principles and Practices, 3/e

Codes For Detecting And Correcting Errors Hamming Codes. Method for constructing a code created by R.W. Hamming, in 1950. For any value of i this method yields a 2 i 1 bit code with i check bits and 2 i 1 i information bits. CRC Codes. Cyclic-redundancy-check codes. Includes Hamming codes in its construction. Used in hard disk drives and data networks.

Codes For Detecting And Correcting Errors Two dimensional codes. RAID redundant array of inexpensive disks. Copyright 2000 by Prentice Hall, Inc. Digital Design Principles and Practices, 3/e (a) information bits checks on rows Rows are code words in C row checks on columns checks on checks (b) (c) Columns are code words in C col information bits Rows are code words in 1-bit even-parity code No effect on row parity Columns are code words in 1-bit even-parity code No effect on column parity Disk 1 Disk 2 Disk 3 Disk 4 Disk 5 Disk 6... Disk n Disk n + 1 Block number 1 2 3 4 5 6 7 8 9 10 11 12... m information blocks... check blocks...... Data bytes 1 2 3 4 5 6 7... 512... One block Copyright 2000 by Prentice Hall, Inc. Digital Design Principles and Practices, 3/e CRC

Codes For Detecting And Correcting Errors Checksum codes. Parity checking is a modulo two addition of bits. m-out-of-n codes. Detects unidirectional errors, bit changes in the same direction, for example, 0 changing to 1.

Codes for Serial Transmission of Data time CLOCK bit time SERDATA bit cell bit cell bit cell bit cell bit cell bit cell bit cell bit cell bit cell bit cell SYNC bit number 1 2 3 4 5 6 7 8 1 2 Copyright 2000 by Prentice Hall, Inc. Digital Design Principles and Practices, 3/e CLOCK defines the rate of transmission, in bps, bits per second. SERDATA is the information being transmitted. SYNC identifies the first bit of information.

Codes for Serial Transmission of Data DPLL is an analog circuit used to extract the clock from a serial data stream. Codes for serial data: NRZ, non-return-to-zero. NRZI, non-return-to-zero invert. RZ, return-to-zero. BPRZ, bipolar return-to-zero. Manchester.

Codes for Serial Transmission of Data time bit value 0 1 1 1 0 0 1 0 NRZ NRZI RZ BPRZ Manchester Copyright 2000 by Prentice Hall, Inc. Digital Design Principles and Practices, 3/e