CPE 201 Digital Design Lecture 2: Digital Systems & Binary Numbers (2)

Slides:



Advertisements
Similar presentations
DATA REPRESENTATION CONVERSION.
Advertisements

CS 151 Digital Systems Design Lecture 3 More Number Systems.
CS 151 Digital Systems Design Lecture 2 Number Systems Prof. Ahmed Sameh Room 239A.
ENGIN112 L2: Number Systems September 5, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 2 Number Systems Russell Tessier KEB 309 G.
1 Number Systems. 2 Numbers Each number system is associated with a base or radix – The decimal number system is said to be of base or radix 10 A number.
Number Systems and Arithmetic
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
Numbering systems.
Data Representation – Binary Numbers
Based on slides by:Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. ECE/CS 352: Digital System Fundamentals Lecture 1 – Number Systems and.
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Chapter 3 Data Representation
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
مدار منطقي مظفر بگ محمدي Course Structure & Grading Homework: 25% Midterm: 30% Final:50% There is 5% extra! ( =105!) Textbook:
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
IT101: INFORMATION TECHNOLOGY FUNDAMENTALS 1 Edited By Dr. Ahmed Abo-Bakr Information Technology Dept. Faculty of Computers & Information.
Number systems, Operations, and Codes
Numbering System Base Conversion. Number systems Decimal – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binary – 0, 1 Octal – 0, 1, 2, 3, 4, 5, 6, 7 Hexadecimal system.
Digital Logic Lecture 2 Number Systems
Number Base Conversions
Positional Number Systems Decimal, Binary, Octal and Hexadecimal Numbers Wakerly Section
Chapter 1  Number Systems Decimal System Binary System Octal System Hexadecimal System  Binary weighted cods Signed number binary order  1’s and 2’s.
AEEE2031 Data Representation and Numbering Systems.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
Introduction To Number Systems Binary System M. AL-Towaileb1.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
Computer Number System
Chapter 1 Number Systems Digital Electronics. Topics discussed in last lecture Digital systems Advantages of using digital signals over analog. Disadvantages.
CPEN Digital Logic Design Binary Systems Spring 2004 C. Gerousis © Digital Design 3 rd Ed., Mano Prentice Hall.
1. Number Systems. Common Number Systems SystemBaseSymbols Used by humans? Used in computers? Decimal100, 1, … 9YesNo Binary20, 1NoYes Octal80, 1, … 7No.
ECE DIGITAL LOGIC LECTURE 2: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/14/2016.
CS151 Introduction to Digital Design Chapter 1: Digital Systems and Information Lecture 2 1Created by: Ms.Amany AlSaleh.
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.
Digital logic COMP214  Lecture 2 Dr. Sarah M.Eljack Chapter 1 1.
Week 1(Number System) Muhammad Ammad uddin Logic Design Lab I (CEN211)
Introduction to signals The signals are broadly classified into two categories: 1. Analog Signals. 2. Digital signals.
CS2100 Computer Organisation
Introduction To Number Systems
Positional Number Systems Decimal, Binary, Octal and Hexadecimal Numbers Wakerly Section
Octal to Decimal Decimal Octal Binary Hexadecimal.
1. Number Systems.
NUMBER SYSTEM Prepared by: Engr Zakria.
Number System.
Digital Systems and Number Systems
CHAPTER 1 : INTRODUCTION
Number Systems.
COMPUTING FUNDAMENTALS
ITE102 – Computer Programming (C++)
Chapter 3 Data Representation
Number System conversions
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
Chapter 1 Number Systems & Conversions
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS
Overview Digital Systems and Computer Systems
Data Representation in Computer Systems
Numbering System TODAY AND TOMORROW 11th Edition
Numbering Systems and Arithmetic operations on Hex, binary, and octal
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
Chapter 2: Number Systems
Digital Logic Design (CSNB163)
Number Systems.
Number Systems created by: S.Shahrukh haider
Binary to Decimal Conversion
Introduction To Number Systems
COE 202: Digital Logic Design Number Systems Part 2
1. Number Systems Chapt. 2.
Dr. Clincy Professor of CS
Presentation transcript:

CPE 201 Digital Design Lecture 2: Digital Systems & Binary Numbers (2)

2 Lecture Outline Number representations Conversions between bases

3 Number Base Representations Positional Number Systems –Traditional way to represent numbers Number represented as –String of digits –Each digit position has an associated weight Base r system –Coefficients are multiplied by powers of r a n a n-1 … a 0.a -1 a -2 … a -m = r n a n + r n-1 a n-1 + …+ r 2 a 2 + r 1 a 1 + a r -1 a -1 + r -2 a -2 +…+ r -(m-1) a -(m-1) + r -m a -m

4 Number Base Representations Decimal system –Base, or radix 10  power of 10 –10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 In general: a 5 a 4 a 3 a 2 a 1 a 0.a -1 a -2 a -3 = 10 5 a a a a a a a a a -3 E.g.: Decimal 1734 = = 1 * * * * * * * * 0.01

5 Number Base Representations Binary system –Base 2  power of 2 –2 digits only: 0, 1 b 5 b 4 b 3 b 2 b 1 b 0.b -1 b -2 b -3 = 2 5 b b b b b b b b b -3 Most significant bit (MSB) Least significant bit (LSB)

6 Binary Example ( ) 2 = 1 * * * * * * 2 -3 How much in decimal? = 1 * /8 = = Conversion from binary to decimal: add the coefficients multiplied by the powers

