### V22.0436 - Prof. Grishman

### Lecture 10 - Carry look-ahead

(text, section 4.5)

(discuss MIPS ALU - lecture 9 notes)

#### Carry look-ahead

- simplest adder is "ripple carry" slow (delay time linear
in size of operands)
- add time is usually critical in determining overall cycle time of a
machine
- can speed up addition by introducing notion of "carry generate"
and "carry propagate"

gi = ai * bi

pi = ai + bi
- this can be used to compute carries:

c1 = g0 + (p0 * c0)

c2 = g1 + (p1 * g0) + (p1 * p0 * c0)

c3 = g2 + (p2 * g1) + (p2 * p1 * g0) + (p2 * p1 * p0 * c0)

c4 = g3 + (p3 * g2) + (p3 * p2 * g1) + (p3 * p2 * p1 * g0) + (p3 * p2
* p1 * p0 * c0)
- we get greater savings when we build an 8-bit adder, and compute generate
and propagate values for each 4-bit group. Note that group values are
designated by capital letters.

P0 = p3 * p2 * p1 * p0

P1 = p7 * p6 * p5 * p4

G0 = g3 + (p3 * g2) + (p3 * p2 * g1) + (p3 * p2 * p1 * g0)

G1 = g7 + (p7 * g6) + (p7 * p6 * g5) + (p7 * p6 * p5 * g4)
- we can use these to compute the carry from bit 3 to bit 4 (C1 = c4)
and the carry out of bit 7 (C2 = c8):

C1 = G0 + (P0 * c0)

C2 = G1 + (P1 * G0) + (P1 * P0 * c0)
- carries c5, c6, and c7 can be computed using c4 (C1)
- this same design can be readily extended to 16 bits (see text), with
no additional delay
- for a 64-bit adder, we would compute generate and propagate on 16-bit
super-groups, adding 4 more gate delays
- in general, delay time with carry look-ahead is
*logarithmic*
in the size of the operands