COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

Similar documents
COE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design

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

Octal & Hexadecimal Number Systems. Digital Electronics

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

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

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

Korea University of Technology and Education

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

Learning Objectives. Binary over Decimal. In this chapter you will learn about:

CHW 261: Logic Design

Number Systems Base r

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

Number Systems. TA: Mamun. References: Lecture notes of Introduction to Information Technologies (ITEC 1011) by Dr Scott MacKenzie

Chapter 4 Section 2 Operations on Decimals

Number representations

Chapter 5: Computer Arithmetic

COMP Overview of Tutorial #2

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

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

in this web service Cambridge University Press

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

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

Numeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:

CMPE223/CMSE222 Digital Logic Design. Positional representation

CS & IT Conversions. Magnitude 10,000 1,

Module 2: Computer Arithmetic

TOPIC: NUMBER SYSTEMS

Number System. Introduction. Decimal Numbers

Chapter 2 Binary Values and Number Systems

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

Digital Systems and Binary Numbers

Computer Sc. & IT. Digital Logic. Computer Sciencee & Information Technology. 20 Rank under AIR 100. Postal Correspondence

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Chapter 10 Binary Arithmetics

Level ISA3: Information Representation

carry in carry 1101 carry carry

Chapter 1 Review of Number Systems

Digital Fundamentals

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

MC1601 Computer Organization

Numbering systems. Dr Abu Arqoub

MACHINE LEVEL REPRESENTATION OF DATA

Arithmetic Operations

Digital Systems and Binary Numbers

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

Organisasi Sistem Komputer

T02 Tutorial Slides for Week 2

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

Integer Multiplication and Division

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

Ms Sandhya Rani Dash UNIT 2: NUMBER SYSTEM AND CODES. 1.1 Introduction

Number Systems CHAPTER Positional Number Systems

CS321. Introduction to Numerical Methods

Agenda EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 1: Introduction. Go over the syllabus 3/31/2010

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Computer Arithmetic. Appendix A Fall 2003 Lec.03-58

2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting)

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.

Switching Circuits and Logic Design Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Positional Number System

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

Digital Logic Circuits Volume I Digital Number Systems

EE 109 Unit 6 Binary Arithmetic

Beyond Base 10: Non-decimal Based Number Systems

Digital Logic Lecture 2 Number Systems

UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES

Chapter 3: part 3 Binary Subtraction

CHAPTER 2 (b) : AND CODES

CO212 Lecture 10: Arithmetic & Logical Unit

Introduction to Computer Science (I1100) With 1 coin 2 possibilities: Head / Tail or 0/1

The. Binary. Number System

Digital Systems and Binary Numbers

Math in MIPS. Subtracting a binary number from another binary number also bears an uncanny resemblance to the way it s done in decimal.

6. Binary and Hexadecimal

Chapter 2: Number Systems

Arithmetic Processing

Lecture 1: Digital Systems and Number Systems

Number Systems. Both numbers are positive

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

ITEC 1011 Introduction to Information Technologies

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

Arithmetic and Logical Operations

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

DIGITAL SYSTEM DESIGN

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee

Chapter 4 Arithmetic Functions

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS

TOPICS. Other Number Systems. Other Number Systems 9/9/2017. Octal Hexadecimal Number conversion

Beyond Base 10: Non-decimal Based Number Systems

Chapter 2. Data Representation in Computer Systems

QUIZ: Generations of computer technology. Hardware:

What Is It? Instruction Register Address Register Data Register

1.3 Systems of numeration: To represent quantities in the different systems of numeration, specific symbols are used, which are also called ciphers.

UNIT IV: DATA PATH DESIGN

Internal Data Representation

Binary Systems and Codes

Introduction to Numbering Systems

Lecture 2: Number Systems

Transcription:

COE 0: Digital Logic Design Number Systems Part Dr. Ahmad Almulhem Email: ahmadsm AT kfupm Phone: 860-7554 Office: -34

