Computer Arithmetic
In a carry-lookahead adder, which gives the definitions of each bit's generate signal g and propagate signal p (a and b are that bit's inputs) and the carry into the next bit, c(i+1)?
- Ag = a + b, p = a·b, c(i+1) = p + g·c(i)
- Bg = a·b, p = a ⊕ b, c(i+1) = g + p·c(i)
- Cg = a ⊕ b, p = a·b, c(i+1) = g·p·c(i)
Show answer and explanation
Answer: B. g = a·b, p = a ⊕ b, c(i+1) = g + p·c(i)
If a and b are both 1, a carry is produced regardless of the incoming carry, so the generate signal is g = a·b. If exactly one of them is 1, the incoming carry passes upward, so the propagate signal is p = a ⊕ b (OR is also used). Hence c(i+1) = g(i) + p(i)·c(i); expanding this lets every carry be computed in parallel with two-level logic from the g and p signals and the lowest carry alone. Formulas that swap generate and propagate do not compute correctly.
- A. The definitions of g and p are swapped, and the formula is wrong.
- B. Correct. g = a·b, p = a ⊕ b, c(i+1) = g + p·c(i).
- C. The definitions are swapped and the formula is an all-AND, which is wrong.