ECE2030 Introduction to Computer Engineering Lecture 2: Number System Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Tech.

Slides:



Advertisements
Similar presentations
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Advertisements

Agenda Shortcuts converting among numbering systems –Binary to Hex / Hex to Binary –Binary to Octal / Octal to Binary Signed and unsigned binary numbers.
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
ECE 331 – Digital System Design
ECE 301 – Digital Electronics Number Systems and Conversion, Binary Arithmetic, and Representation of Negative Numbers (Lecture #10) The slides included.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Complements: different approaches for representing negative numbers
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
CSE20 Lecture 3 Number Systems: Negative Numbers 1.Sign and Magnitude Representation 2.1’s Complement Representation 3.2’s Complement Representation 1.
Signed Numbers CS208. Signed Numbers Until now we've been concentrating on unsigned numbers. In real life we also need to be able represent signed numbers.
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
Introduction to Number Systems
COE 202: Digital Logic Design Number Systems Part 1
© 2010 Kettering University, All rights reserved..
Information Representation and Number Systems BIL- 223 Logic Circuit Design Ege University Department of Computer Engineering.
Number Systems Lecture 02.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
School of Computer Science G51CSA 1 Computer Arithmetic.
3. Representing Integer Data
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
Representing Integer Data Book : Chapter ( Subject has no point !! ) A99ACF.
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Number Systems. Why binary numbers? Digital systems process information in binary form. That is using 0s and 1s (LOW and HIGH, 0v and 5v). Digital designer.
CSE 241 Computer Organization Lecture # 9 Ch. 4 Computer Arithmetic Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
Calculating Two’s Complement. The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of.
1 Digital Design: Number Systems Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals of Logic.
46 Number Systems Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs Display: Seven segment displays Inputs: Switches.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
ECE 331 – Digital System Design
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
Positional Number Systems
1 IT 231, CMPE 331 Digital Logic Design Week 2 Number systems and arithmetic.
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Operations on Bits Arithmetic Operations Logic Operations
Microcomputers I - Electrical and Computer Engineering Dept. at Kettering.
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
Number Systems and Logic Prepared by Dr P Marais (Modified by D Burford)
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
1 Review on Number Systems Decimal, Binary, and Hexadecimal.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
07/12/ Data Representation Two’s Complement & Binary Arithmetic.
Addition and Substraction
69 Decimal (Base 10) Numbers n Positional system - each digit position has a value n 2534 = 2*1, * *10 + 4*1 n Alternate view: Digit position.
Introduction * Binary numbers are represented with a separate sign bit along with the magnitude. * For example, in an 8-bit binary number, the MSB is.
DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck.
IT1004: Data Representation and Organization Negative number representation.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic Herbert G. Mayer, PSU Status 1/14/2016 Copied with Permission from prof. Mark PSU ECE.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative The same is true for binary numbers a computer.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.
Computer Organization 1 Data Representation Negative Integers.
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
Lecture 4: Digital Systems & Binary Numbers (4)
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
David Kauchak CS 52 – Spring 2017
CSE 102 Introduction to Computer Engineering
Unit 18: Computational Thinking
CPS120: Introduction to Computer Science
Decimal and binary representation systems
Presentation transcript:

ECE2030 Introduction to Computer Engineering Lecture 2: Number System Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Tech

2 2 Decimal Number Representation Example: (base-10, used by Homo Sapien) = = 9* * * * *10 0 How did we get it?

3 3 Generic Number Representation = 9* * * * *10 0 A 4 A 3 A 2 A 1 A 0 for base-10 (or radix-10) = A 4 * A 3 * A 2 * A 1 * A 0 *10 0 (A is coefficient; b is base) N bGeneralize for a given number N w/ base-b N N = A n-1 A n-2 … A 1 A 0 N N = A n-1 *b n-1 + A n-2 *b n-2 + … + A 2 *b 2 + A 0 *b 0 **Note that A < b

4 4 b Counting numbers with base-b Base … How about Base …

5 5 2 How about base

7 7 0 = 0 1 = 1 10 = 2 11 = = = = = = = = = = = = = 15 Binary = Decimal

8 8 Derive Numbers in Base-2 Decimal (base-10) –(25) 10 Binary (base-2) –(11001) 2 Exercise

9 9 Base-2 Decimal (base-10) –(982) 10 Binary (base-2) –( ) 2 Exercise

10 Base 8 Decimal (base-10) –(982) 10 Octal (base-8) –(1726) 8 Exercise

11 Base 16 Decimal (base-10) –(982) 10 Hexadecimal (base-16) Hey, what do we do when we count to 10?? abcdef

12 Base 16 (982) 10 = (3d6) 16 (3d6) 16 can be written as ( ) 2 We use Base-16 (or Hex) a lot in computer world 0xfe8a7d20 ( 0x ) –Ex: A 32-bit address can be written as 0xfe8a7d20 ( 0x is an abbreviation of Hex) –Or in binary form 1111_1110_1000_1010_0111_1101_0010_0000

13 Number Examples with Different Bases Decimal (base-10) –(982) 10 Binary (base-2) –( ) 2 Octal (base-8) –(1726) 8 Hexadecimal (base-16) –(3d6) 16 Others examples: –base-9 = (1321) 9 –base-11 = (813) 11 –base-17 = (36d) 17

14 Convert between different bases Convert a number base-x to base-y, e.g. ( ) 2 to (?) 6 –First, convert from base-x to base-10 if x  10 –Then convert from base-10 to base-y = 0        2 0 =  ( ) 2 = (103) 6

Base-b Addition

16 Negative Number Representation Options –Sign-magnitude –One’s Complement –Two’s Complement (we use this in this course)

17 Sign-magnitude Use the most significant bit (MSB) to indicate the sign –01 –0: positive, 1: negative Problem –Representing zeros? –Do not work in computation We will NOT use it in this course !

18 One ’ s Complement Complement (flip) each bit in a binary number Problem –Representing zeros? –Do not always work in computation Ex: = 000  Incorrect ! We will NOT use it in this course !

19 Two ’ s Complement Complement adding 1Complement (flip) each bit in a binary number and adding 1, with overflow ignored Work in computation perfectly We will use it in this course ! One’s complement Add One’s complement Add 1 3

20 Two ’ s Complement Complement adding 1Complement (flip) each bit in a binary number and adding 1, with overflow ignored Work in computation perfectly We will use it in this course ! ?? One’s complement 100 Add 1 The same 100 represents both 4 and -4 which is no good

21 Two ’ s Complement Complement adding 1Complement (flip) each bit in a binary number and adding 1, with overflow ignored Work in computation perfectly We will use it in this course ! One’s complement 100 Add 1 MSB = 1 for negative Number, thus 100 represents -4

22 Range of Numbers An N-bit number –Unsigned: 0.. (2 N -1) –Signed: -2 N-1.. (2 N-1 -1) Example: 4-bit 1110 (-8) 0111 (7) Signed numbers 0000 (0) 1111 (15) Unsigned numbers

23 Binary Computation (17=16+1) (11=8+2+1) (28=16+8+4) Unsigned arithmetic (17=16+1) (43= ) (60= ) Signed arithmetic (w/ 2’s complement) (17=16+1) (-21: 2’s complement=010101=21) (2’s complement=000100=4, i.e. -4)

24 Binary Computation Unsigned arithmetic (47) (31) (78?? Due to overflow, note that 62 cannot be represented by a 6-bit unsigned number) The carry is discarded Signed arithmetic (w/ 2’s complement) (-17 since 2’s complement=010001) (31) (14) The carry is discarded

BACKUP

26 Application of Two ’ s Complement Pocket Calculator subtractionThe first Pocket Calculator “ Curta ” used Two ’ s complement method for subtraction First complement the subtrahend –Fill the left digits to be the same length of the minuend –Complemented number = (9 – digit) 4 ’ s complement = 5 7 ’ s complement = 2 0 ’ s complement = 9 Add 1 to the complemented number Perform an addition with the minuend

27 Examples 13 – 7 –Two’s complement of 07 = = 93 – = 06 (ignore the leftmost carry digit) 817 – 123 –Two’s complement of 123 = = 877 – = 694 (ignore the leftmost carry digit) – 4982 – Two’s complement of = = – = (ignore the leftmost carry digit)