Chapter 4 Integer Data Representation. Unsigned Integers.

Slides:



Advertisements
Similar presentations
Fixed Point Numbers The binary integer arithmetic you are used to is known by the more general term of Fixed Point arithmetic. Fixed Point means that we.
Advertisements

Lab 10 : Arithmetic Systems : Adder System Layout: Slide #2 Slide #3 Slide #4 Slide #5 Arithmetic Overflow: 2’s Complement Conversions: 8 Bit Adder/Subtractor.
HEXADECIMAL NUMBERS Code
COE 202: Digital Logic Design Signed Numbers
ECE 331 – Digital System Design
CHAPTER 4: Representing Integer Data The Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition, Irv Englander.
Fixed-Point Arithmetics: Part I
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
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.
Binary numbers and arithmetic. ADDITION Addition (decimal)
The Binary Number System
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
Arithmetic for Computers
Simple Data Type Representation and conversion of numbers
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
Computer Arithmetic Nizamettin AYDIN
Chapter 7 Arithmetic Operations and Circuits Binary Arithmetic Addition –When the sum exceeds 1, carry a 1 over to the next-more-significant column.
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.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 22, 2004 Lecture Number: 24.
Computer Architecture
Complement Numbers. Outline  Negative Numbers Representation  Sign-and-magnitude  1s Complement  2s Complement  Comparison of Sign-and-Magnitude.
CPS120: Introduction to Computer Science Computer Math: Signed Numbers.
9.4 FLOATING-POINT REPRESENTATION
Summer 2012ETE Digital Electronics1 Binary Arithmetic of Signed Binary Numbers.
Topic 1 – Number Systems. What is a Number System? A number system consists of an ordered set of symbols (digits) with relations defined for addition,
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Operations on Bits Arithmetic Operations Logic Operations
Floating Point Arithmetic
Computer Math CPS120: Lecture 3. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits have 0 or.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
By Jariya Phongsai A two's-complement system is a system in which negative numbers are represented by the two's complement of the absolute value; this.
Integer and Fixed Point P & H: Chapter 3
ECE 301 – Digital Electronics Representation of Negative Numbers, Binary Arithmetic of Negative Numbers, and Binary Codes (Lecture #11) The slides included.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
Ch3a- 2 EE/CS/CPE Computer Organization  Seattle Pacific University Crunching Numbers Topics we need to explore Representing numbers on a computer.
MIPS ALU. Building from the adder to ALU ALU – Arithmetic Logic Unit, does the major calculations in the computer, including – Add – And – Or – Sub –
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
CPS3340 Computer Architecture Fall Semester, 2013
Representing Integer Data
IT1004: Data Representation and Organization Negative number representation.
1 Fundamentals of Computer Science Combinational Circuits.
Integers’ Representation. Binary Addition. Two's Complement. Unsigned number representation Binary Addition, Subtraction. Overflow of unsigned numbers.
Negative Integers Unsigned binary representation can not be used to represent negative numbers. With paper and pencil arithmetic, a number is made negative.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.
MIPS ALU. Exercise – Design a selector? I need a circuit that takes two input bits, a and b, and a selector bit s. The function is that if s=0, f=a. if.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
{ Binary “There are 10 types of people in the world: Those who understand binary, and those who don't.”
Computer Math CPS120 Introduction to Computer Science Lecture 7.
Computer Engineering page 1 Integer arithmetic Depends what you mean by “integer”. Assume at 3-bit string. –Then we define: zero = 000 one = 001 Use zero,
1 Integer Representations V1.0 (22/10/2005). 2 Integer Representations  Unsigned integer  Signed integer  Sign and magnitude  Complements  One’s.
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)
CHAPTER 5: Representing Numerical Data
Computer Architecture & Operations I
Data Representation in Computer Systems
Computer Architecture & Operations I
CHAPTER 4: Representing Integer Data
Exercise: Add these two single precision IEEE 754 numbers: … …0 Left number: 1.101x24 Right number: 1.011x 22= x24.
MIPS ALU.
COMP3221: Microprocessors and Embedded Systems
The University of Adelaide, School of Computer Science
MIPS ALU.
Integer arithmetic Depends what you mean by "integer"
COMS 361 Computer Organization
Presentation transcript:

Chapter 4 Integer Data Representation

Unsigned Integers

Range of Values l 1 Byte: l 2 Bytes:0-65,535 l 4 Bytes:4,294,967,295 l 8 Bytes:

Implementation l Generally, built-in machine instructions exist for manipulating and calculating single-precision (32 bit) or double precision (64 bit) integers l If not, software procedures may exist to handle multiple storage locations for integers

Signed Integers l Signed-Magnitude l 1’s Complement l 2’s Complement NOTE: Only latter is typically implemented due to serious limitations of others.

Signed-Magnitude l Choose a single bit to represent the sign - usually most significant bit l 0 => + and 1=>negative l Maximum absolute value is (assuming 32 bit representation)  2,147,483,647

Problems l In arithmetic operations, must test signs of both operands to determine process l Two zeroes exist:  0 Thus, comparison of 0s becomes an issue

Complements Representation The sign of the number is a natural result of the arithmetic operations, and therefore the sign does not have to be handled separately. Calculations are consistent for all different signed combinations of the operands.

1’s Complement l Numbers whose binary representation begins with a 0 are considered positive and those that begin with a 1 are negative l To get the negative representation of a positive number, one takes the complement of the number

1’s Complement 8-bit representation

Observations l Range of number values is split in the middle l Even numbers begin with 0 and positive numbers with 1 l To add numbers, regardless of sign, one just does a regular addition (wraparound) l Suppose a negative and positive number are added. End-around carry may result. l Overflow can occur

Basis for 1’s Complement Subtracting a value from some standard base value is known as taking the complement. In binary representation for 8-bits, say, we would subtract a positive number from in order to derive its negative representation. Example -58: ======== NOTE: The negative is just the inversion of the positive number.

1’s Complement Addition =====================   end-around ======== carry == ======== => overflow => result exceeded range of values

1s Complement Testing for Overflow If both operands have the same sign and the sign of the result is different, then overflow has occurred. NOTE: Some early interpreted versions of Pascal limited word size to 16 bits. When the interpreter was subsequently executed on 32-bit machines, overflow was not detected.

1’s Complement Problems Addition may require end-around carry. Two zeroes exist:  0 Thus, comparison of 0’s becomes an issue

2’s Complement Representation

Basis for 2’s Complement The modulus in 2’s complement is a 1 followed by a string of 0’s. In binary representation for 8-bits, say, we would subtract a positive number from in order to derive its negative representation. Example -58: ======== NOTE: The negative representation is just the inversion of the positive number plus 1.

2’s Complement Addition =====================  ignore carry bit == ======== => overflow => result exceeded range of values

2s Complement Testing for Overflow An overflow has occurred if when the result overflows into the sign bit. Thus overflow can be detected if the sign of the result is opposite that of both operands. A carry-out bit is ignored.