advertisement

CSE207 FALL 2001 SELECTED EXERCISES TO HELP WITH REVIEWING FOR EXAM1 SOLUTIONS Note: Solutions to some of these problems will be posted on the web 1. a) Give the binary equivalent of the following: 110.37510 Find the solution in two steps. First convert the integer part using successive division by 2 (base r=2). Next, convert the fractional part by successive multiplication by 2 Step 1: This step is easy. 11010 = 11011102 Step 2: Binary equivalent of the fractional part (0.375)10 Digit or coefficient 0.375 X 2 = 0.75 = 0 + .75 0 0.750 X 2 = 1.50 = 1 + .50 1 0.500X 2 = 1.00 = 1 + .00 1 Result: 110.37510 = 1101110.0112 Note: Check the above result by using the polynomial expansion expression (see page 26 of text) 271.02010 same idea as above b) Convert each of the following to its equivalent in base 2, 4 and 5 254 Remainder Remainder 254/2 = 127 0 254/4 = 63 2 127/2 = 63 1 63/4 = 15 3 63/2 = 31 1 15/4 = 3 3 63/2 = 31 1 3/4 = 0 3 31/2 = 15 1 15/2 = 7 1 254/5 = 50 4 7/2 = 3 1 50/5 = 10 0 3/2 = 1 1 10/5 = 2 0 1/2 = 0 1 2/5 = 0 2 Result: 25410 = 1111111102 = 33324 = 20045 35 Same as above 327.020 Base 2: Use the same method as in 1.a) above and allowing for 6 digits after the decimal point, the correct answer is (check this …): 101000111.000001 Base 5: Use same method as above, except that the base r=5. So use successive division by 5 for integer part and successive multiplication by 5 for fractional part. Integer part: 327 5 65 5 13 5 2 5 0 2 0 3 2 Fractional part: .020 x 5 = 0 + .1 .100 x 5 = 0 + .5 .500 x 5 = 2 + .5 .500 x 5 = 2 + .5 …. Result = (2302.00222222 …..)5 c) Perform the following: subtract 2110 from 8310 in binary Two possible solutions: either subtract the binary equivalent of 21 from the binary equivalent of 83 or add the complement of the binary equivalent of 21 to the binary equivalent of 83 A) 1111000 borrow 10100112 00101012 ---------------01111102 B) Compute the 2's complement of 21: 1101011 83 = - 21 = 83 + 21C = = 10100112 11010112 (2's complement of 21) ---------------0 01111102 ( discard carry out of the sign bit ) subtract 8310 from 2110 in binary same as above d) Convert each following base-r integer to the equivalent base-10 integer: 1101012 1010102 2312304 1ABF216 0003425 For the above problems, compute the polynomial expansion expressions and perform the required operations. 2. Do the following exercises from the text book: Page 301 4.5 on page 301 (hint: use parentheses) A function and its complement cannot be 1 for the same input combination. What is wrong in this problem is the expression for the complement. In fact, if you include parentheses in the expression X + YZ before computing the complement, the result is : (X + YZ)' = (X + (YZ))' = X' . (YZ)' by De Morgan's theorem = X' (Y' + Z') (which is not X'Y' + Z' as stated in the problem) Now for the input combination XYZ = 110 : X + YZ is 1 and X'(Y' + Z') is 0 (which makes more sense) Page 302 4.7 a), b), 4.8 a), c), h) These problems are easy. Everyone should know how to write these truth table 4.9 a), c), e) The canonical sum and product are the standard sum of products (SOP) and product of sums (POS) Representation of logic functions: F = X,Y (1,2) = m1 + m2 = X'Y + X Y' (SOP) a) For the product of sum, note that: F = X,Y (0,3) = M0 + M3 = (X+Y) . (X ' + Y') (SOP), if you multiply this out you the SOP expression Same as above Two possible solutions: either you write a truth table for F and read out the SOP expression from the table or you use boolean algebra to obtain the canonical SOP. The first solution is easy. I will give the second solution: c) e) F = X + Y' Z' : the expression has three input variables. So we should make sure that each product term (in the final result) contains all three input variables. So using boolean algebra : F = X + Y' Z' = X(Y+Y') + (X + X')Y'Z' multiply out = XY + XY' + XY'Z' + X'Y'Z' repeat for the first two products = XY(Z + Z') + (XY'(Z + Z') + XY'Z' + X'Y'Z' multiply out = XYZ + XYZ' + XY'Z + (XY'Z' + XY'Z') + X'Y'Z' = XYZ + XYZ' + XY'Z + XY'Z' + X'Y'Z' Check this by drawing the truth table of the function Page 304 4.32 Consensus theorem. I discuss this in class 3. a) Write a truth table for a circuit that accepts three inputs A, B and C. the circuit is to output a 1 when a majority of the inputs are 1, except when A and B are 1 and C is 0. b) Write the canonical sum of products (SOP) expression corresponding to the circuit. c) Draw the circuit using And, Or and Not gates d) Using Boolean algebra, simplify the expression found in b) above. e) Draw the new circuit corresponding to the expression found in d) a) Truth table A B C Output 0 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 b) sum of product expression of the output F(A,B,C) = A,B,C (3,5,7) = A'BC + AB'C + ABC c) Draw circuit …… with 3 and gates, two not gates and two or gates d) Simplification of expression found in b) F(A,B,C) = A'BC + AB'C + ABC = A'BC + AB'C + ABC + ABC by theorem T3 (for ABC) = A'BC + ABC + AB'C + ABC = (A' + A) BC + (B' + B)AC by theorem T8 = BC + AC by theorem T5 = C(A+B) Note that we can factor out C in the first step …. e) Draw the new circuit : either as an AND-OR circuit (with 2 2-input AND gates and 1 2-input OR gate) or as OR-AND circuit 4. Complement the following Boolean expressions ( A, B, C, D are variables ) A' + (AB)'(A+C' + A'B') A'(B' + C')(A + B + C') (A' + B + B'C')(A + B'C) + D' ((CD)' + A)' + A + CD + AB AB + A'B + ABC'D You are asked to compute the complements of the above functions. Apply De Morgan's theorem. I will give a solution for the first expression: (A' + (AB)'(A+C' + A'B'))' = A + ((AB)'(A+C' + A'B'))' = A + AB + (A+C' + A'B')' = A + AB + A'C'(A'B')' = A + AB + A'C'(A+B) = A + AB + A'C'A + A'BC' = A + AB + A'BC' = A(1 + B) + A'BC' = A + A'BC' = (A+A')(A + BC') = A + BC' 5. Simplify the following Boolean expressions and draw the corresponding logic circuit ABC + BCD + AB'D' + A'BCD' + A'B'D' = ABC + BCD+ A'BCD' + (A'+A)B'D' = BC (A + D + A'D') + B'D' = BC + B'D' Note that (A+D+A'D') is 1. To prove that we can write the expression as: A + D + A'D' = = = = = = A + D + A'D' + A'D' by theorem T3 A + A'D' + D + A'D' (A+A')(A+D') + (D+D')(D+A') by theorem T8' A + D' + D + A' by theorem T5 1+1 by theorem T5 1