hw05SLN

# hw05SLN - ECE 212 HW 5 SOLUTIONS p 1 of 10 ECE 211 Homework...

This preview shows pages 1–4. Sign up to view the full content.

ECE 212 HW 5 SOLUTIONS p 1 of 10 ECE 211 Homework Set 5 SOLUTIONS 1. Let the signed integer N by represented by the 4-bit two's complement representation x3 x2 x1 x0 (x3 is the sign bit). (a) For what values of N will the 'Multiply by 2' circuit from lecture give an incorrect output? (b) Write a logic expression for the statement "The circuit output is incorrect." Your expression must be in terms of x3, x2, x1, x0 (although you may not need to use all of them). Solution: (a) When x3 = 0 and x2 = 1, the shift left products an incorrect result because the sign bit changes. The corresponding values of N are 4, 5, 6, 7. When x3 = 1 and x2 = 0 we have a similar problem. The values of N are – 8 1 0 0 0 – 7 1 0 0 1 – 6 1 0 1 0 – 5 1 0 1 1 (b) The circuit output is incorrect iff ( x3 = 0 ) · ( x2 = 1 ) + ( x3 = 1 ) · ( x2 = 0 ) iff ( x3 ' · x2 ) + ( x3 · x2 ' ) iff ( x3 x2 )

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
ECE 212 HW 5 SOLUTIONS p 2 of 10 2. For each addition problem below, the data represent signed integers using two's complement notation. (a) Perform the binary addition. (b) By examining the binary result, conclude whether overflow occurs or not. (c) Verify your answers in (b) by determining the signed integers being added. Solution: (i) 1 0 1 1 1 1 1 1 65 + 1 0 0 0 1 0 0 0 – 120 1 0 1 0 0 0 1 1 1 + 71 OVERFLOW; – 65 + ( – 120 ) + 71 (ii) 0 0 1 1 1 1 1 1 + 63 + 0 1 0 0 1 0 0 0 + 72 1 0 0 0 0 1 1 1 – 121 OVERFLOW; + 63 + ( + 72 ) 121 (iii) 1 0 1 1 1 1 1 1 65 + 1 1 0 0 1 0 0 0 56 1 1 0 0 0 0 1 1 1 –121 NO overflow; – 65 + (– 56 ) = –121
ECE 212 HW 5 SOLUTIONS p 3 of 10 3. In lecture we derived an expression for arithmetic overflow: V = X and Y have the same sign and Z has the opposite sign. = ( x3 ' · y3 ' · z3 ) + ( x3 · y3 · z3 ' ) Determine which, if any, of the expressions below also expresses arithmetic overflow. [ You can answer by either constructing a Truth Table, or explaining in words. For part (iv) use a table, as outlined below.] (i) V = ( x3 y3 ) ' ( x3 z3 ) (ii) V = ( x3 y3 ) ' ( y3 z3 ) (iii) V = ( x3 y3 ) ' ( x3 z3 ) ( y3 z3 ) (iv) V = ( z4 c3 ) where c3 is the carry in the fourth column, z4 is the fifth bit of the sum: c3 x3 x2 x1 x0 + y3 y2 y1 y0 z4 z3 z2 z1 z0 Solution: (i) ( x3 y3 ) ' is True iff x3 = y3 ; ( x3 z3 ) is True iff x3 z3. Therefore X, Y have the same sign, but Z has the opposite sign. This expresses overflow.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This homework help was uploaded on 04/17/2008 for the course ECE 212 taught by Professor Greco during the Spring '08 term at Lafayette.

### Page1 / 10

hw05SLN - ECE 212 HW 5 SOLUTIONS p 1 of 10 ECE 211 Homework...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online