• retagged by
21,115 views
32 32 votes

Let $\text{R1}$ and $\text{R2}$ be two $4 – \text{bit}$ registers that store numbers in $2\text{’s}$ complement form. For the operation $\text{R1 + R2},$ which one of the following values of $\text{R1}$ and $\text{R2}$ gives an arithmetic overflow?

  1. $\text{R1 = 1011}$ and $\text{R2 = 1110}$
  2. $\text{R1 = 1100}$ and $\text{R2 = 1010}$
  3. $\text{R1 = 0011}$ and $\text{R2 = 0100}$
  4. $\text{R1 = 1001}$ and $\text{R2 = 1111}$

3 Answers

Best answer
22 22 votes

Option B

Note: A simple range measurement would be sufficient to tell whether the addition of similarly signed two numbers causes an overflow. See the last paragraph for a much simpler explanation.


Theory(Stub),

Knowing weighted code representation for identifying 2’s complement would help in identifying whether the number is positive or negative.

$$\begin{array}{|c|c|}\hline-2^{N-1}&2^{N-2}&2^{N-3}&.....&2^0\\\hline\end{array}$$

MSB=1
implies the number is negative and MSB=0 implies it’s positive(considering 0 on the positive spectrum).

In 2’s complement addition, an adder is used irrelevant of the sign of the two numbers, adding numbers with similar signs causes overflow, due to the inability to accommodate bits required to represent positive and negative parts of the number within fixed bit size. And, adding a number with different signs doesn’t cause overflow because they negate each other and therefore could be represented with the same or few number of bits.

 

Overflow for Positive Numbers,

$$\begin{array}{cccc}0&1&0&1\\0&1&1&1\\\hline\underline{1}&1&0&0\\\hline\end{array}$$

Here, the sign bit(MSB) is occupied by 1(a resultant from the positive component addition), there’s no other way to accommodate this number and maintaining 2’s complement nature without resorting to another bit.

 

Sign Bit Compaction for negative numbers,

$$\begin{array}{cccc}&1&1&0&1\\&1&1&1&1\\\hline\underline{-1}&\underline{+1}&1&0&0\\\hline&\underline{-1}&1&0&0\\\hline\end{array}\\$$

Here, we consider the addition of the Two MSB of a negative number leading to a larger negative component $-2^N$ but and there’s a positive component $2^{N-1}$ addition of these two would result in $-2^{N-1}$ which could be accommodated in the sign bit or simply omit the leftover carry.

 

Overflow for Negative Numbers,

$$\begin{array}{ccccc}&1&1&0&0\\&1&0&1&0\\\hline\underline{-1}&0&1&1&0\\\hline\end{array}$$

Unlike the previous example, there’s no way compacting the sign bit hence it, causes a overflow.



4bit 2’s complement range: $[-2^3,2^3-1]=[-8,7]$, convert the above options to decimal numbers and them to see whether they lie within the above range.

In Option B, we note that the addition of $1100(-4)$ and $1010(-6)$ results in $-10$ which is larger than what we could be able to accommodate in this range.

Or, the above case example concerning overflow for negative numbers.

• selected by
55 55 votes

Option B is correct:

Here, In this particular question:

 

• edited by
Answer:
Position:
Show:

Related questions

27 27 votes
5 5 answers
19.8k
19.8k views
Arjun asked Feb 15, 2022
19,797 views
Consider three floating point numbers $\textit{A, B}$ and $\textit{C}$ stored in registers $\text{R}_{\text{A}}, \text{R}_{\text{B}}$ and $\text{R}_{\text{C}},$ respectiv...
29 29 votes
3 3 answers
13.3k
13.3k views
Arjun asked Feb 15, 2022
13,304 views
Consider a digital display system $\text{(DDS)}$ shown in the figure that displays the contents of register $\text{X}.$ A $16 – \text{bit}$ code word is used to load a w...
40 40 votes
6 answers 6 answers
22.5k
22.5k views
Arjun asked Feb 15, 2022
22,501 views
A box contains five balls of same size and shape. Three of them are green coloured balls and two of them are orange coloured balls. Balls are drawn from the box one at a ...
112 112 votes
4 answers 4 answers
35.6k
35.6k views
Arjun asked Feb 15, 2022
35,617 views
Which one of the following statements is $\text{TRUE}$ for all positive functions $f(n)?$$f(n^{2}) = \theta (f(n)^{2}),$ when $f(n)$ is a polynomial$f(n^{2}) = o (f(n)^{2...