Ahmad Almulhem, KFUPM 2009 COE 202: Digital Logic Design Number Systems Part 4 Dr. Ahmad Almulhem Email: ahmadsm AT kfupm Phone: 860-7554 Office: 22-324.

Slides:



Advertisements
Similar presentations
KFUPM COE 202: Digital Logic Design Number Systems Part 3 Courtesy of Dr. Ahmad Almulhem.
Advertisements

Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
HEXADECIMAL NUMBERS Code
COE 202: Digital Logic Design Signed Numbers
A digital system is a system that manipulates discrete elements of information represented internally in binary form. Digital computers –general purposes.
ENGIN112 L4: Number Codes and Registers ENGIN 112 Intro to Electrical and Computer Engineering Lecture 4 Number Codes and Registers.
ECE 331 – Digital System Design
King Fahd University of Petroleum and Minerals
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Data Representation Computer Organization &
Data Representation COE 205
CS 151 Digital Systems Design Lecture 4 Number Codes and Registers.
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
EECC341 - Shaaban #1 Lec # 3 Winter Binary Multiplication Multiplication is achieved by adding a list of shifted multiplicands according.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
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.
© BYU 02 NUMBERS Page 1 ECEn 224 Binary Number Systems and Codes.
Data Storage. SIGN AND MAGNITUDE Storing and representing numbers.
1.6 Signed Binary Numbers.
Binary Addition Addition Rules: = = = = = carry 1 1 carry 1 Example 1: Example 2:
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Fundamental of Computer Architecture By Panyayot Chaikan November 01, 2003.
Binary Arithmetic & Data representation
Ahmad Almulhem, KFUPM 2010 COE 202: Digital Logic Design Number Systems Part 4 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
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.
Number Systems ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
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.
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.
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Operations on Bits Arithmetic Operations Logic Operations
C.S. Choy1 ITM1010 COMPUTER AND COMMUNICATION TECHNOLOGIES Prof. C.S. Choy, room 412 Prof. H.K. Tsang, room 306 Tutors: CY Poon ZJ Zhang CW Lee SK Cheung.
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
Tutorial: ITI1100 Dewan Tanvir Ahmed SITE, UofO
ECE 301 – Digital Electronics Representation of Negative Numbers, Binary Arithmetic of Negative Numbers, and Binary Codes (Lecture #11) The slides included.
Signed Binary Numbers Arithmetic Subtraction – In 2’s-complement form: Example: 1.Take the 2’s complement of the subtrahend (including the sign bit) and.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  The necessity and advantages of coding  The variety of coding systems You will learn: 2.
MECH1500 Chapter 3.
IT1004: Data Representation and Organization Negative number representation.
ECE DIGITAL LOGIC LECTURE 4: BINARY CODES Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/26/2016.
Digital Logic & Design Adil Waheed Lecture 03. Range of Binary Numbers Processors can handle 64-bit unsigned binary values. Maximum unsigned decimal number.
Lecture 1.2 (Chapter 1) Prepared by Dr. Lamiaa Elshenawy
Nguyen Le CS147.  2.4 Signed Integer Representation  – Signed Magnitude  – Complement Systems  – Unsigned Versus Signed Numbers.
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
Dr. Nermin Hamza. Agenda Signed Numbers Properties of Switching Algebra.
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.
N 3-1 Data Types  Binary information is stored in memory or processor registers  Registers contain either data or control information l Data are numbers.
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.
David Kauchak CS 52 – Spring 2017
Signed binary numbers & Binary Codes
11001 / 101 , / ) Perform subtraction on the given unsigned binary numbers using the 2's complement of the subtrahend. Where the.
Number Systems.
Data Representation COE 301 Computer Organization
Data Representation Data Types Complements Fixed Point Representation
Digital Logic & Design Lecture 03.
COMS 161 Introduction to Computing
ECE 331 – Digital System Design
Chapter3 Fixed Point Representation
COE 202: Digital Logic Design Number Systems Part 2
Presentation transcript:

Ahmad Almulhem, KFUPM 2009 COE 202: Digital Logic Design Number Systems Part 4 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

Ahmad Almulhem, KFUPM 2009 Objectives 1.Overflow 2.Shift operations 3.Binary codes

