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

Exercises 2.37 If n and m are both 4-bit 2\'s complement numbers, and s is the 4

ID: 3784512 • Letter: E

Question

Exercises 2.37 If n and m are both 4-bit 2's complement numbers, and s is the 4-bit result of adding them together, how can we determine, using only the logical operations described in Section 2.6, if an overflow occurred during the addition? Develop a "procedure" for doing so. The inputs to the procedure are n, m, and s, and the output will be a bit pattern of all zeros (0000) if no overflow occurred and 1000 if an overflow did occur. 2.38 If n and m are both 4-bit unsigned numbers, and s is the 4-bit result of adding them together, how can we determine, using only the logical operations described in Section 2.6, if an overflow occurred during the addition? Develop a "procedure" for doing so. The inputs to the procedure are n, m, and s, and the output will be a bit pattern of all zeros (0000) if nooverflow occurred and 1000 if an overflow did occur.

Explanation / Answer

2.37

.Cout carry out of adder

Cin Carry in

Case 1: 0 Cin, and 1 Cout (when we add two negative number ,and result is non nagative)

If a 0 is carried, then the only way that 1 can be carried out is if mk-1 = 1 and nk-1 = 1. That way, the sum is 0, and the carry out is 1.

Case 1: 1 Cin, and 0 Cout (when we add non negative number and get a negative number)

The only way 0 can be carried out if there's a 1 carried in is if mk-1 = 0 and nk-1 = 0. In that case, 0 is carried out, and the sum is 1.

So general formula become

Overflow occurs when v=1

(eq 1)Which can we written as

Overflow = (m[3] AND n[3] AND (NOT s[3])) OR ((NOT m[3]) AND (NOT n[3]) AND s[3])

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote