University of California, Berkeley EE 42/100 Spring 2012 Prof. A. Niknejad Problem Set 8 Solutions Please note that these are merely suggested solutions. Many of these problems can be approached in different ways. 1. (a) In decimal, we have B5216 = 11 × 162 + 5 × 161 + 2 × 160 = 2898. In binary, this becomes B5216 = 101101010010b . Clearly, 12 bits are required. (b) In hexadecimal form, 1010110b = 5616 . In decimal, 5616 = 5 × 161 + 6 × 160 = 86. (c) Using two’s complement, 34 = 0100010b and −57 = 1000111b . Adding them together gives us 34 − 57 = −23, which in binary is 1101001b . 2. (a) Using a truth table, only the rows with two or three 1’s should result in F = 1. A B 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1 C 0 1 0 1 0 1 0 1 F 0 0 0 1 0 1 1 1 (b) F = ABC + ABC + ABC + ABC = AB + BC + AC (c) Below is the logic circuit for the simpler expression (if you did it for an equivalent but more complicated expression, that’s ok too). A B F C 3. To prove the identity using Boolean algebra, we can call the expression F and show that the results are the same as the A input column. A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 F 0 0 0 0 1 1 1 1 Using Boolean algebra, we first combine the first term with the last term, as well as the middle two terms: ABC +ABC +AB C +ABC = AC(B +B)+AC(B +B) = AC +AC = A(C +C) = A 4. (a) To find a minimal expression, we can simplify using Boolean algebra: F = ABC D + ABCD + ABCD + ABCD = ABD(C + C) + BCD(A + A) = ABD + BCD C D B F A (b) One way to find a POS expression is to invert F and write the SOP expression: F = A D + B + CD. Now invert the expression once more and apply DeMorgan’s laws: F = (A + D)B(C + D). 5. Note that F is high if the first switch is open AND at least one of the two right switches is open: F = A(B + C). B C A F 6. (a) To multiply by 2n in binary, simply shift the number to the left by n bits and add in trailing 0s (just like how we do for multiplying by powers of 10 in decimal). To divide, add a decimal point to the end of the number and shift the number to the right by n bits. (b) For a circuit with n input variables, there are 2n different n combinations of inputs. But if we also count outputs, then we have 2(2 ) combinations. To see this, imagine that each of the 2n rows of inputs has a corresponding output. All together then, the output is a binary string of length 2n . 2 How many possible realization of this bit string do we have? A bit string of length M n can take on 2M values, and now M = 2n , which gives us the desired result of 2(2 ) . This grows very quickly. While for 2 inputs, it’s simply 16 functions, but for 10 inputs it’s a whopping number: 1797693134862315907729305190789024733617976978942306572734300811577326758055 0096313270847732240753602112011387987139335765878976881441662249284743063947 4124377767893424865485276302219601246094119453082952085005768838150682342462 8814739131105408272371633505106845862982399472459384797163048353563296242241 37216 3