Ahmad Almulhem, KFUPM 2009 Overflows Number’s sizes in computers are fixed Overflows can occur when the result of an operation does not fit. Q: When can an overflow occur? Unsigned numbersSigned numbers Subtracting two numbersAdding a positive number to a negative number Adding two numbersAdding two negative numbers or two positive numbers

Ahmad Almulhem, KFUPM 2009 Overflow (2’s Complement) Q: Add +5 and +4 in 2’s complement. A: An overflow happened. The correct answer +9 (1001) cannot be represented by 4 bits. Detection: 1.Adding two positive numbers result in a negative number! 2.Carry in sign bit is different from carry out of sign bit Solution: Use one more bit, extend the sign bit ??

Ahmad Almulhem, KFUPM 2009 Overflow (2’s Complement) Q: Add -5 and -4 in 2’s complement. A: An overflow happened. The correct answer -9 (10111) cannot be represented by 4 bits. Detection: 1.Adding two negative numbers result in a positive number! 2.Carry in sign bit is different from carry out of sign bit Solution: Use one more bit, extend the sign bit ??

Ahmad Almulhem, KFUPM 2009 Range Extensions To extend the representation of a 2’s complement number possibly for storage and use in a larger-sized register If the number is positive, pad 0’s to the left of the integral number (sign bit extension), and 0’s to the right of the fractional number If the number is negative, pad 1’s to the left of the integral number (sign bit extension), and 0’s to the right of the fractional number bit register (+9) bit register (-9) 9-bit register (-9) – sign bit extended 9-bit register (+9) – sign bit extended

Ahmad Almulhem, KFUPM 2009 Arithmetic Shift A binary number can be shifted right or left To shift an unsigned numbers (right or left), pad with 0s. Example: Left Shift Q1: What is the effect of left-shifting? Q2: What is the effect of right-shifting?

Ahmad Almulhem, KFUPM 2009 Arithmetic Shift To shift a signed number – Left-Shift: pad with 0s – Right-Shift: Extend sign bit Example (2’s complement): Right Shift In General - left-shifting = multiply by r - right-shifting = divide by r

Ahmad Almulhem, KFUPM 2009 Arithmetic Shifts

Ahmad Almulhem, KFUPM 2009 Binary Codes Human communicating with computers – Humans understand decimal – Computers understands binary Communication mode is decimal Binary codes are used to translate individual digits of a given number (generally in base 10) to binary format based on given rules Computers …. Human 1234 ….

Ahmad Almulhem, KFUPM 2009 Binary Coded Decimal (BCD) BCD Code uses 4 bits to represent the 10 decimal digits {0 to 9} 6 BCD codes unused The weights of the individual positions of the bits of a BCD code are: 2 3= 8, 2 2 =4, 2 1 =2, 2 0 =1

Ahmad Almulhem, KFUPM 2009 BCD Addition

Ahmad Almulhem, KFUPM 2009 Gray Code Gray code represents decimal numbers 0 to 15 using bit codes Gray codes of two adjacent decimal numbers differ by only one bit Example: (5) 10 = 0111 (6) 10 = 0101 (7) 10 = 0100

Ahmad Almulhem, KFUPM 2009 ASCII Code (Alphanumeric) American Standard Code for Information Interchange (ASCII): includes binary definitions for 128 characters that include the English alphabets, special symbols and control characters. ASCII codes have a length of 7 bits Examples: A = (65) 10 = B = (66) 10 = Z = (90) 10 = a = (97) 10 = b = (98) 10 = z = (122) 10 =

Ahmad Almulhem, KFUPM 2009 Parity Bits

Ahmad Almulhem, KFUPM 2009 Codes Summary Bits are bits – Modern digital devices represent everything as collections of bits – A computer is one such digital device You can encode anything with sufficient 1’s and 0’s – Text (ASCII) – Computer programs (C code, assembly code, machine code) – Sound (.wav,.mp3,...) – Pictures (.jpg,.gif,.tiff)

Ahmad Almulhem, KFUPM 2009 Numbers have fixed sizes in a computer, therefore overflow can occur in any representation. Detection of overflow by sign or carry-in carry-out of the sign bit. To extend a signed number, extend the sign Shift operations (right, left) Binary codes (BCD, gray code, ASCII) Conclusions