Overflow in Binary Arithmetic. Discussion with examples.

Overflow Introduction and scenarios.

In terms of computing, two  numbers are loaded into registers before performing any arithmetic operations.  For a number between 0 to 15 we can use a register of length 4 bits.  When two 4 bit numbers are added and the result is greater than 4 bits then we get an overflow condition.

Overflow can occur in either of the two following scenarios:-

Adding two positive numbers.
Or, Adding two negative numbers in signed arithmetic.

Overflow can never occur when adding a positive number to a negative number

LTE - 4G Wireless Technology

Digital fundamentals.

Interview Questions.

The reason being the result is always smaller than the original larger number. We will discuss the overflow condition with examples below:-  

Example1 - Add 2 unsigned binary numbers.
Add two binary numbers 10 and 15 with previous carry = 0.

Sol. Load the values in two registers R1 and R2. 

So, R1 = 10 (decimal) = 1010 (in binary A3A2A1A0)
&   R2 = 15 (decimal) = 1111 (in binary B3B2B1B0)
Also Refer example on the  binary adder  discussion page.
Result = (Carry = 1) (Sum = 1001) 

In this case Overflow is true and result includes the overflow bit. We can use a separate flip-flop to store the result of overflow condition.

Tutorials @fullchipdesign.com

Verilog Tutorial.

LTE Tutorial.

Memory Tutorial.

Hope you liked! this page. Don't forgot to access relevant previous and next sections with links below.