7 Number Base Representations Octal –8 digits: 0, 1, 2, 3, 4, 5, 6, 7 Hexadecimal –16 digits: 0, 1, …, 9, A (10), B (11), C (12), D (13), E(14), F(15) E.g.: (436.5) 8 = 4 * * * 8 -1 = ( ) 10 (1CE8) 16 = 1 * * * = (7400) 10

8 Powers of 2 Very useful in digital design Common names: 2 10 – Kilo (K) 2 20 – Mega (M) 2 30 – Giga (G) 2 40 – Tera (T) Used for computer capacity n2n2n

9 Let’s Count DecimalBinary (base 2)Octal (base 8)Hexa (base 16) A B C D E F

10 Subtraction Method for Converting Decimal to Binary Goal –Converting from Decimal to Binary Idea –Put 1s in positions such that the binary weights add up to the decimal quantity –Work from left to right –Right to left – may fill in 1s that shouldn’t be there – try it. Easy for small numbers Desired decimal number: =32 too much =16 too much 1 a =8 ok, keep going =8+4=12 DONE answer

11 Subtraction Method for Converting Decimal to Binary Variant of previous method –Useful for big numbers Idea: –Subtract a selected binary weight from the quantity to be converted –With the remaining quantity, we start subtracting again (from the present binary position) –Stop when remaining quantity is 0 Remaining quantity: is too much is too much 1 a – 8 = =0 DONE answer

12 Subtraction Method Example Convert the number “23” from decimal to binary Remaining quantityBinary Number Done! 23 in decimal is in binary is more than 7, can’t use

13 Decimal To Binary Conversion (Integer) 1.Divide the number by 2  quotient + remainder 2.Divide all successive quotients by 2 and record the remainders 3.Take the remainders in inverse order (end to beginning)  binary number E.g.: 179  2 = 89 remainder 1  2 = 44 remainder 1  2 = 22 remainder 0  2 = 11 remainder 0  2 = 5 remainder 1  2 = 2 remainder 1  2 = 1 remainder 0  2 = 0 remainder 1 LSB MSB Result:

14 Decimal To Binary Conversion (Radix Point) 1.Multiply the number by 2  integer and fraction 2.Multiply the successive fractions by 2 and record the integer values 3.When the fraction becomes 0, take the integers in order (beginning to end)  binary number E.g.:  2 = Integer 1 fraction  2 = integer 0 fraction  2 = integer 1 fraction  2 = integer 1 fraction 0 LSB Result: (0.1011) 2 MSB

15 Decimal to Octal/Hexa Conversion Same as decimal to binary, only division by 8, respectively 16 E.g. : 467  8 = E.g. : 3417  16 = 58 remainder 3  8 = 7 remainder 2  8 = 0 remainder remainder 9  16 = 13 remainder 5  16 = 0 remainder 13 LSB MSB Result: (723) 8 LSB MSB Result: (D59) 16

16 Decimal to Octal – Radix Point Use multiplication method, by 8 E.g.: (0.513) 10  8 = Integer 4 fraction  8 = integer 0 fraction  8 = integer 6 fraction  8 = integer 5 fraction LSB Result: ( ) 8 MSB  8 = integer 1 fraction  8 = integer 7 fraction Could continue, but we stop when reaching desired floating point accuracy

17 Range of Representable Numbers How many numbers can we represent with n bits? 2 n numbers, in range 0 to 2 n -1 General base case: with n digits in base r r n numbers, in range 0 to r n - 1 E.g. : with 3 digits in base 10 –Can have : 10 3 = 1000 numbers

18 Binary, Octal, Hexa - Conversions Binary, Octal & Hexa have an interesting relation 2 3 = = 16 Each octal digit corresponds to 3 binary digits Each hexa digit corresponds to 4 binary digits

19 Binary-Octal Conversion Partition the binary number into groups of three digits each, starting from the binary point, going right and left E.g. ( ) 2 = = ( ) 8

20 Binary-Hexa Conversion Partition the binary number into groups of four digits each, starting from the binary point, going right and left E.g. ( ) 2 = D5F06. = (5D9.F06)

21 Octal(Hexa)-Binary Conversion Octal: substitute each digit with its 3-digit binary equivalent E.g. (1234) 8 = Hexa: substitute each digit with its 4-digit binary equivalent E.g. (C0DE) 16 =

22 Advantages of Hexa Representation Hexadecimal numbers can represent binary information more compactly Hexa requires a quarter of the digits needed in binary Four binary digits = one hexa digit

23 Summary of Conversions Decimal to (binary, octal, hexa) –Division by (or multiplication with) 2, 8, 16 respectively Binary to: –Octal: substitute groups of 3 digits –Hexa: substitute groups of 4 digits –Decimal: sum up coefficients * powers of 2 Octal to: –Binary: substitute digits with 3-digit binary Hexa to: –Binary: substitute digits with 4-digit binary Octal to hexa: –Convert to binary, then to the other base

24 Operations with Binary Numbers Addition –Similar technique as decimal Carry: More examples: – ( ) – ( ) – ( )

25 Operations with Binary Numbers Multiplication –Similar technique as decimal **

26 Operations with Binary Numbers Subtraction Usual arithmetic: –Check the signs of operands –If the same sign, perform addition, keep the sign –If different sign, check which operand is bigger, subtract from it, and keep the sign of the bigger operand These computations are hard to perform by a digital circuit

27 Readings Chapter 1: –Sections