View
2
Download
0
Category
Preview:
Citation preview
The Look-Ahead AdderLecture 22Section C.6
Robb T. Koether
Hampden-Sydney College
Wed, Oct 23, 2019
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 1 / 28
1 Look-Ahead Adders
2 Propagate and Generate
3 A 16-bit Adder
4 Subtraction
5 Assignment
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 2 / 28
Outline
1 Look-Ahead Adders
2 Propagate and Generate
3 A 16-bit Adder
4 Subtraction
5 Assignment
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 3 / 28
The Carry Bits
In the case of the ripple adder, we saw some of the operationscould be done simultaneously, such as adding ai and bi .Other operations had to wait for the carry-in bit from the previouscolumn.The look-ahead adder pushes this idea much further.It puts a premium on computing the carry-in bits for all columns asquickly as possible.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 4 / 28
Outline
1 Look-Ahead Adders
2 Propagate and Generate
3 A 16-bit Adder
4 Subtraction
5 Assignment
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 5 / 28
The Carry Bits
In the case of the ripple adder, we saw that the carry-out bit maybe computed as
ab + ac + bc,
where a and b are the two bits to be added and c is the carry-inbit.This formula will give the carry-out bit for each column of amulti-bit adder.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 6 / 28
The Carry Bits
The Carry Bits
c0 = 0,c1 = b0c0 + a0c0 + a0b0 = (a0 + b0)c0 + a0b0,
c2 = b1c1 + a1c1 + a1b1 = (a1 + b1)c1 + a1b1,
c3 = b2c2 + a2c2 + a2b2 = (a2 + b2)c2 + a2b2,
c4 = b3c3 + a3c3 + a3b3 = (a3 + b3)c3 + a3b3,
...
ci represents the carry-in bit and ci+1 is the carry-out bit for thei-th column.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 7 / 28
The Carry Bits
The Carry Bits
c1 = b0c0 + a0c0 + a0b0,
c2 = b1(b0c0 + a0c0 + a0b0) + a1(b0c0 + a0c0 + a0b0) + a1b1,
= b1b0c0 + b1a0c0 + b1a0b0 + a1b0c0 + a1a0c0 + a1a0b0 + a1b1,
etc.
We may substitute the formula for c1 into the expression for c2,and so on.Thus, we may express each ci in terms of the ai ’s, bi ’s, and c0.This will quickly get out of hand.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 8 / 28
The Generate and Propagate Bits
The Generate and Propagate Bits
ci+1 = aibi + (ai + bi)ci ,
gi = aibi ,
pi = ai + bi .
Instead, we will calculate the generate and propagate bits.In column i , a carry of 1 is generated if aibi = 1.In column i , a carry of 1 is propagated from the previous column ifai + bi = 1.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 9 / 28
The Generate and Propagate Bits
The Carry Bits
ci+1 = gi + pici .
The carry bit ci+1 is 1 if, in the i-th column, eitherGenerates a carry (gi = 1), orPropagates a carry (pi = 1) from the previous column (ci = 1), orBoth.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 10 / 28
The Generate and Propagate Bits
The Carry Bits
c0 = c0,
c1 = g0 + p0c0,
c2 = g1 + p1c1
= g1 + p1(g0 + p0c0)
= g1 + p1g0 + p1p0c0,
c3 = g2 + p2c2
= g2 + p2 (g1 + p1g0 + p1p0c0)
= g2 + p2g1 + p2p1g0 + p2p1p0c0,
We now have more compact expressions for ci in terms of c0.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 11 / 28
The Generate and Propagate Bits
The Carry Bits
c4 = g3 + p3c3,
= g3 + p3(g2 + p2g1 + p2p1g0 + p2p1p0c0)
= g3 + p3g2 + p3p2g1 + p3p2p1g0 + p3p2p1p0c0,
etc.
We now have more compact expressions for ci in terms of c0.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 12 / 28
The Generate and Propagate Bits
Using the logic of the generate and propagate bits, we firstcompute gi = aibi and pi = ai + bi for all columns simultaneously.We can see that c1 through c4 can be calculated using only 5more levels of logic.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 13 / 28
A Four-bit Adder
1
2 3 4 etc.
p0
p0c0 p1(p0c0) p3(p2p1p0c0) . . .
g0
p1g0 p2(p1g0) (g1 + p1g0) + (p1p0c0) . . .
p1
p2g1 p3(p2g1) (g2 + p2g1) + (p2p1g0) . . .
g1
p3g2 g1 + (p1g0) (g3 + p3g2) + (p3p2g1) . . .
p2
p2p1 g2 + (p2g1)...
g2
p3p2 g3 + (p3g2)
p3
... (p2p1)(p0c0)
g3
...
Using the logic of the generate and propagate bits, we firstcompute aibi and ai + bi for all positions simultaneously.How many levels of logic are required to compute s0, s1, s2, s3,and c4?
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 14 / 28
A Four-bit Adder
1 2
3 4 etc.
p0 p0c0
p1(p0c0) p3(p2p1p0c0) . . .
g0 p1g0
p2(p1g0) (g1 + p1g0) + (p1p0c0) . . .
p1 p2g1
p3(p2g1) (g2 + p2g1) + (p2p1g0) . . .
g1 p3g2
g1 + (p1g0) (g3 + p3g2) + (p3p2g1) . . .
p2 p2p1
g2 + (p2g1)...
g2 p3p2
g3 + (p3g2)
p3...
(p2p1)(p0c0)
g3
...
Using the logic of the generate and propagate bits, we firstcompute aibi and ai + bi for all positions simultaneously.How many levels of logic are required to compute s0, s1, s2, s3,and c4?
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 14 / 28
A Four-bit Adder
1 2 3
4 etc.
p0 p0c0 p1(p0c0)
p3(p2p1p0c0) . . .
g0 p1g0 p2(p1g0)
(g1 + p1g0) + (p1p0c0) . . .
p1 p2g1 p3(p2g1)
(g2 + p2g1) + (p2p1g0) . . .
g1 p3g2 g1 + (p1g0)
(g3 + p3g2) + (p3p2g1) . . .
p2 p2p1 g2 + (p2g1)
...
g2 p3p2 g3 + (p3g2)
p3... (p2p1)(p0c0)
g3...
Using the logic of the generate and propagate bits, we firstcompute aibi and ai + bi for all positions simultaneously.How many levels of logic are required to compute s0, s1, s2, s3,and c4?
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 14 / 28
A Four-bit Adder
1 2 3 4
etc.
p0 p0c0 p1(p0c0) p3(p2p1p0c0)
. . .
g0 p1g0 p2(p1g0) (g1 + p1g0) + (p1p0c0)
. . .
p1 p2g1 p3(p2g1) (g2 + p2g1) + (p2p1g0)
. . .
g1 p3g2 g1 + (p1g0) (g3 + p3g2) + (p3p2g1)
. . .
p2 p2p1 g2 + (p2g1)...
g2 p3p2 g3 + (p3g2)
p3... (p2p1)(p0c0)
g3...
Using the logic of the generate and propagate bits, we firstcompute aibi and ai + bi for all positions simultaneously.How many levels of logic are required to compute s0, s1, s2, s3,and c4?
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 14 / 28
A Four-bit Adder
1 2 3 4 etc.p0 p0c0 p1(p0c0) p3(p2p1p0c0) . . .g0 p1g0 p2(p1g0) (g1 + p1g0) + (p1p0c0) . . .p1 p2g1 p3(p2g1) (g2 + p2g1) + (p2p1g0) . . .g1 p3g2 g1 + (p1g0) (g3 + p3g2) + (p3p2g1) . . .
p2 p2p1 g2 + (p2g1)...
g2 p3p2 g3 + (p3g2)
p3... (p2p1)(p0c0)
g3...
Using the logic of the generate and propagate bits, we firstcompute aibi and ai + bi for all positions simultaneously.How many levels of logic are required to compute s0, s1, s2, s3,and c4?
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 14 / 28
Outline
1 Look-Ahead Adders
2 Propagate and Generate
3 A 16-bit Adder
4 Subtraction
5 Assignment
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 15 / 28
A 16-bit Adder
It is not practical to continue in this manner through 16 bits, to saynothing of 32 bits or 64 bits.Instead, we view the four-bit adder as a unit.A 16-bit adder consists of 4 such units.Each unit has its own carry-in and carry-out bits.We apply the same logic to these 4 units.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 16 / 28
A 16-bit Adder
A Four-bit Adder
Four-bitAdder
a0 b0a1 b1a2 b2a3 b3
s0s1s2s3
c4 c0
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 17 / 28
A 16-bit Adder
Higher-level Generate and Propagate Bits
C0 = c0,
P0 = p3p2p1p0,
G0 = g3 + p3g2 + p3p2g1 + p3p2p1g0.
The 4-bit adder may generate the carry bit c4 or it may propagateit from c0.We define P0 and G0 as shown above.Then we compute c4 as
C1 = G0 + P0C0.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 18 / 28
A 16-bit Adder
Higher-level Generate and Propagate Bits
C0 = c0,
P0 = p3p2p1p0,
G0 = g3 + p3g2 + p3p2g1 + p3p2p1g0,
C1 = c4
= g3 + p3g2 + p3p2g1 + p3p2p1g0 + p3p2p1p0c0,
= G0 + P0C0.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 19 / 28
A 16-bit Adder
A 4-bit Adder
Four-bitAdder
a0 b0a1 b1a2 b2a3 b3
s0s1s2s3
C0
G0 P0
Therefore, the 4-bit adder will output P0 and G0 instead of c4.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 20 / 28
A 16-bit Adder
Four 4-bit Adders
Four-bitAdder
a4 b4a5 b5a6 b6a7 b7
s4s5s6s7
C1
G1 P1
Four-bitAdder
a0 b0a1 b1a2 b2a3 b3
s0s1s2s3
C0
G0 P0
Four-bitAdder
a12b12a13b13a14b14a15b15
s12s13s14s15
C3
G3 P3
Four-bitAdder
a8 b8a9 b9a10b10a11b11
s8s9s10s11
C2
G2 P2
Join together four such units.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 21 / 28
A 16-bit Adder
A 16-bit Adder
Four-bitAdder
a0..3 b0..3
s0..3
C0
G0 P0C1
Four-bitAdder
a4..7 b4..7
s4..7
G1 P1C2
Four-bitAdder
a8..11 b8..11
s8..11
G2 P2
Four-bitAdder
a12..15b12..15
s12..15
G3 P3 C3C4
carry out
Carry Look-ahead Unit
Add the carry look-ahead unit to compute the carry-in to each4-bit adder.The final carry C4 is the carry-out of the 16-bit adder.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 22 / 28
A 64-bit Adder
How would we design a 32-bit look-ahead adder?How would we design a 64-bit look-ahead adder?
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 23 / 28
Outline
1 Look-Ahead Adders
2 Propagate and Generate
3 A 16-bit Adder
4 Subtraction
5 Assignment
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 24 / 28
Assignment
AssignmentRead Section C.6.
Robb T. Koether (Hampden-Sydney College) The Look-Ahead Adder Wed, Oct 23, 2019 25 / 28
Recommended