Objectives Arithmetic operations: Binary number system Other number systems Base Conversion Decimal to other bases Binary to Octal and Hexadecimal Any base to any base

Arithmetic Operation in base-r Arithmetic operations with numbers in base-r follow the same rules as for decimal numbers Be careful! Only r allowed digits

Binary Addition One bit addition: 0 0 1 1 + 0 + 1 + 0 + 1 ----- ------ ------ ------ 0 1 1 1 0 carry augend /aw-jend/ addend sum doesn t exist in binary!

Binary Addition (cont.) Example: 1 1 1 1 1 1 0 0 0 0 1 1 1 1 + 0 1 1 1 1 0 1 0 1 0 -------------------------- 1 0 0 1 1 1 1 1 0 0 1 carries sum Q: How to verify? A: Convert to decimal 783 + 490 ----------- 173

Binary Subtraction One bit subtraction: 0 0 1 1-0 - 1-0 - 1 ----- ------ ------ ------ 0 1 1 0 minuend /men-u-end/ subtrahend /sub-tra-hend/ difference borrow 1 In binary addition, there is a sum and a carry. In binary subtraction, there is a difference and a borrow Note: 0 1 = 1 borrow 1

Binary Subtraction (cont.) Subtract 101-011 1 0 1 0 1-0 1 1 borrow -------------------------- difference 0 1 0 Larger binary numbers 1 1 1 1 1 1 0 0 0 0 1 1 1 1-0 1 1 1 1 0 1 0 1 0 -------------------------- 0 1 0 0 1 0 0 1 0 1 borrow difference Verify In decimal, 783-490 --------- 93 In Decimal subtraction, the borrow is equal to 10. In Binary, the borrow is equal to. Therefore, a 1 borrowed in binary will generate a (10), which equals to () 10 in decimal

Binary Subtraction (cont.) Subtract (11110) from (10011) 00110 borrow 10011 11110-11110 - 10011 ----------- ----------- - 01011 01011 negative sign Note that (10011) is smaller than (11110) result is negative

Binary Multiplication Multiply 1011 with 101: 1 0 1 1 x 1 0 1 ----------------- 1 0 1 1 0 0 0 0 1 0 1 1 multiplicand multiplier ------------------------ product 1 1 0 1 1 1 Rules (short cut): 1. A 1 digit in the multiplier implies a simple copy of the multiplicand. A 0 digit in the multiplier implies a shift left operation with all 0 s

Hexadecimal addition Add (59F) 16 and (E46) 16 1 1 Carry Carry 5 9 F F + 6 = (1) 10 = (16 x 1) + 5 = (15) 16 + E 4 6 5 + E = (19) 10 = (16 x 1) + 3 = (13) 16 --------- 1 3 E 5 Rules: 1. For adding individual digits of a Hexadecimal number, a mental addition of the decimal equivalent digits makes the process easier.. After adding up the decimal digits, you must convert the result back to Hexadecimal, as shown in the above example.

Octal Multiplication Multiply (76) 8 with (45) 8 Octal Octal Decimal Octal 7 6 5 x = (10) 10 = (8 x 1) + = 1 x 4 5 5 x 6 + 1 = (31) 10 = (8 x 3) + 7 = 37 -------------- 5 x 7 + 3 = (38) 10 = (8 x 4) + 6 = 46 4 6 7 4 x = (8) 10 = (8 x 1) + 0 = 10 3 7 1 0 4 x 6 + 1 = (5) 10 = (8 x 3) + 1 = 31 --------------- 4 x 7 + 3 = (31) 10 = (8 x 3) + 7 = 37 4 3 7 7 We use decimal representation for ease of calculation

Converting Decimal Integers to Binary Divide the decimal number by Repeat division until a quotient of 0 is received The sequence of remainders in reverse order constitute the binary conversion Example: (41) 10 = (101001) LSB MSB 41 Remainder = 1 0 0 10 10 5 Remainder = 0 Remainder = 0 5 Remainder = 1 Remainder = 0 1 1 Remainder = 1 0 Verify: 1 x 5 + 0 x 4 + 1 x 3 + 0 x + 0 x 1 + 1 x 0 = (41) 10

