Lectures On Computer Arithmetic: Unit 7
Lectures On Computer Arithmetic: Unit 7
Lectures On Computer Arithmetic: Unit 7
Computer Arithmetic
UNIT 7
Addition and Subtraction of Signed
Magnitude Numbers
Addition and Subtraction :
Hardware Algorithm
The two signs A, and B are compared by an exclusive- The magnitudes are subtracted by adding A to the 2's
OR gate. If the output of the gate is 0, the signs are complement of B. No overflow can occur if the
identical; if it is I, the signs are different numbers are subtracted so AVF is cleared to 0.
The magnitudes are added with a micro operation EA A 1 in E indicates that A > B and the number in A is the
A + B. correct result. If this number is zero, the sign A, must
where EA is a register that combines E: and A. The be made positive to avoid a negative zero.
carry in E: after the addition constitutes an overflow if A 0 in E: indicates that A < B. For this case it is
it is equal to 1. necessary to take the 2's complement of the value in A.
The value of E: is transferred into the add-overflow This operation can be done with one micro operation A
flip-flop AVF. A’+ 1 .
Flow Chart
Addition &
Subtraction with
signed
magnitude data
Multiplication Algorithms
The sum of A and B forms a partial product which is transferred to the EA register. both partial
product and multiplier are shifted to the right. This shift will be denoted by the statement shr EAQ to
designate the right shift depicted in Figure
Hardware Multiplication
Algorithm
Figure is a flowchart of the hardware multiply
algorithm. Initially, the multiplicand is in B and the
multiplier in Q.
Their corresponding signs are in Bs and Qs,
respectively. The signs are compared, and both A and Q
are set to correspond to the sign of the product since a
double-length product will be stored in registers A and
Q.
Registers A and E are cleared and the sequence counter
SC is set to a number equal to the number of bits of the
multiplier.
Booth Multiplication Algorithm for Signed 2's
complement Numbers
Booth algorithm gives a procedure for multiplying binary As in all multiplication schemes, Booth algorithm requires
integers in signed-2's complement representation. examination of the multiplier bits and shifting of the partial
It operates on the fact that strings of 0's in the multiplier product. Prior to the shifting, the multiplicand may be added
require no addition but just shifting, and a string of 1's in the to the partial product, subtracted from the partial product, or
left unchanged according to the following rules:
multiplier from bit weight 2k to weight 2m can be treated as
(2k+1 – 2m ) 1. The multiplicand is subtracted from the partial product
For example, the binary number 001110 ( + 14) has a string upon encountering the first least significant 1 in a string of
of 1's from 23 to 21(k = 3, m = 1). The number can be 1's in the multiplier.
represented as 2k+1 - 2m = 24 - 21 = 16 – 2 = 14. 2. The multiplicand is added to the partial product upon
Therefore, the multiplication M x 14, where M is the encountering the first 0 (provided that there was a previous
multiplicand and 14 the multiplier, can be done as M x 24 - M 1) in a string of 0's in the multiplier.
X 21 . 3. The partial product does not change when the multiplier bit
Thus the product can be obtained by shifting the binary is identical to the previous multiplier bit.
multiplicand M four times to the left and subtracting M
shifted left once.
Booth Multiplication Algorithm for Signed 2's
complement Numbers
A floating point number in computer registers consists Arithmetic operations with floating-point
of two parts: a mantissa m and an exponent e. numbers are more complicated than with fixed-
The two parts represent a number obtained from point numbers and their execution takes longer
multiplying m times a radix r raised to the value of e; and requires more complex hardware.
thus m x re. Adding or subtracting two numbers requires first
The mantissa may be a fraction or an integer. The an alignment of the radix point since the
location of the radix point and the value of the radix exponent parts must be made equal before
r are assumed and are not included in the registers. adding or subtracting the mantissas.
For example, assume a fraction representation and a The alignment is done by shifting one mantissa
radix 10. The decimal number 537.25 is represented in
a register with m = 53725 and e = 3 and is interpreted while its exponent is adjusted until it is equal to
to represent the floating-point number .53725 X 103 the other exponent.
Multiplication Algorithm
for 2 Floating
Point Numbers
The flowchart for floating-point multiplication is shown in Figure.
The two operands are checked to determine if they contain a zero. If either
operand is equal to zero, the product in the AC is set to zero and the
operation is terminated.
If neither of the operands is equal to zero, the process continues with the
exponent addition. The exponent of the multiplier is in q and the adder is
between exponents a and b.
It is necessary to transfer the exponents from q to a, add the two
exponents, and transfer the sum into a . Since both exponents are biased
by the addition of a constant, the exponent sum will have double this bias.
The correct biased exponent for the product is obtained by subtracting
the bias number from the sum.
The multiplication of the mantissas is done as in the fixed-point case with
the product residing in A and Q . Overflow cannot occur during
multiplication, so there is no need to check for it.
BCD adder Revisited
O/p:
S8,S4,S2,S1 & Carry Out
Decimal Arithmetic Operations
Questions can be asked
Draw and explain flowchart for addition and subtraction operations with sign-magnitude data.
Draw flowchart hardware multiplication algorithm and explain it.
Explain Booth multiplication algorithm for multiplying binary integers in signed 2’s
complement representation.
Draw flow chart for multiplication of two floating point numbers.
Explain BCD Adder with its block diagram
Draw the block diagram of 4-bit arithmetic circuit and explain it in detail.
Assume A = (+8) and B = (+5). Multiply these two numbers using Booth algorithm. Show the
step-by-step multiplication process.
THANK you