Computer Arithmetic 1 Of 23 Computer Arithmetic By: Ali Bohlooli Zefreh sepahan. iut. ac. ir Professor: Dr. Shadrokh Samavi Date: 1381/ 3/ 4.

Slides:



Advertisements
Similar presentations
Division Circuits Jan 2013 Shmuel Wimer Bar Ilan University, Engineering Faculty Technion, EE Faculty 1.
Advertisements

Integer division Pencil and paper binary division (dividend)(divisor) 1000.
CMPT 334 Computer Organization Chapter 3 Arithmetic for Computers [Adapted from Computer Organization and Design 5 th Edition, Patterson & Hennessy, ©
Lecture Objectives: 1)Perform binary division of two numbers. 2)Define dividend, divisor, quotient, and remainder. 3)Explain how division is accomplished.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
UNIVERSITY OF MASSACHUSETTS Dept
1 Lecture 9: Floating Point Today’s topics:  Division  IEEE 754 representations  FP arithmetic Reminder: assignment 4 will be posted later today.
EE 382 Processor DesignWinter 98/99Michael Flynn 1 AT Arithmetic Most concern has gone into creating fast implementation of (especially) FP Arith. Under.
Spring 2006EE VLSI Design II - © Kia Bazargan 299 EE 5324 – VLSI Design II Kia Bazargan University of Minnesota Part VII: Floating Point Arithmetic.
Chapter 6 Arithmetic. Addition Carry in Carry out
Copyright 2008 Koren ECE666/Koren Sample Mid-term 2.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital.
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
1 Lecture 8: Binary Multiplication & Division Today’s topics:  Addition/Subtraction  Multiplication  Division Reminder: get started early on assignment.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
COE 308: Computer Architecture (T041) Dr. Marwan Abu-Amara Integer & Floating-Point Arithmetic (Appendix A, Computer Architecture: A Quantitative Approach,
CPSC 321 Computer Architecture ALU Design – Integer Addition, Multiplication & Division Copyright 2002 David H. Albonesi and the University of Rochester.
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Winter 2004 Lecture 7.
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
Ch. 21. Square-rootingSlide 1 VI Function Evaluation Topics in This Part Chapter 21 Square-Rooting Methods Chapter 22 The CORDIC Algorithms Chapter 23.
division algorithm Before we study divisibility, we must remember the division algorithm. r dividend = (divisor ⋅ quotient) + remainder.
ECE 645 – Computer Arithmetic Lecture 10: Fast Dividers ECE 645—Computer Arithmetic 4/15/08.
ECE 645 – Computer Arithmetic Lecture 9: Basic Dividers ECE 645—Computer Arithmetic 4/1/08.
Computer Arithmetic Nizamettin AYDIN
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Integer Conversion Between Decimal and Binary Bases Conversion of decimal to binary more complicated Task accomplished by –Repeated division of decimal.
Multiplication of signed-operands
Lecture 6: Multiply, Shift, and Divide
Lesson 5-4 Example Example 2 Find 14 ÷ 4. Show the remainder. 1.Rewrite the problem in vertical format.
Lecture 9: Floating Point
June 2007 Computer Arithmetic, Function EvaluationSlide 1 VI Function Evaluation Topics in This Part Chapter 21 Square-Rooting Methods Chapter 22 The CORDIC.
Division Harder Than Multiplication Because Quotient Digit Selection/Estimation Can Have Overflow Condition – Divide by Small Number OR even Worse – Divide.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers.
Partial Quotient Method In this division algorithm the children record on the right side of the problem. The first thing they do is divide. They ask themselves.
Basic Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.1, Shift/Subtract Division Algorithms 13.3, Restoring Hardware Dividers.
COE 308: Computer Architecture (T032) Dr. Marwan Abu-Amara Integer & Floating-Point Arithmetic (Appendix A, Computer Architecture: A Quantitative Approach,
Lecture 11 Advanced Dividers.
Copyright 2008 Koren ECE666/Koren Part.7b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
1 Basic Dividers Lecture 9. Required Reading Chapter 13, Basic Division Schemes 13.1, Shift/Subtract Division Algorithms 13.3, Restoring Hardware Dividers.
ECE/CS 552: Integer Dividers
CDA 3101 Spring 2016 Introduction to Computer Organization
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Fall 2006 Lecture 7 Division.
CSE 8351 Computer Arithmetic Fall 2005 Instructors: Peter-Michael Seidel.
COMPUTER ARITHMETIC Arithmetic with Signed-2's Complement Numbers
Integer Operations Computer Organization and Assembly Language: Module 5.
Ch. 4 Computer Arithmetic
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.
Computer Arithmetic. Integer Representation Sign-magnitude representation ’s complement representation magnitudes
More Binary Arithmetic - Multiplication
UNIVERSITY OF MASSACHUSETTS Dept
Lecture 9: Floating Point
UNIVERSITY OF MASSACHUSETTS Dept
Morgan Kaufmann Publishers
CSE 575 Computer Arithmetic Spring 2003 Mary Jane Irwin (www. cse. psu
CDA 3101 Summer 2007 Introduction to Computer Organization
UNIVERSITY OF MASSACHUSETTS Dept
CSCE 350 Computer Architecture
CSCI206 - Computer Organization & Programming
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
Arithmetic Logic Unit A.R. Hurson Electrical and Computer Engineering Missouri University of Science & Technology A.R. Hurson.
UNIVERSITY OF MASSACHUSETTS Dept
divide dividend divisor inverse operations quotient
Square Least number Add & Subtract.
Radix –Two Division Most complex of the four arithmetic operations (addition, subtraction, multiplication and division). Requires the most in terms of.
Presentation transcript:

Computer Arithmetic 1 Of 23 Computer Arithmetic By: Ali Bohlooli Zefreh sepahan. iut. ac. ir Professor: Dr. Shadrokh Samavi Date: 1381/ 3/ 4 Square Root Algorithm

Computer Arithmetic 2 Of 23 Overview Digit by Digit method Restoring Non Restoring SRT –Division –Square Root

Computer Arithmetic 3 Of 23 Similarities between Square Root & Division The square-root and division are inverse of multiplication, therefore expect to find some similarities between them.

Computer Arithmetic 4 Of 23 Square-Rooting methods 1) Multiplicative methods (Convergence) 2) Subtractive methods (Digit by digit) –Use the subtraction and shift operation –Restoring, NonRestoring, SRT algorithms –Adopted in most of the recent processors –Area-effective –Use the reciprocal table –Newton-Raphson, Goldschmidt’s algorithms –Relatively high-speed

Computer Arithmetic 5 Of 23 Subtractive methods

Computer Arithmetic 6 Of 23 Restoring & Non Restoring methods Assume that Q i is partial root in step I and q n-i-1 Is I+1’bit of partial root so Next partial root=r* Q i + q n-i-1 And (r Q i + q n-i-1 ) 2 =r 2 Q i 2 +2r Q i q n-i-1 + q 2 n -i-1 Therefore 2r Q i q n-i-1 + q 2 n -i-1 Must be subtract from partial reminder If radix =2 (2 Q i + q n-i-1 ) 2 =4 Q i 2 +4 Q i q n-i-1 + q 2 n -i-1 If q n-i-1 = ‘1’ then it is sufficient to concatenate ‘01’ in the right of Q i

Computer Arithmetic 7 Of 23 Restoring CS q1q1 q2q2 q3q3 q4q4 r8r8 r5r5 r6r6 r7r7 r4r4 r3r3 r2r2 r1r1 R= x8x8 x6x6 x7x7 x5x5 x4x4 x3x3 x2x2 x1x a b Mux r ou t Borrow_out Sub control Sub 0 1 Borrow_in CS 0 0 0

Computer Arithmetic 8 Of 23 Non Restoring Q= =0.q 1 q 2 …q n X=Q 2 = 0.x 1 x 2 …x 2n Non Restoring Square root algorithm step 1) R 0 = 0.x 1 x 2 ; f 0 =0.01;i=1; step 2)R i =R i-1 -f i-1 step 3)if (Ri<0) then (q i ‘0’;R i R i.x 2i+1 x 2i+2 ; F i q 1 q 2 …q i 11; R i+1 R i +F i ); Else((q i ‘1’;R i R i.x 2i+1 x 2i+2 ; F i q 1 q 2 …q i 01; R i+1 R i -F i ); step 4) i i+1; step 5)if(I<n) then (go to step 3) Else (Q=0.q 1 q 2 …q n ) End

