Skip to content
GATEiit

GATE CSE · Computer Organization and Architecture

Design of arithmetic and logic unit (ALU)

How an ALU adds, subtracts, multiplies and shifts: ripple-carry and carry-lookahead adders and their delays, the adder-subtractor, overflow and status flags, and Booth's multiplication.

Before you start

This topic comes before: Number representation and arithmetic (fixed and floating point)

Concept notes

1. Full adder and ripple-carry adder

A full adder (FA) adds bits ai, bi and carry-in ci: si=ai⊕bi⊕ci,ci+1=aibi+ci(ai⊕bi).

An n-bit ripple-carry adder (RCA) chains n full adders; each carry-out feeds the next carry-in. It is cheap (n full adders) but slow, because bit i cannot settle until ci has rippled through all lower stages.

Delay model. Let one FA produce its carry tc after its inputs are ready and its sum ts after. All ai,bi and c0 are ready at time 0. Then

  • ci is ready at i tc, so the final carry cn at n tc;
  • the last sum sn−1 is ready at (n−1) tc+ts.

The addition is complete at the later of the two. Delay grows linearly in n.

When the FA is drawn as two half adders plus an OR gate, tc is often 2 gate delays and ts 2 or 3, depending on how XOR is counted. Always use the delays the question gives.

FA3a3b3s3c3FA2a2b2s2c2FA1a1b1s1c1FA0a0b0s0c0c4
4-bit ripple-carry adder: the carry passes through every stage, right to left

2. Carry-lookahead adder

A carry-lookahead adder (CLA) computes every carry directly from the inputs. Define for each bit

  • generate gi=aibi (this bit makes a carry by itself),
  • propagate pi=ai⊕bi (this bit passes an incoming carry on).

Then ci+1=gi+pici. Expanding, c1=g0+p0c0,c2=g1+p1g0+p1p0c0, c4=g3+p3g2+p3p2g1+p3p2p1g0+p3p2p1p0c0. Each carry is a two-level AND–OR expression, and si=pi⊕ci.

Standard delay model (one gate = 1 unit, unlimited fan-in): g,p at 1; every carry at 1+2=3; every sum at 4. This is constant, independent of n.

The catch is fan-in and gate count: cn needs an AND gate with n+1 inputs. So real designs use 4-bit CLA blocks. If the blocks are joined by rippling carries, block j's carry-out appears 2 units after its carry-in. A second lookahead level (block generate G and block propagate P) removes even that ripple.

Adder Delay Hardware
Ripple carry O(n) n full adders
Full CLA O(1) levels, large fan-in grows quickly with n
CLA blocks, rippled O(n/4) moderate
Multi-level CLA O(log⁡n) moderate

3. Adder-subtractor, overflow and flags

Subtraction uses A−B=A+B‾+1. An adder-subtractor feeds each bi through an XOR gate with a control line M, and also sets c0=M:

  • M=0: XOR passes bi, c0=0, result A+B;
  • M=1: XOR inverts bi, c0=1, result A−B.

Signed overflow (two's complement) happens when two operands of the same sign give a result of the other sign. In hardware, V=cn⊕cn−1, the carry into the sign bit XOR the carry out of it. Adding numbers of opposite signs never overflows.

Unsigned results: on addition, carry-out cn=1 means the true sum did not fit. On subtraction A+B‾+1, carry-out 1 means A≥B (no borrow).

Status flags set by the ALU:

Flag Set when
Z (zero) result is all zeros
N or S (sign) result's MSB is 1
C (carry) carry out of the MSB
V (overflow) signed overflow, cn⊕cn−1

Shifts. A logical right shift brings in 0; an arithmetic right shift copies the sign bit, so it divides a signed number by 2 rounding towards −∞. A left shift by one multiplies by 2 (overflow if the sign bit changes).

4. Multiplication and Booth's algorithm

Shift-and-add multiplication adds the shifted multiplicand once for every 1 bit of the multiplier. It handles unsigned numbers directly.

Booth's algorithm multiplies two's complement numbers and skips over runs of 1s. Append q−1=0 to the right of the multiplier Q. Scan pairs (qi,qi−1) from the LSB:

(qi,qi−1) Action Recoded digit
0 0 shift only 0
1 1 shift only 0
1 0 subtract multiplicand, shift −1
0 1 add multiplicand, shift +1

All shifts are arithmetic right shifts of the combined accumulator and multiplier register.

A run of 1s from bit j up to bit k equals 2k+1−2j, so it costs one subtraction and one addition however long it is. For example 00111100=60 recodes to 0 +1 0 0 0 −1 0 0, that is 64−4.

  • Best case: long runs of 0s or 1s, very few operations.
  • Worst case: alternating bits such as 0101…, where every position is an add or subtract, so n operations for an n-bit multiplier (worse than shift-and-add's count of 1 bits).

Count of add/subtract operations = number of nonzero digits in the Booth recoding = number of positions where qi≠qi−1.

Formulas to remember

Full adder sum
si=ai⊕bi⊕ci
Full adder carry
ci+1=aibi+ci(ai⊕bi)
Generate and propagate
gi=aibi,pi=ai⊕bi,ci+1=gi+pici
Ripple-carry delay
T=max⁡(n tc,  (n−1) tc+ts)
Signed overflow
V=cn⊕cn−1
Subtraction
A−B=A+B‾+1

Common mistakes

  • Taking the final carry time as the total delay of a ripple adder; the last sum bit can finish later.
  • Treating carry-out 1 as signed overflow; signed overflow is cn⊕cn−1.
  • Forgetting that Booth's worst case is alternating bits, not all 1s.
  • Assuming a CLA has constant delay for any width; fan-in limits force blocks, and rippled blocks add 2 delays each.
  • Doing a logical right shift on a signed number when the question says arithmetic shift.

Worked examples

Try each step yourself, then reveal the working.

Example 1: Delay of a 16-bit ripple-carry adder

numerical

Each full adder produces its carry-out 2Δ and its sum 3Δ after its inputs are stable. All operand bits and c0 are ready at time 0. When is a 16-bit ripple-carry addition complete?

  1. Step 1: When does carry c_i become stable?

    Try it on paper first.

Example 2: 16-bit adder from 4-bit CLA blocks

numerical

A 16-bit adder uses four 4-bit carry-lookahead blocks; the carry-out of each block ripples into the next. Inside a block, gi,pi take 1 gate delay, a carry takes 2 more gate delays after its inputs are ready, and a sum takes 1 more after its carry. How many gate delays until all sum bits are ready?

  1. Step 1: Find the carry-out of the first block.

    Try it on paper first.

Example 3: Booth recoding saves operations

numerical

The multiplier is the 8-bit number 00111100. How many additions and subtractions does Booth's algorithm perform, and how many additions does plain shift-and-add perform?

  1. Step 1: Append a 0 to the right of the LSB and list the pairs.

    Try it on paper first.

Example 4: Detecting overflow from the carries

conceptual

In 4-bit two's complement, add (i) 0110+0011 and (ii) 1100+1110. Which one overflows, and how does the hardware know?

  1. Step 1: Add (i) bit by bit and note the last two carries.

    Try it on paper first.

Previous year questions

2 official GATE CSE questions on this topic, newest first.

Practise these 2 PYQs →

Topic test

10 questions: up to 2 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE CSE syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.