Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(b) You are given an N-bit adder circuit to use in your processor design. Howeve

ID: 3698980 • Letter: #

Question

(b) You are given an N-bit adder circuit to use in your processor design. However, it does not indicate when overflow occurs and you can only attach wires to its input and output ports (i.e., you can't read internal carry wires). Its input ports are A-an-l...ajao, B-bn-1...bibo, and Cin. Its output ports are S-s-..s1so and Cout. Provide a Boolean expression for 2's complement overflow. Provide three example 4-bit adds that demonstrate your expression is correct. They should represent the following cases: two negative numbers (overflow), two positive numbers (no overflow), and two oppositely signed numbers. (10 points)

Explanation / Answer

The rules of overflow in 2's complement are:
- If the sum of 2 positive numbers yields a negative result, the sum has overflowed.
- If the sum of 2 negative numbers yields a positvie result, the sum has overflowed.
- Otherwise, no overflow

Let the two input numbers have sign bit x and y. And let the sign bit of result be z. So according to rules, over flow occurs if z is differnt from x and y
if x = y = 0 and z = 1
or x = y = 1 and z = 0

So the expression is x'y'z + xyz'


As we are taking 4 bit example, 3 bit will represent the number and 4 th bit will be the sign bit. As 3 bits will represent the number, maximum number is 7.

Two negative numbers

(-6) 1010
(-7) 1001
----------
1 0011
----------

-6 + (-7) = -13, which cannot be represented using 3 bits

x = 1, y = 1 and z = 0

x'y'z = 0 0 0 = 1
xyz' = 1 1 1 = 1

x'y'z + xyz' = 1 , hence overflow


Two positive numbers

(+2) 0010
(+3) 0011
----------
0101
-----------

2+3 = 5, Which can be represented using 3 bits

x = 0, y = 0, z = 0

x'y'z = 1 1 0 = 0
xyz' = 0 0 1 = 0
x'y'z + xyz' = 0, no overflow


A positive and negative number

(-1) 1111
(+7) 0111
-----------
1 0110
-------------

-1 + 7 = 6

x = 1, y = 0 , z = 0

x'y'z = 0 1 1 = 0
xyz' = 1 0 1 = 0
x'y'z + xyz' = 0, no overflow