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.

Slides:



Advertisements
Similar presentations
Arithmetic in Computers Chapter 4 Arithmetic in Computers2 Outline Data representation integers Unsigned integers Signed integers Floating-points.
Advertisements

HEXADECIMAL NUMBERS Code
Binary Arithmetic Binary addition Binary subtraction
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
Assembly Language and Computer Architecture Using C++ and Java
1 Lecture 8: Binary Multiplication & Division Today’s topics:  Addition/Subtraction  Multiplication  Division Reminder: get started early on assignment.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 8 Computer Arithmetic.
COE 308: Computer Architecture (T041) Dr. Marwan Abu-Amara Integer & Floating-Point Arithmetic (Appendix A, Computer Architecture: A Quantitative Approach,
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
Computer Arithmetic Integers: signed / unsigned (can overflow) Fixed point (can overflow) Floating point (can overflow, underflow) (Boolean / Character)
3-1 Chapter 3 - Arithmetic Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Data Representation – Binary Numbers
Computer Organization and Architecture Computer Arithmetic Chapter 9.
Computer Arithmetic Nizamettin AYDIN
Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.
Computer Architecture Lecture 3: Logical circuits, computer arithmetics Piotr Bilski.
3-1 Chapter 3 - Arithmetic Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer Architecture.
Computer Arithmetic.
Chapter 8 Problems Prof. Sin-Min Lee Department of Mathematics and Computer Science.
07/19/2005 Arithmetic / Logic Unit – ALU Design Presentation F CSE : Introduction to Computer Architecture Slides by Gojko Babić.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
Multiplication of signed-operands
Digital Kommunikationselektronik TNE027 Lecture 2 1 FA x n –1 c n c n1- y n1– s n1– FA x 1 c 2 y 1 s 1 c 1 x 0 y 0 s 0 c 0 MSB positionLSB position Ripple-Carry.
L/O/G/O CPU Arithmetic Chapter 7 CS.216 Computer Architecture and Organization.
Figure 1.1 Block diagram of a digital computer. Functional Units.
Computer Arithmetic and the Arithmetic Unit Lesson 2 - Ioan Despi.
1 Binary Coded Decimal Presented By Chung Wai Chow.
Computer Arithmetic II Instructor: Mozafar Bag-Mohammadi Ilam University.
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Operations on Bits Arithmetic Operations Logic Operations
Conversion to Larger Number of Bits Ex: Immediate Field (signed 16 bit) to 32 bit Positive numbers have implied 0’s to the left. So, put 16 bit number.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Computer Arithmetic See Stallings Chapter 9 Sep 10, 2009
Chapter 3 Arithmetic for Computers. Chapter 3 — Arithmetic for Computers — 2 Arithmetic for Computers Operations on integers Addition and subtraction.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
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.
Computer Architecture Lecture 11 Arithmetic Ralph Grishman Oct NYU.
COMPUTER ARITHMETIC Arithmetic with Signed-2's Complement Numbers
Integer Operations Computer Organization and Assembly Language: Module 5.
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
More Binary Arithmetic - Multiplication
COMPUTER ARITHMETIC Arithmetic with Signed-2's Complement Numbers
Array multiplier TU/e Processor Design 5Z032.
Integer Division.
Lecture 9: Floating Point
William Stallings Computer Organization and Architecture 7th Edition
CSCE 350 Computer Architecture
Computer Organization and Design
ECEG-3202 Computer Architecture and Organization
Chapter 8 Computer Arithmetic
Chapter 6: Computer Arithmetic
Chapter3 Fixed Point Representation
Presentation transcript:

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 n -1 Unsigned Two ’ s Complement  Negative numbers have a 1 as the most significant bit and positive number (or zero) have 0 as the leading bit.  Range: -2 n-1 -1 to 2 n-1 -1 Refer to Table 8.1

8.1 Unsigned Notation(continued) Addition and Subtraction(Figure 8.1)

Figure 8.1

8.1 Unsigned Notation(continued) Arithmetic overflow in addition  In non-negative notation, carry bit can set an overflow flag.  In two ’ s complement notation an overflow can occur at either end of the numeric range. (Figure 8.2)

Figure 8.2

8.1 Unsigned Notation(continued) Arithmetic overflow in subtraction  X-Y is implemented as X+(-Y)  Y is converted to -Y by taking it ’ s two ’ s complement.  Implementation of micro-operation SUB: X  X-Y (Figure 8.3)

Figure 8.3

8.1 Unsigned Notation(continued) Overflow generation in unsigned two ’ s complement subtraction (Fig. 8.4)  The result should be larger than or equal to zero.

Figure 8.4

8.1 Unsigned Notation(continued) Multiplication  A simple algorithm for x  y Z =0 For I=1 to y do { z = z+x }  Shift-add multiplication  Partial products

8.1 Unsigned Notation(continued) Multiplication  another simple algorithm for x  y  The result in two n-bits registers, V.U U =0 For I = 1 to n do { IF Y0= 1 then CU = U +X; linear shift right CUV; circular shift right Y }  Refer to table 8.2  RTL code for realize the algorithm  Refer to Table 8.3  Hardware implementation (Refer to Figure 8.5)

Figure 8.5

8.1 Unsigned Notation(continued) Multiplication  Booth ’ s algorithm (Figure 8.6)  This algorithm works directly on two ’ s complete numbers.  UV  X*Y U =0; Y -1 = 0; For I=1 To n DO {IF start of a string of 1 ’ s in Y THEN U = U-X; IF end of a string of 1 ’ s in Y THEN U =U+X; Arithmetic shift right UV; Circular shift right Y AND copy Y 0 to Y -1 }

Figure 8.6

Division Z = X  Y  Z = 0; WHILE x  y DO { z = z + 1, x = x-y }

Division(continued) Shift-subtract division of two binary values.  Dividend: UV, divisor: X, quotient: Y, remainder: U  IF U  X THEN exit with overflow; Y = 0; C = 0; FOR i = 1 TO n DO { linear shift left CUV; linear shift left Y; IF CU  X THEN {Y 0 = 1, U = CU -X } }

Division(continued) Non-restoring division algorithm Re-storing division algorithm

Figure 8.7

How to compare U and X Figure 8.8

Figure 8.9 Hardware implementa tion of restoring algorithm

8.2 Signed Notations Signed-magnitude Signed-two ’ s complement  To add and subtract two signed-two ’ s complementation values, we simply treat the sign bit as the most significant bit of magnitude.  Multiplication can be accomplished by using Booth ’ s algorithm

8.3 Binary Coded Decimal BCD Format: 4 bits can represent one decimal digit. Addition and subtraction (Figure 8.13)  We adjust the hardware that adds numbers to account for the BCD representation.  When the sum of two digits is more than 9, adding 6 to the result generated by a binary adders produces the correct result.(Figure 8.11)  Nine ’ s complement (Figure 8.12) or ten ’ s complement can be used for subtraction.

Figure 8.11

Figure 8.12

Figure 8.13

8.4 Special Arithmetic Hardware Pipelining  Arithmetic pipeline (Figure 8.14)  To increase the throughput, the numbers of results generated per time unit.  Speed up: a metric used to measure the performance of a pipeline.

8.4 Special Arithmetic Hardware(continued) Pipelining The maximum speedup Lookup table (Figure 8.15 and 8.16)

Figure 8.14

Figure 8.15

Figure 8.16

8.4 Special Arithmetic Hardware(continued) Carry-save adder(Figure 8.17) Wallice Tree: a combinatorial circuit used to multiply two numbers.(Figure 8.18)

Figure 8.17

Figure 8.18

Example X * Y X = 111 Y =  PP0 111  PP1 111  PP  Final sum calculated

Figure 8.19

Example X * Y (6-bit) X = 1011 Y = 1110

Figure 8.20

Figure 8.21 An 8X8 Wallice Tree Multiplier

8.5 Floating Point Numbers Number format  Normalized  NoN Not a number  Biasing Numeric characteristic  Precision  Gap  Range  Rounding  Guard bit