Chapter 6: Computer Arithmetic

Slides:



Advertisements
Similar presentations
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Advertisements

Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
Integer Arithmetic Floating Point Representation Floating Point Arithmetic Topics.
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
Number Systems Computer Science 210 Computer Organization.
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
Simple Data Type Representation and conversion of numbers
Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
Data Representation and Computer Arithmetic
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Figure 1.1 Block diagram of a digital computer. Functional Units.
Introduction to Computing Dr. Nadeem A Khan. Lecture 10.
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.
Integer & Floating Point Representations CDA 3101 Discussion Session 05.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
Computing Machinery Chapter 6: Computer Arithmetic.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CE-321: Computer.
Integer Operations Computer Organization and Assembly Language: Module 5.
Chapter 8 Computer Arithmetic. 8.1 Unsigned Notation Non-negative notation  It treats every number as either zero or a positive value  Range: 0 to 2.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
Negative Number Sign-Magnitude: left-most bit as the sign bit –16 bits –Example: 4-bit numbers is given by is given by ’s complement:
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
Floating Point Representations
CS2100 Computer Organisation
Computer Science 210 Computer Organization
Array multiplier TU/e Processor Design 5Z032.
Introduction to Computing
Integer Real Numbers Character Boolean Memory Address CPU Data Types
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Computer Science 210 Computer Organization
Data Representation in Computer Systems
CSE 102 Introduction to Computer Engineering
Number Systems.
William Stallings Computer Organization and Architecture 7th Edition
CS1010 Programming Methodology
Computer Organization and ASSEMBLY LANGUAGE
Computer Science 210 Computer Organization
Number Representations
BCD = Binary Coded Decimal
Data Representation in Computer Systems
Arithmetic Logical Unit
Computer Science 210 Computer Organization
ECEG-3202 Computer Architecture and Organization
Chapter 8 Computer Arithmetic
Number Representations
Presentation transcript:

Chapter 6: Computer Arithmetic Computing Machinery Chapter 6: Computer Arithmetic

Integer Representations 0000000000000000000000000000000 = +0 0000000000000000000000000000001 = +1 0000000000000000000000000000010 = +2 : 0111111111111111111111111111111 = +2,147,483,647 1000000000000000000000000000000 = -0 1000000000000000000000000000001 = -1 1000000000000000000000000000010 = -2 1111111111111111111111111111111 = -2,147,483,647

Magnitudes of Binary Encoded Base Positions

Two's Complement Example: -34 in two's complement 1. Generate the magnitude of the value in binary 2. Invert each bit of the binary number (0 becomes 1 and 1 becomes 0), called 1's complement 3. Add one (1) to the one's complement to produce the two's complement. (Ignore any overflow.) Example: -34 in two's complement 34/2 = 17 remainder 0 _ _ _ _ _ _ _ 0 17/2 = 8 remainder 1 _ _ _ _ _ _ 1 0 8/2 = 4 remainder 0 _ _ _ _ _ 0 1 0 4/2 = 2 remainder 0 _ _ _ _ 0 0 1 0 2/2 = 1 remainder 0 _ _ _ 0 0 0 1 0 1/2 = 0 remainder 1 _ _ 1 0 0 0 1 0 0/2 = 0 remainder 0 _ 0 1 0 0 0 1 0 0/2 = 0 remainder 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 <- magnitude of -34 1 1 0 1 1 1 0 1 <- one's complement + 1 1 1 0 1 1 1 1 0 <- two's complement

Converting Between Binary, Octal, and Hexadecimal binary octal hexadecimal decimal 0000 0 0 0 0001 1 1 1 0010 2 2 2 0011 3 3 3 0100 4 4 4 0101 5 5 5 0110 6 6 6 0111 7 7 7 1000 10 8 8 1001 11 9 9 1010 12 A 10 1011 13 B 11 1100 14 C 12 1101 15 D 13 1110 16 E 14 1111 17 F 15 01001100100111011111 01 001 100 100 111 011 111 1 1 4 4 7 3 7 0100 1100 1001 1101 1111 4 C 9 D F

Integer Addition and Subtraction

Finite Represenation in Two's Complement

IEEE Single-Precision Floating Point

IEEE Representation of p

IEEE Special Values

Integer Multiplication (Unsigned)

Integer Multiplication Hardware

Integer Multiplication (signed) Booth's Recoding Booth's recoding reduces the number of computations, which reduces the amount of hardware and time required to perform a multiplication standard

Booth's Multiplication 3 0011 M -M = 1101 x7 0111 Q A Q Q-1 N 0 0 0 0 0 1 1 1 0 4 +1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 3 1 1 1 1 0 1 0 1 1 2 1 1 1 1 1 0 1 0 1 1 +0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 00010101 = 21

Integer Division with remainder rebuilding the dividend, Q recurrence relation for bitwise integer division

Integer Division (restoring)

Integer Division (non-restoring) reformulating the recurrence relation restoring test can be done once at the end of the division

Booth's Integer Division

IEEE Floating-Point Multiplication

POWER2 Floating-Point Unit (FPU) Architecture The IBM POWER2 Floating-Point Unit is a hardware implementation of arithmetic operations on IEEE format floating-point numbers. "The FPU receives two instructions from the instruction cache unit (ICU). These two instructions go through a predecode stage where the FPU discards non-floating-point instructions. The MAF unit performs all of the floating-point arithmetic instructions, such as the multiply-add fused operation, as well as all floating-point store operations." http://www-03.ibm.com/servers/eserver/pseries/hardware/whitepapers/power/fpu.html

FPU Arithmetic Unit http://www-03.ibm.com/servers/eserver/pseries/hardware/whitepapers/power/fpu.html