Computer Arithmetic 9 Of 23 Proof of Non restoring Algorithm (X11) 2 =4x+3 (X01) 2 =4x+1 In restoring algorithm R j+1 R j q j+1 2q j R j+2 4R j -(4q j+1 +1)=4R j -8q j -1 In non restoring algorithm R j+1 R j -(4q j +1) q j+1 2q j R j+2 4R j+1 +(4q j+1 +3)=4R j -8q j -1 `

Computer Arithmetic 10 Of 23 Non Restoring CAS r8r8 r5r5 r6r6 r7r7 r4r4 r3r3 r2r2 r1r1 R= q4q4 q3q3 q2q2 q1q x1x1 x2x2 x4x4 x3x3 x5x5 x6x6 x7x7 x8x CAS FA  x in r out qiqi sub/add c in c out 1

Computer Arithmetic 11 Of 23 division & Square-root recursion formulas To find, set and evaluate Define, then R j+1 =rR j -q j+1 D (division recursion formula) (Square-root recursion formula) : the jth partial root : the (j+1)th bit of partial root the subtractive square root and division methods are closely related

Computer Arithmetic 12 Of 23 Assume that X is Radicand and its square root is S m = 0.s 1...s m X- S m = w m 2 -m 에서 w m = 2 m X- 2 m S m w m-1 = 2 m-1 X- 2 m-1 S m w m -2 w m-1 = -2 m (S m -S m-1 ) = -2 m ((s m 2 -m + S m-1 ) - S m-1 ) = -2 m (2s m S m-1 2 -m + s m 2 -2m ) = -s m (2S m-1 + s m 2 -m ) 22 2 w m = 2 w m-1 - s m (2S m-1 + s m 2 -m ) 2 Why

Computer Arithmetic 13 Of 23 SRT Division in Non restoring division 1 if 0< 2r i-1 <D -1 if –2D < 2r i-1 <0 r i = 2 r i-1 - q i D q i = riri D2D D 2r i-1 q i =1 -D-2D -D

Computer Arithmetic 14 Of 23 SRT Division For q i =0 implies no addition/subtraction However, comparing 2 r i-1 with D or -D takes time if D is a normalized fraction (1/2  D < 1), then we can set q i =0 for -1/2  2 r i-1 < 1/2 1 if 2 r i-1  1/2 0 if -1/2  2 r i-1 < 1/2 1 if 2 r i-1 < -1/2 r i = 2 r i-1 - q i D (SRT division)  1.|r i |  D  convergence guaranteed 2.comparing 2 r i-1 with 1/2 or -1/2 is easier if 2 r i-1 = 0.1xxx  2 r i-1  1/2 if 2 r i-1 = 1.0xxx  2 r i-1 < -1/2 if |X|=|r 0 |  1/2  |2 r 0 |  1  examine three bits of 2 r i-1 q i =

Computer Arithmetic 15 Of 23 SRT Division 1/2 1 2r i-1 q i =1 -1/2-D -1/2 q i =0 D when |2r 0 |=|2X|  1 start with a normalized divisor normalize the partial remainder by shifting over leading 0’s if positive, and over leading 1’s if negative 2 r i-1 =0.001xxx 2 r i-1 =1.110xxx riri

Computer Arithmetic 16 Of 23 SRT Division (Example) X = = 5/16 D = = 3/4 r 0 =X=5/16 2r 0 Add -D=-3/4 r 1 =2r 0 -D 2r 1  r 2 2r 2  r 3 2r 3 Add D r 4 =2r 3 +D Add D r 4 (corrected)  1/2 q 1 =  1/2 q 2 =  1/2 q 3 =  1/2 q 4 = r correction Q = – ulp( Unit in the Least Position ) = R = 1/2 * 2 -4 = 1/32

Computer Arithmetic 17 Of 23 SRT Division How to reduce the number of add/subtract operations from simulation and statistical analysis 1. Average ‘shift’ in the SRT method : 2.67 average operations : n/ Actual number of operations depends on D The smallest number is achieved when D  [17/28,3/4] with average shift of 3. Approximately D  [3/5,3/4]

Computer Arithmetic 18 Of 23 SRT Division To reduce the number of operations, modify the SRT method when D  [3/5,3/4] 1. Examine the possibility of using a multiple of D: in some of the steps during the division use 2D (one position earlier) if D is too small, or D/2 (one position later) if D is too large.

Computer Arithmetic 19 Of 23 Modifying the SRT method 2. Change the comparison constant K K= 1/2 if D  [3/5,3/4] k1=3/8 k2=7/16k3=1/2 k2=5/8k3=3/ K= D= K= 3/8 if D  [1/2,9/16] K= 7/16 if D  [9/16,10/16]

Computer Arithmetic 20 Of 23 modifying the SRT method 3- Radix  (=2 m )   # of ADD/SUB reduced # of steps =  n/m  r 0 =X; r i =  r i–1 –q i D restoring DIV: (  –1)  q i  0 Non restoring DIV: (  –1)  q i  –(  –1) High Radix SRT DIV:   q i  –   (  –1)     (  –1) /2 

Computer Arithmetic 21 Of 23 Compute Allowable Range of k (1) k|D|  |r i | (convergence condition)  r i =  r i–1 –q i D=  kD–  D  kD (1)  k =  /(  –1)

Computer Arithmetic 22 Of 23 SRT Division (4) Quotient Accumulation (QA) (1) Quotient Selection (QS) q j +1 결정 q j +1 결정 (3) Partial Remainder Formation (PRF) p j +1 = rp j - q j + 1 d p j +1 = rp j - q j + 1 d (2) Divisor Multiple Formation (DMF) q j +1 d 계산 q j +1 d 계산 Steps

Computer Arithmetic 23 Of 23 SRT Division MUX Divisor Multiple Generator(-2D,-1D,0D,1D,2D) MUX QuotientSelector(PLA) rem P Quotient Q CPA Logic Last q Dividend Divisor QS DMF PRF QA Radix-4 SRT Implementation

Computer Arithmetic 24 Of 23 Refrences 1) “AREA AND PERFORMANCE TRADEOFFS IN FLOATING-POINT DIVIDE AND SQUARE ROOT IMPLEMENTATIONS”,Miriam Leeserl, Dept. of Electrical and Computer Engineering, Northeastern UniversityBoston, Massachusetts ) “New algorithm and vlsi architecture for SRT Divesion and square root” S.E. McQuillan, J.V. McCanny, University of Belfast 4)”Computer arithmetic”,kai Hwang 5) zSzsrtlong.pdf/srt-division-architectures-models.pdf srt-division-architectures-models.pdf 6) s.pdf/harris97srt.pdf 7) g_serzSz..zSzPublicationszSzkuhlmannzSzsqrt.pdf/fast-low-power-shared.pdf 8) aperszSzSRT-thesis.pdf/alternative-implementations-of-srt.pdf 9) delmanzSzpentiumzSzpentium.pdf/the-mathematics-of-the.pdf

Computer Arithmetic 25 Of 23 References 10) _TOC.pdf/oberman97division.pdf 11) iptzSzedtc96.pdf/asynchronous-srt-dividers-the.pdf 12) Sz1995zSzlect3zSzlect3.pdf/about-these-notes-on.pdf 13) sb.mpg.dezSzpubzSzpaperszSzreportszSzMPI-I pdf/burnikel96leda.pdf 14) _KarpzSzpublicationszSzsqrtdiv.pdf/alan97high.pdf 15) vlsi.yonsei.ac.kr/seminar/ Hi-Speed%20Division%20Circuit.ppt 16) piglet.uccs.edu/~cs520/S99cha.ppt 17) sdgroup.snu.ac.kr/class/digital.2000/note/302L22.ppt