Computer Organization & Programming Chapter2 Number Representation and Logic Operations.

Slides:



Advertisements
Similar presentations
Arithmetic & Logic Unit Does the calculations Everything else in the computer is there to service this unit Handles integers May handle floating point.
Advertisements

CS 151 Digital Systems Design Lecture 3 More Number Systems.
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
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.
Number Systems Computer Science 210 Computer Organization.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
Binary Representation - Shortcuts n Negation x + x = 1111…1111 two = -1 (in 2’s complement) Therefore, -x = x + 1 n Sign Extension o Positive numbers :
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
Conversion Between Lengths Positive number pack with leading zeros +18 = = Negative numbers pack with leading ones -18 =
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Computer Architecture
Dale & Lewis Chapter 3 Data Representation. Data and computers Everything inside a computer is stored as patterns of 0s and 1s Numbers, text, audio, video,
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
Complement Numbers. Outline  Negative Numbers Representation  Sign-and-magnitude  1s Complement  2s Complement  Comparison of Sign-and-Magnitude.
+ CS 325: CS Hardware and Software Organization and Architecture Integers and Arithmetic Part 2.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 20, 2004 Lecture Number: 23.
Positional Number Systems
Number Representation
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
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.
Ch3a- 2 EE/CS/CPE Computer Organization  Seattle Pacific University Crunching Numbers Topics we need to explore Representing numbers on a computer.
Digital Representations ME 4611 Binary Representation Only two states (0 and 1) Easy to implement electronically %0= (0) 10 %1= (1) 10 %10= (2) 10 %11=
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
CPS3340 Computer Architecture Fall Semester, 2013
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Slide 1 of 14.
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Fri, Aug 28 CEC 220 Digital Circuit Design Slide 1 of 14.
IT1004: Data Representation and Organization Negative number representation.
Integers’ Representation. Binary Addition. Two's Complement. Unsigned number representation Binary Addition, Subtraction. Overflow of unsigned numbers.
1 COMS 161 Introduction to Computing Title: Computing Basics Date: September 8, 2004 Lecture Number: 7.
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.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
Integer Operations Computer Organization and Assembly Language: Module 5.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
{ Binary “There are 10 types of people in the world: Those who understand binary, and those who don't.”
1 Integer Representations V1.0 (22/10/2005). 2 Integer Representations  Unsigned integer  Signed integer  Sign and magnitude  Complements  One’s.
Lecture 4: Digital Systems & Binary Numbers (4)
Binary & Hex Review.
Design of Digital Circuits Reading: Binary Numbers
David Kauchak CS 52 – Spring 2017
Computer Architecture & Operations I
Addition and Subtraction
CHAPTER 9 COMPUTER ARITHMETIC - ALU
Negative Binary Numbers
Integers’ Representation. Binary Addition. Two's Complement.
Computer Science 210 Computer Organization
Section 2: Integer & Floating Point Numbers
Computer Architecture & Operations I
Negative Binary Numbers
CSE 102 Introduction to Computer Engineering
Addition and Substraction
Computer Organization and ASSEMBLY LANGUAGE
Computer Science 210 Computer Organization
ECEG-3202 Computer Architecture and Organization
Digital Systems Section 12 Binary Adders. Digital Systems Section 12 Binary Adders.
Unit 18: Computational Thinking
CPS120: Introduction to Computer Science
Chapter 8 Computer Arithmetic
CSC 220: Computer Organization Signed Number Representation
Binary & Hex Review.
Two’s Complement & Binary Arithmetic
Presentation transcript:

Computer Organization & Programming Chapter2 Number Representation and Logic Operations

Unsigned Integers Range of values is: 0 10 : ,294,967, : What if we add 4,294,967,295+1? we get 0! (and an overflow)

Unsigned Binary Addition Use the same algorithm we use for decimal addition: Carry

What about negative integers Option: use one of the 32 bits as a sign bit. Both lead to 2 representations for the value 0 (+0 and –0). could cause problems for programmers

Alternative representation Most computers don’t use a sign and magnitude representation for signed integers. Signed numbers are represented using 2s complement representation simplifies the hardware – the same circuit that adds unsigned integers can be used to add signed integers!

2s complement Leading zeros: the integer is positive Leading ones: the integer is negative positive 8 bit integersnegative 8 bit integers

8 bit 2s complement positive numbers negative numbers zero: More negative numbers than positive! single representation for zero

8 bit signed addition Carry Base 10 The algorithm is the same!

addition algorithm How can we tell when too many bits in the result means overflow and when it’s OK? overflow means the right answer won’t fit ! If the sign of the numbers being added are the same: too many bits means overflow otherwise everything may be OK (ignore the last bit).

Overflow and 8 bit addition It fits, but it’s still overflow! ??