Decimal to binary conversion chart

Converting Decimal Integer to Octal Divide the decimal number by 8 Repeat division until a quotient of 0 is received The sequence of remainders in reverse order constitute the binary conversion Example: (153) 10 = (31) 8 LSB MSB 153 Remainder = 1 19 8 19 8 0 8 Remainder = 3 Remainder = Verify: x8 + 3 x 8 1 + 1 x 8 0 = (153) 10

Converting Decimal Fraction to Binary Multiply the decimal number by Repeat multiplication until a fraction value of 0.0 is reached or until the desired level of accuracy is reached The sequence of integers before the decimal point constitute the binary number Example: (0.6875) 10 = (0.1011) MSB LSB 0.6875 x = 1.3750 0.3750 x = 0.7500 0.7500 x = 1.5000 0.5000 x = 1.0000 0.0000 Verify: 1x -1 + 0 x - + 1 x -3 + 1 x -4 = (0.6875) 10

Converting Decimal Fraction to Octal Multiply the decimal number by 8 Repeat multiplication until a fraction value of 0.0 is reached or until the desired level of accuracy is reached The sequence of integers before the decimal point constitute the octal number Example: (0.513) 10 = (0.4065 ) 8 MSB LSB 0.513 x 8 = 4.104 0.104 x 8 = 0.83 0.83 x 8 = 6.656 0.656 x 8 = 5.48.... Verify: 4x8-1 + 0 x 8 - + 6 x 8-3 + 5 x 8-4 = (0.513) 10

Converting Integer & Fraction Q. How to convert a decimal number that has both integral and fractional parts? A. Convert each part separately, combine the two results with a point in between. Example: Consider the decimal -> octal examples in previous slides (153.513) 10 = (31.407) 8

Example Convert (11.650) 10 to binary? Steps: Split the number into integer and fraction Perform the conversions for the integer and fraction part separately Rejoin the results after the individual conversions

Example (cont.) 11 105 Remainder = 1 105 5 Remainder = 1 5 6 Remainder = 0 6 13 Remainder = 1 13 6 Remainder = 1 6 3 Remainder = 0 3 1 Remainder = 1 Integer part fraction part 0.650 0.500 0.5000 Combining the results gives us: (11.650) 10 = (11011011.101) 1.5 0.50 1.00 LSB MSB 1 Remainder = 1 0

Converting Binary to Octal Group 3 bits at a time Pad with 0s if needed Example: (11001.11) = (011 001.110) = (31.6) 8 3 1 6

Converting Binary to Hexadecimal Group 4 bits at a time Pad with 0s if needed Example: (11001.11) = (0001 1001.1100) = (19.C) 16 1 9 C

Converting between other bases Q. How to convert between bases other than decimal; e.g from base-4 to base-6? A. Two steps: 1. convert source base to decimal. convert decimal to destination base. Exercise: (13) 4 = (? ) 6?

Converting between other bases Q. How to convert between bases other than decimal; e.g from base-4 to base-6? A. Two steps: 1. convert source base to decimal. convert decimal to destination base. Exercise: (13) 4 = (? ) 6? Answer: (13) 4 = (11) 6

Converting Hexadecimal to Octal (special case) In this case, we can use binary as an intermediate step instead of decimal Example: (3A) 16 = (0011-1010) = (000-111-010) = (07) 8 0 added re-group by 3

Converting Octal to Hexadecimal (special case) In this case, we can use binary as an intermediate step instead of decimal Example: (7) 8 = (111-010) = (0011-1010) = (3A) 16 0s added re-group by 4

Conclusions When performing arithmetic operations in base-r, remember allowed digits {0,..r-1} To convert from decimal to base-r, divide by r for the integral part, multiply by r for the fractional part, then combine To convert from binary to octal (hexadecimal) group bits into 3 (4) To convert between bases other than decimal, first convert source base to decimal, then convert decimal to the destination base.