Unit II: Computer Arithmetic
Unit II: Computer Arithmetic
COMPUTER ARITHMETIC
COMPUTER ARITHMETIC
Data is manipulated by using the arithmetic instructions
in digital computers.
Data is manipulated to produce results necessary to give
solution for the computation problems.
The Addition, subtraction, multiplication and division are
the four basic arithmetic operations.
To execute arithmetic operations there is a separate
section called arithmetic processing unit in central
processing unit.
The four basic arithmetic operations addition,
subtraction, multiplication and division, it is possible to
derive other arithmetic operations and solve scientific
problems by means of numerical analysis methods.
Addition and Subtraction
Addition and Subtraction
Flowchart for Addition/ Subtraction
Multiplication Algorithm
Flowchart for multiply operation
Division Algorithms
Hardware Implementation for Signed-Magnitude Data
Restoring Division Algorithm For Unsigned
Integer
Step-1: First the registers are initialized with corresponding values
(Q = Dividend, M = Divisor, A = 0, n = number of bits in dividend)
Step-2: Then the content of register A and Q is shifted left as if they
are a single unit
Step-3: Then content of register M is subtracted from A and result is
stored in A
Step-4: Then the most significant bit of the A is checked if it is 0 the
least significant bit of Q is set to 1 otherwise if it is 1 the least
significant bit of Q is set to 0 and value of register A is restored i.e
the value of A before the subtraction with M
Step-5: The value of counter n is decremented
Step-6: If the value of n becomes zero we get of the loop otherwise
we repeat from step 2
Step-7: Finally, the register Q contain the quotient and A contain
remainder
Non-Restoring Division For Unsigned
Integer
Step-1: First the registers are initialized with corresponding values (Q =
Dividend, M = Divisor, A = 0, n = number of bits in dividend)
Step-2: Check the sign bit of register A
Step-3: If it is 1 shift left content of AQ and perform A = A+M,
otherwise shift left AQ and perform A = A-M (means add 2’s
complement of M to A and store it to A)
Step-4: Again the sign bit of register A
Step-5: If sign bit is 1 Q[0] become 0 otherwise Q[0] become 1 (Q[0]
means least significant bit of register Q)
Step-6: Decrements value of N by 1
Step-7: If N is not equal to zero go to Step 2 otherwise go to next step
Step-8: If sign bit of A is 1 then perform A = A+M
Step-9: Register Q contain quotient and A contain
remainderExamples: Perform Non_Restoring Division for Unsigned
Integer
Example of a binary division using digital
hardware
Divisor B = 10001, Dividend A = 0111000000
Final Remainder : 00110
Thank You