← ProblemsVerilog Language / Modules: Hierarchy

Carry-select adder

15%hierarchyarithmeticmux

A ripple-carry adder is slow because the upper half must wait for the lower half's carry. A carry-select adder computes both possibilities for the upper half in parallel, then picks the right one once the carry is known.

Using three instances of the provided add16 ({cout, sum} = a + b + cin), build a 32-bit carry-select adder:

  1. One add16 adds the lower 16 bits with cin = 0; its sum drives sum[15:0].
  2. Two more add16s both add the upper 16 bits — one assuming cin = 0, the other assuming cin = 1.
  3. A 16-bit 2-to-1 multiplexer (which you write yourself) selects between the two upper sums: when the lower adder's carry-out is 0 pick the cin=0 result, when it's 1 pick the cin=1 result. The mux output drives sum[31:16].

The final carry-out is discarded.