**Tom Kelliher, CS 315**

**Mar. 1, 999**

Collect homework.

Read 1.2.2.

Carry lookahead addition.

- Carry lookahead addition: Example and proof.

Parallel prefix computations.

- In general, the sum of two
**n**-bit numbers results in an**n+1**-bit sum. - The problem reduces to computing the carries.
- For each bit position we determine if it would
- Propagate a carry (p).
- Generate a carry (g).
- Stop a carry (s).

- Propagate a carry (p).
- Example:
`0xf53a`and`0xc796`. - The computation is carried out in a binary tree with addend, augend
bits transmitted to the leaves.
Dimensions of the tree?

- Steps of the computations:
- Step 1: compute p, g, s in the leaves.
- ascending steps:
- Receive inputs from children, who ``erase'' their values.
- Pass value received from right child to left child.
- Compute own value to pass to parent. What is the computation?

- Receive inputs from children, who ``erase'' their values.
- Special case for root:
- Its value becomes the carry-out (or additional sum bit).
Output this value.
- Set value to s.

- Its value becomes the carry-out (or additional sum bit).
Output this value.
- descending steps:
- Receive value from parent.
- Keep first non-p value received (including the value received
by a left child from a right child).

- Receive value from parent.

- Step 1: compute p, g, s in the leaves.
- When finished, all leaves are labeled either s or g. Which is a
carry-in of 0 and which is 1?
- We know no leaf will be ``stuck'' with a p. Why?
- The carry-in for a leaf is the left-most non-p value to the right of
the leaf, as originally computed by the leaves.
Prove that the algorithm stores this carry in each leaf.

Mon Mar 1 09:04:43 EST 1999