computer arithmetic

17
Sarvajanik College Of Engineering and Technology Prepared by : Mistry hiral 31 Naik shailee 32 Naik shreya 33 Patel Nidhi 35 Patel Adarsh 36 Subject : Computer Organization Submitted to : Prof. Bhumika Bhatt Prof. Mehul Khatiwala Topic : Computer arithmetic Computer Evening - 2 nd year

Upload: adarshpatel

Post on 16-Dec-2015

22 views

Category:

Documents


0 download

DESCRIPTION

computer arithmetic in hardware in computer organisation subject.

TRANSCRIPT

Slide 1

Sarvajanik College Of Engineering and TechnologyPrepared by :Mistry hiral31Naik shailee 32 Naik shreya33Patel Nidhi35Patel Adarsh36Subject : Computer Organization

Submitted to : Prof. Bhumika BhattProf. Mehul KhatiwalaTopic : Computer arithmeticComputer Evening - 2nd yearINTRODUCTION:Arithmetic instruction in digital computers manipulate data to produce result necessary for the solution of computational problems.The four basic arithmetic operations are:AdditionSubtraction MultiplicationDivisionFrom these four basic operations, its possible to formulate other arithmetic functions and solve scientific problems by means of numerical analysis methods. An arithmetic processor is the type of a processor unit that executes arithmetic operation.ALGORITHM:

We have to follow the sequence of steps in order to carry out the operation and achieve a correct result. The solution to any problem that is stated by a finite number of well-defined procedural steps is called an algorithm.3ADDITION AND SUBTRACTION: The algorithm for addition and subtraction are derived from the table and can be stated as follow:Addition and Subtraction of Signed-Magnitude numbers:Subtract Magnitudes

Operation Add When WhenWhen MagnitudesMagnitudeA > b A < B A=B (+A)+(+B) +(A + B) (+A)+(-B) +(A - B)-(B - A) +(A - B) (-A)+(+B) -(A B)+(B - A)+(A - B) (-A)+(-B) -(A + B) (+A)-(+B) +(A - B)-(B - A)+(A - B) (+A)-(-B) +(A + B) (-A)-(+B)-(A + B) (-A)-(-B) -(A - B)+(B - A)+(A - B) Hardware Implementation :BsB registerAVFComplementerEParallel adderAsA RegisterSM(Mode Control)Input carryLoad SumOutputcarry

Flowchart for add and subtract operations: Hardware for signed 2s complement addition and subtraction :

Algorithm for adding and subtracting numbers in signed 2s complement representation :

Multiplication algorithm1 0 1 1 1(23) x 1 0 0 1 1(19)________1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 01 0 1 1 1_______________1 1 0 1 1 0 1 0 1 (437)Hardware for multiply operation:

Flowchart for multiply operation:

Hardware for Booth's algorithms:

Booth's algorithms for multiplication of signed-2scomplement numbers:

Example of Booths Algorithm

14Booth's Algorithm :Booth's Algorithm Recoding Scheme: -1 times (Subtract) the shifted multiplicand is selected when moving from 0 to 1 +1 times (Addition) the shifted multiplicand is selected when moving from 1 to 0 0 times the (just shift right) shifted multiplicand is selected for rest of the cases.Recoding of Multiplier: - Append an implied bit (0) at the end of Multiplier:

Example 1: 42 in Binary: 1 0 1 0 1 0 0 Implied Bit Recoding: -1 +1 -1 +1 -1 0Example 2: -9 in Binary: 1 0 1 1 1 0 Recording: -1 1 0 0 -1 Multiply 36 x -9 using multiplier Recoding Method: (6 bit Register)