MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 1 Overflow Signed binary is in fixed range -2 n-1  2 n-1 If the answer for addition/subtraction more than the.

Slides:



Advertisements
Similar presentations
MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 1 Combinational Circuit – Arithmetic Circuit Parallel Adder Example: 4-bit adder.
Advertisements

HEXADECIMAL NUMBERS Code
CHAPTER 2 Number Systems, Operations, and Codes
Digital Fundamentals Floyd Chapter 2 Tenth Edition
MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 1 Negative Number (Sign & Magnitude) Negative number always written with sign at the front: –Example: -(20)
MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 1 Lecture 3 Number System.
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
CS2100 Computer Organisation
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Data Representation – Chapter 3 Sections 3-2, 3-3, 3-4.
1.6 Signed Binary Numbers.
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Digital Systems and Logic Design
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
Binary Arithmetic & Data representation
Morgan Kaufmann Publishers
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
Yuh-Jzer JoungDigital Systems1 Number Systems decimal number : 7397=7× × × ×10 0 a 4 a 3 a 2 a 1 a 0. a -1 a -2 = a 4 ×10 4 +a 3 ×10.
CS151 Introduction to Digital Design
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Number Systems and Codes. CS2100 Number Systems and Codes 2 NUMBER SYSTEMS & CODES Information Representations Number Systems Base Conversion Negative.
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Summer 2012ETE Digital Electronics1 Binary Arithmetic of Signed Binary Numbers.
ECE 2110: Introduction to Digital Systems BCD, Gray, Character, Action/Event, Serial Data.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
1 Representation of Data within the Computer Oct., 1999(Revised 2001 Oct)
Computer Math CPS120 Introduction to Computer Science Lecture 4.
Tutorial: ITI1100 Dewan Tanvir Ahmed SITE, UofO
Ahmad Almulhem, KFUPM 2009 COE 202: Digital Logic Design Number Systems Part 4 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
Monday, January 14 Homework #1 is posted on the website Homework #1 is posted on the website Due before class, Jan. 16 Due before class, Jan. 16.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  The necessity and advantages of coding  The variety of coding systems You will learn: 2.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CE-321: Computer.
DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck.
Module –I Codes: Weighted and non-weighted codes
Number Representation and Arithmetic Circuits
Computer Math CPS120 Introduction to Computer Science Lecture 7.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Chapter 9 Computer Arithmetic
Computer Representation of Information
CS2100 Computer Organisation
Signed binary numbers & Binary Codes
ECE 2110: Introduction to Digital Systems
CS2100 Computer Organisation
Number systems and codes
William Stallings Computer Organization and Architecture 7th Edition
CS1010 Programming Methodology
Digital Logic & Design Lecture 03.
ECEG-3202 Computer Architecture and Organization
Chapter 8 Computer Arithmetic
ECE 331 – Digital System Design
Presentation transcript:

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 1 Overflow Signed binary is in fixed range -2 n-1  2 n-1 If the answer for addition/subtraction more than the range, it is overflow Two situation where overflow can happen: –Positive + positive = negative (enough n-bit) –Negative + negative = positive(more than n-bit)

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 2 Overflow Example: Binary number 4-bit (second complement) Range : -2 n-1  2 n-1 -1 Range : (1000) 2s  (0111) 2s Range : (-8) 10  (+7) 10 Two situation where overflow can happen: –Positive + positive = negative (enough n-bit) –Negative + negative = positive(more than n-bit) 0101 = = = =

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 3 Overflow Example: Binary number 4-bit (second complement) Range : -2 n-1  2 n-1 -1 Range : (1000) 2s  (0111) 2s Range : (-8) 10  (+7) 10 (Overflow exist) (ignore final carry)

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 4 Fixed Point Number Signed number and unsigned number representation is given in fixed point number Binary point is assumed to have fixed location, if it is located at the end of the number It can represent integer number between –128 to 127 (for 8-bit binary complement) Binary point

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 5 Fixed Point Number Generally, other locations in binary point position Example: If two fraction bit is used, we can represent: Binary point fraction

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 6 Floating Point Number Fixed point number has limited range To represent extremely large or extremely small number, we use floating point number (like scientific number) Example: 0.23X10 23 (really large number) X (really small number)

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 7 Floating Point Number Floating point number is divided into three parts mantissa, base and exponent Base always fixed in number system Therefore, only need mantissa and exponent Mantissaexponent

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 8 Floating Point Number Mantissa always in normalize form: (base 10) 23X10 21 is normalized to 0.23X10 23 (base 10) –0.0017X10 21 is normalized to -0.17X10 19 (base 10) X10 3 is normalized to X bit floating point number might contain 10-bit mantissa and 6-bit exponent More exponent, the greater its range More mantissa, the greater its persistence

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 9 Arithmetic with Floating Point Number Arithmetic with floating point number is much difficult MULTIPLICATION The steps: –multiply with the mantissa –Add its exponent –normalized

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 10 Arithmetic with Floating Point Number Example (Normalization)

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 11 Arithmetic with Floating Point Number ADDITION Steps: –Equalize their exponent –Add their mantissa –Normalize them

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 12 Arithmetic with Floating Point Number Example: (0.12x10 2 ) 10 + (0.0002x10 4 ) 10 = (0.12x10 2 ) 10 +(0.02x10 2 ) 10 =( ) 10 x 10 2 =(0.14x10 2 ) 10

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 13 Binary Coded Decimal (BCD) Decimal number is normally used by human. Binary number is normally used by computer. It is expensive to exchange between each other. If used only little calculation, we can use coding scheme for decimal number. One of the scheme is BCD, or also called 8421 code. Which represent every decimal digit with 4- bit binary code.

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 14 Binary Coded Decimal (BCD) There are code which is not used, e.g. (1010) BCD,(1011) BCD,….,(1111) BCD. This code is said to be an error. Easy to convert but the arithmetic is hard Suitable as interface such as keyboard input and digital reading Decimal Digit

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 15 Binary Coded Decimal (BCD) Example: Notes: BCD is not similar to binary Example: (243) 10 =( ) 2 Decimal Digit

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 16 Gray Code No weight Only one bit change from one code number to the others Suitable for error detection Decimal Binary Gray Code

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 17 Gray Code

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 18 Gray Code

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 19 Convert Binary Code to Gray Code Fixed MSB From left to right, add each coupled binary code bit next to each other to get Gray code bit, ignore carry Example: convert binary to Gray code

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 20 Convert Gray Code to Binary Code Fixed MSB From left to right, add each coupled binary code executed with Gray code bit at the next position, ignore carry Example: convert Gray to binary code

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 21 Other Decimal Code Self compliment code: excess-3 code, , 2*421 Error detection code: Biquinary code (bi=two, quinary=five)

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 22 Self Compliment Code Example: Excess-3, , 2*421 Code represented by coupled compliment-digit which compliment each other

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 23 Alphanumeric Code Part of numbers, computer also handle textual data Set which always used includes: Letters:‘A’,…..,‘Z’ and ‘a’,…..,‘z’ Digits: ‘0’,…..,‘9’ Special Characters: ‘$’, ‘  ’, ‘!’, ‘,’, ‘.’,…. Not Printable: SOH, NULL, BELL,…. Most of the time, it is represented by 7 or 8-bit

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 24 Alphanumeric Code Two standard that are frequently used ASCII (American Standard Code for Information Interchange) EBCDIC (Extended BCD Interchange Code) ASCII: 7-bit, add with parity bit for error detection (odd,even parity) EBCDIC: 8-bit

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 25 Alphanumeric Code ASCII Table

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 26 Error Detection Code Error can exist in transmission. It must be detected so that retransmission can be requested With binary number, mostly exist 1-bit error. Example: 0010 is transmitted incorrectly as 0011, or 0000, or 0110, or 1010 Biquinary using additional 3-bit to detect error. For one error detection, only one extra bit is needed

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 27 Error Detection Code Parity Bit –Even parity: number of bit 1 is even –Odd parity: number of bit 1 is odd Example: Odd parity

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 28 Error Detection Code Parity Bit can detect odd error and not even error (if odd is set) Example: For odd parity number 10011=>10001 (detected) 10011=>10101 (not detected) Parity bit can also be used on data block

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 29 Error Detection Code Sometimes, it is not enough to detect code, we need to correct it Error correction is expensive in practical, we only need to use one bit error correction Popular technique: Hamming Code –Add k-bit to n-bit number to produce n+k bit –Number the bit 1 on bit n+k –Every parity bit is on the number range

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 30 Error Detection Code E.g: For 8-bit number, we need 4 parity bit 12 bit number are 0001,0011,…,1100. Every 4 bit parity is used to detect group of bit. Every parity bit is for themselves and has bit ‘1’ on certain position bit

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 31 Error Detection Code Therefore: P 1 = parity for bit {3,5,7,9,11} P 2 = parity for bit {3,6,7,10} P 4 = parity for bit {5,6,7,12} P 8 = parity for bit {9,10,11,12}

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 32 Error Detection Code Given 8-bit number: Assume even parity is P 1 = parity for bit {3,5,7,9,11}= 0 P 2 = parity for bit {3,6,7,10}= 0 P 4 = parity for bit {5,6,7,12}= 1 P 8 = parity for bit {9,10,11,12}= 1

MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 33 Error Detection Code To check error, execute checking code C 1 = XOR {1,3,5,7,9,11} C 2 = XOR {2,3,6,7,10} C 4 = XOR {4,5,6,7,12} C 8 = XOR {8,9,10,11,12} If C 8 C 4 C 2 C 1 =0000 therefore no error, if otherwise C 8 C 4 C 2 C 1 show position, there is an error for only one bit Example