DD&CO Unit 5
DD&CO Unit 5
CARRY-LOOKAHEAD ADDITIONS
• The logic expression for si(sum) and ci+1(carry-out) of stage i are
si = xi+yi+ci ------(1) ci+1=xiyi+xici+yici-------(2)
• Factoring (2) into
ci+1=xiyi+(xi+yi)ci
we can write
ci+1=Gi+PiCi where Gi=xiyi and Pi=xi+yi
• The expressions Gi and Pi are called generate and propagate functions (Figure 9.4).
• If Gi=1, then ci+1=1, independent of the input carry ci. This occurs when both xi and yi are 1.
Propagate function means that an input-carry will produce an output-carry when either x i=1 or
yi=1.
• All Gi and Pi functions can be formed independently and in parallel in one logic-gate delay.
• Expanding ci terms of i-1 subscripted variables and substituting into the c i+1 expression, we
obtain ci+1=Gi+PiGi-1+PiPi-1Gi-2. . . . . .+P1G0+PiPi-1 . . . . . .P0c0
• Conclusion: Delay through the adder is 3 gate delays for all carry-bits
& 4 gate delays for all sum-bits.
• Consider the design of a 4-bit adder. The carries can be implemented as
c1=G0+P0c0
c2=G1+P1G0+P1P0c0
c3=G2+P2G1+P2P1G0+P2P1P0c0
c4=G3+P3G2+P3P2G1+P3P2P1G0+P3P2P
1P0c0
• The carries are implemented in the block labeled carry-lookahead logic. An adder implemented in
this form is called a Carry-Lookahead Adder.
• Limitation: If we try to extend the carry-lookahead adder for longer operands, we run into a
problem of gate fan-in constraints.
HIGHER-LEVEL GENERATE & PROPAGATE FUNCTIONS
• 16-bit adder can be built from four 4-bit adder blocks (Figure 9.5).
• These blocks provide new output functions defined as G k and Pk,
where k=0 for the first 4-bit block,
k=1 for the second 4-bit block and so on.
• In the first block,
P0=P3P2P1P0
&
G0=G3+P3G2+P3P2G1+P3P2P
1G 0
• The first-level Gi and Pi functions determine whether bit stage i generates or propagates a carry,
and the second level Gk and Pk functions determine whether block k generates or propagates a carry.
• Carry c16 is formed by one of the carry-look ahead circuits
as c16=G3+P3G2+P3P2G1+P3P2P1G0+P3P2P1P0c0
• Conclusion: All carries are available 5 gate delays after X, Y and c0 are applied as inputs.
21 times the M.
FAST MULTIPLICATION
BIT-PAIR RECODING OF MULTIPLIERS
• This method
→ derived from the booth algorithm
→ reduces the number of summands by a factor of 2
• Group the Booth-recoded multiplier bits in pairs. (Figure 9.14 & 9.15).
• The pair (+1 -1) is equivalent to the pair (0 +1).
CARRY-SAVE ADDITION OF SUMMANDS
• Consider the array for 4*4 multiplication. (Figure 9.16 & 9.18).
• Instead of letting the carries ripple along the rows, they can be "saved" and introduced into the next
row, at the correct weighted positions.
• The full adder is input with three partial bit products in the first row.
• Multiplication requires the addition of several summands.
• CSA speeds up the addition process.
• Consider the array for 4x4 multiplication shown in fig 9.16.
• First row consisting of just the AND gates that implement the bit products m 3q0, m2q0, m1q0 and
m0q0.
• The delay through the carry-save array is somewhat less than delay through the ripple-carry array.
This is because the S and C vector outputs from each row are produced in parallel in one full-adder
delay.
• Consider the addition of many summands in fig 9.18.
• Group the summands in threes and perform carry-save addition on each of these groups in parallel
to generate a set of S and C vectors in one full-adder delay
• Group all of the S and C vectors into threes, and perform carry-save addition on them, generating a
further set of S and C vectors in one more full-adder delay
• Continue with this process until there are only two vectors remaining
• They can be added in a RCA or CLA to produce the desired product.
• When the number of summands is large, the time saved is proportionally much greater.
• Delay: AND gate + 2 gate/CSA level + CLA gate delay, Eg., 6 bit number require 15 gate delay,
array 6x6 require 6(n-1)-1 = 29 gate Delay.
• In general, CSA takes 1.7 log2k-1.7 levels of CSA to reduce k summands.
INTEGER DIVISION
• An n-bit positive-divisor is loaded into register M.
An n-bit positive-dividend is loaded into register Q at the start of the operation.
Register A is set to 0 (Figure 9.21).
• After division operation, the n-bit quotient is in register Q, and the remainder is in register A.
NON-RESTORING DIVISION
• Procedure:
Step 1: Do the following n times
i) If the sign of A is 0, shift A and Q left one bit position and subtract M from A;
otherwise, shift A and Q left and add M to A (Figure 9.23).
ii) Now, if the sign of A is 0, set q0 to 1; otherwise set q0 to 0.
Step 2: If the sign of A is 1, add M to A (restore).
RESTORING DIVISION
• Procedure: Do the following n times
1) Shift A and Q left one binary position (Figure 9.22).
2) Subtract M from A, and place the answer back in A
3) If the sign of A is 1, set q0 to 0 and add M back to A(restore A).
If the sign of A is 0, set q0 to 1 and no restoring done.
The scale factor has a range of 2-126 to 2+127 (which is approximately equal to 10+38).
• The 32 bit word is divided into 3 fields: sign(1 bit), exponent(8 bits) and mantissa(23 bits).
• Signed exponent=E.
Unsigned exponent E'=E+127. Thus, E' is in the range 0<E'<255.
• The last 23 bits represent the mantissa. Since binary normalization is used, the MSB of the mantissa
is always equal to 1. (M represents fractional-part).
• The 24-bit mantissa provides a precision equivalent to about 7 decimal-digits (Figure 9.24).
• Double precision representation occupies a single 64-bit word. And E' is in the range 1<E'<2046.
• The 53-bit mantissa provides a precision equivalent to about 16 decimal-digits.
NORMALIZATION
• When the decimal point is placed to the right of the first (non zero) significant digit, the number
is said to be normalized.
• If a number is not normalized, it can always be put in normalized form by shifting the fraction and
adjusting the exponent. As computations proceed, a number that does not fall in the representable
range of normal numbers might be generated.
• In single precision, it requires an exponent less than -126 (underflow) or greater than +127
(overflow). Both are exceptions that need to be considered.
SPECIAL VALUES
• The end values 0 and 255 of the excess-127 exponent E’ are used to represent special values.
• When E’=0 and the mantissa fraction m is zero, the value exact 0 is represented.
• When E’=255 and M=0, the value ∞ is represented, where ∞ is the result of dividing a normal
number by zero.
• when E’=0 and M!=-, denormal numbers are represented. Their value is ±0.M X 2-126
• When E’=255 and M!=0, the value represented is called not a number(NaN). A NaN is the result of
performing an invalid operation such as 0/0 or√ 0 .
(a)
(b) To subtract the second number, form its 2's-complement and add it to the first number.
Problem 3:
Perform following operations on the 6-bit signed numbers using 2's complement
representation system. Also indicate whether overflow has occurred.
Solution:
Problem 4:
Perform signed multiplication of following 2’s complement numbers using Booth’s
algorithm.
(a) A=010111 and B=110110 (b) A=110011 and B=101100
(c) A=110101 and B=011011 (d) A=001111 and B=001111
(e) A=10100 and B=10101 (f) A=01110 and B=11000
Solution:
Problem 5:
Perform signed multiplication of following 2’s complement numbers using bit-pair recoding
method.
(a) A=010111 and B=110110 (b) A=110011 and B=101100
(c) A=110101 and B=011011 (d) A=001111 and B=001111
Solution:
Problem 6:
Given A=10101 and B=00100, perform A/B using restoring division algorithm.
Solution:
Problem 7:
Given A=10101 and B=00101, perform A/B using non-restoring division algorithm.
Solution:
Problem 8:
Represent 1259.12510 in single precision and double precision formats
Solution:
Step 1: Convert decimal number to binary format
1259(10) =10011101011(2)
Fractional Part
0.125(10) =0.001
Binary number = 10011101011+0.001
= 10011101011.001
Step 2: Normalize the number
10011101011.001=1.0011101011001 x 210
Step 3: Single precision format:
For a given number S=0, E=10 and M=0011101011001
Bias for single precision format is = 127
E’= E+127 = 10+127 = 137(10)
= 10001001(2)
Number in single precision format is given as