2,039 views

1 Answer

Best answer
9 votes
9 votes

1. Why 1's complement number cannot represent an overflow?

Of course, We can.

Say, We have two numbers in 1's comp format and We add them. Let $a_{n}$ and $b_{n}$ be the MSB bits of the Two numbers being added and $S_{n}$ be the MSB bit ($n_{th} \,bit \,\,from \,\,the \,\,left$ ) of the result and Let $C_{out}$ be the Carry (End Around Carry ) out of MSB while adding the numbers. 

Unlike in 2's comp addition, Here in 1's comp addition we add the $C_{out}$ (End Around Carry ) to the result (to the LSB of the result) before checking for Overflow. So, After adding the numbers, Add the $C_{out}$ to the resulted $n \,\,bits$ at the LSB. And After this addition of End Around Carry to the result, I'll represent the MSB of final resultant number as $R_n$

Now, We can give condition for Overflow which is as following :

We will say that Overflow has occurred if $a_nb_n\overline{R_n}+\overline{a_n}\overline{b_n}R_n = 1$

NOTE 1 :   We can represent $0$ with Two binary representation in 1's comp format and This above procedure of detecting overflow in 1's comp addition will work for both representation of $0$.

NOTE 2 :  When Overflow does not occur, We will say that the Final Result (After addition of End Around Carry) is Correct result.

And When Overflow occurs, We will say that the Final result is Wrong Result.


Is signed bit need to detect overflow?

Is Sum bit (not carry bit) participate to detect overflow?

Specific overflow detection requires knowing the operation and the representation

Overflow occurs when you do some operation to two valid representations  and the result can not be represented in the representation because the value is too large or too small Overflow detection is detecting overflow for a specific representation

So, Let's talk about 2's comp addition...You would not need Sign bit to detect overflow if I already give you $C_{in}$ and $C_{out}$.  And Similarly, You will definitely need the Sum bit to detect Overflow if I don't give you $C_{in}$ and $C_{out}$ But You only have the MSB bits of the Two numbers being added. In 2's comp addition, We have Two conditions to detect overflow, One is $a_nb_n\overline{S_n}+\overline{a_n}\overline{b_n}S_n = 1$ and Other is $C_{in} \oplus C_{out} = 1$ 

edited by

Related questions

0 votes
0 votes
0 answers
1
lolalo asked Jul 15, 2022
499 views
How overflow can be detected in BCD Arithmetic?
2 votes
2 votes
1 answer
2