Lecture Adders Half adder
Full Adder si is the modulo-2 sum of ci, xi, yi.
An n-bit Ripple Adder FA Xn-1 Yn-1 Sn-1 Cn-1 Cn X0 Y0 ……… C1 FA C0 S0 MSB LSB
Adder/subtractor - = add 2’s complement of the subtrahend y xor 0 = y; y xor 1 = ~y s 1 n – x c -bit adder y Add ¤ Sub control
Overflow v.s. Carry-out n-bit signed number: -2n-1 to 2n-1 -1 Detect overflow for signed number: Overflow = Cn-1 ⊕ Cn Overflow = Xn-1 Yn-1 ~Sn-1 (110) + ~Xn-1 ~Yn-1 Sn-1 (001) where X and Y represent the 2’s complement numbers, S = X+Y. (sign bits 0, 0 ≠ 1 ) 0111 1111 Carry-out: for unsigned number
Propagate and Generate ripple carry ci+1 = xiyi + (xi+yi)ci = gi + pici A ripple-carry adder: critical path = 2n + 1 x 1 y g p s Stage 1 Stage 0 c 2
Propagate and Generate Carry-Lookahead ci+1 = xiyi + (xi+yi)ci = gi + pici = gi + pi (gi-1 + pi-1ci-1) = gi + pigi-1 + pipi-1gi-2 + …+ pipi-1 …p2p1g0 + pipi-1…p1p0c0 For instance, c1 = g0 + p0c0 c2 = g1 + p1g0 + p1p0c0
Propagate and Generate Carry-Lookahead c1 = g0 + p0c0 c2 = g1 + p1g0 + p1p0c0 3 gate delays x 1 y g p s c 2 D1 D2 D3
A Multiplier Array and adder
Array of Adders for Unsigned Multiplication 4-bit example