| Carry lookahead | |||||||||||||
| Can calculate carries in parallel | |||||||||||||
| Tradeoff: need more hardware (space vs. time) | |||||||||||||
| Boolean expression for carry-out: | |||||||||||||
| cout = \xycin + x\ycin + xy\cin + xycin | |||||||||||||
| What does this expression look like? | |||||||||||||
| z = \abc + a\bc + ab\c + abc | |||||||||||||
| How many inputs? 3 | |||||||||||||
| How many need to be true? 2 | |||||||||||||
| What is that function called? | |||||||||||||
| Alternate expression for carry-out: | |||||||||||||
| cout = xy + xcin + ycin | |||||||||||||
| This means that there is a carry whenever at least 2 of the bits are 1 (possibly all 3). | |||||||||||||
| Call cin ci (carry-in for bit i) and cout ci+1 (carry-in for bit i+1) | |||||||||||||
| Distributive property: | |||||||||||||
| ci+1 = xiyi + ci(xi + yi) | |||||||||||||
| Define 2 new terms: | |||||||||||||
| gi = xiyi | |||||||||||||
| pi = xi + yi | |||||||||||||
| Then rewrite expression for ci+1 | |||||||||||||
| ci+1 = gi + pici | |||||||||||||
| gi is called the generate term | |||||||||||||
| it always generates a carry out, if equal to 1 | |||||||||||||
| pi is called the propagate term. | |||||||||||||
| it may generate a carry, depending on the carry-in (ci) | |||||||||||||
| if exactly one of xi or yi is 1, then the carry-in will determine the carry-out | |||||||||||||
| How can we get rid of the dependency on the carry-in? | |||||||||||||
| Let's look at the first carry: | |||||||||||||
| c1 = g0 + p0c0 | |||||||||||||
| The next one is: | |||||||||||||
| c2 = g1 + p1c1 | |||||||||||||
| Now we can plug in the expression for c1, which we just calculated: | |||||||||||||
| c2 = g1 + p1(g0 + p0c0) | |||||||||||||
| = g1 + p1g0 + p1p0c0 | |||||||||||||
| How do we get the right side of this expression? | |||||||||||||
| Since g1 and p1 depend only on x1 and y1, | |||||||||||||
| and g0 and p0 depend only on x0 and y0, | |||||||||||||
| and c0 depends only on x0 and y0 (there is no carry-in for the addition of bits 0), | |||||||||||||
| we can get c2 right away without waiting for c1! | |||||||||||||
| Likewise, | |||||||||||||
| c3 = g2 + p2c2 | |||||||||||||
| = g2 + p2(g1 + p1g0 + p1p0c0) | |||||||||||||
| = g2 + p2g1 + p2p1g0 + p2p1p0c0 | |||||||||||||
| Following the same pattern, | |||||||||||||
| c4 = g3 + p3g2 + p3p2g1 + p3p2p1g0 + p3p2p1p0c0 | |||||||||||||
| The circuit uses full adders, but the output of one | |||||||||||||
| is not directly connected to the input of the next | |||||||||||||