When two 8-bit numbers \(A_{7}\cdots A_{0}\) and \(B_{7}\cdots B_{0}\) in 2's…
2017
When two 8-bit numbers \(A_{7}\cdots A_{0}\) and \(B_{7}\cdots B_{0}\) in 2's complement representation (with \(A_{0}\) and \(B_{0}\) as the least significant bits) are added using a ripple-carry adder, the sum bits obtained are \(S_{7}\cdots S_{0}\) and the carry bits are \(C_{7}\cdots C_{0}\). An overflow is said to have occurred if
- A.
the carry bit
\(C_{7}\)is - B.
all the carry bits
\(\left ( C_{7},\cdots ,C_{0} \right )\)are 1 - C.
\(\left ( A_{7} \cdot B_{7} \cdot \overline{S_{7}}+\overline{A_{7}} \cdot \overline{B_{7}} \cdot S_{7} \right )\)is 1 - D.
\(\left ( A_{0} \cdot B_{0} \cdot \overline{S_{0}}+\overline{A_{0}} \cdot \overline{B_{0}} \cdot S_{0} \right )\)is 1
Attempted by 382 students.
Show answer & explanation
Correct answer: C
Answer: (A7 · B7 · ¬S7) + (¬A7 · ¬B7 · S7) is 1
Explanation:
Key idea: Two's complement overflow occurs when two operands with the same sign produce a sum with the opposite sign.
Algebraic condition: The expression (A7 AND B7 AND NOT S7) OR (NOT A7 AND NOT B7 AND S7) captures the two cases that cause overflow:
• Both operand sign bits are 1 and the result sign bit is 0 (negative + negative -> positive).
• Both operand sign bits are 0 and the result sign bit is 1 (positive + positive -> negative).
Relation to carries: This sign-bit test is equivalent to testing whether the carry into the most significant bit differs from the carry out of the most significant bit (i.e., carry-into-MSB XOR carry-out-of-MSB).
Short examples:
Example 1: 01000000 (64) + 01000000 (64) = 10000000 (interpreted as -128). Both operands had sign 0 but the result has sign 1, so overflow occurred.
Example 2: 10111111 (-65) + 10111111 (-65) = 01111110 (126). Both operands had sign 1 but the result has sign 0, so overflow occurred.
Conclusion: The given logical expression correctly detects two's complement overflow by checking whether two operands of the same sign produce a sum with the opposite sign, which is equivalent to the carry-in XOR carry-out test at the most significant bit.
A video solution is available for this question — log in and enroll to watch it.