Question

Consider an eight-bit ripple-carry adder for computing the sum of AA and BB, where AA and BB are integers represented in 2's complement form. If the decimal value of AA is one, the decimal value of BB that leads to the longest latency for the sum to stabilize is ________.

Official answer and solution
Official answer
-1
From
Official GATE 2016 answer key

Solution

Identify the bit pattern required to propagate the carry across all 8 stages of the ripple-carry adder.

In an 8-bit ripple-carry adder, each 1-bit full adder ii (0≤i≤70 \le i \le 7) computes:

Si=Ai⊕Bi⊕CiS_i = A_i \oplus B_i \oplus C_i
Ci+1=AiBi+Ci(Ai⊕Bi)C_{i+1} = A_i B_i + C_i (A_i \oplus B_i)

The latency is maximal when a carry is generated at the least significant bit (i=0i = 0) and ripples through all subsequent bits up to bit 7 (C1→C2→⋯→C8C_1 \to C_2 \to \dots \to C_8).

Given A=1A = 1, its 8-bit representation is:

A=000000012A = 00000001_2

So A0=1A_0 = 1 and Ai=0A_i = 0 for all 1≤i≤71 \le i \le 7.

To achieve maximum propagation delay:

  1. At bit 0: With C0=0C_0 = 0, a carry must be generated: C1=A0B0=1⋅B0=1  ⟹  B0=1C_1 = A_0 B_0 = 1 \cdot B_0 = 1 \implies B_0 = 1.
  2. At each bit ii (1≤i≤71 \le i \le 7): Since Ai=0A_i = 0, the carry propagation condition is:
    Ci+1=Ci(Ai⊕Bi)=Ci(0⊕Bi)=CiBiC_{i+1} = C_i (A_i \oplus B_i) = C_i (0 \oplus B_i) = C_i B_i
    To ensure Ci+1=1C_{i+1} = 1 whenever Ci=1C_i = 1, we must have Bi=1B_i = 1 for all i=1,2,…,7i = 1, 2, \dots, 7.

Thus, the required 8-bit value of BB is:

B=111111112B = 11111111_2

In 8-bit 2's complement representation:

111111112=−27+∑i=062i=−128+127=−111111111_2 = -2^7 + \sum_{i=0}^6 2^i = -128 + 127 = -1

Therefore, the decimal value of BB is -1.

Final answer

-1

Common trap

Interpreting 11111111 as 255 (unsigned) rather than -1 (signed 2's complement).

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2016 Computer Science and Information Technology (CS) Session 2
Question
17 of 65, printed as CS Q.7
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.