By Pakita Shamoi, Spring 2013 1 Q1: How can we find 1s and 2s compliments of a binary number ? What is their practical usage? Give example. The rs compliment: is found by raising the base r to the number of digits in the number then subtracting the number from this. Using base 2, the 2s compliment of 1010 is (2 4 ) 10 1010 = 10000 1010 = 0110 Another way to find the 2s compliment is to start with the right most digit, if it is a 0 then write 0 until you come to the first 1 then write 1, but for all the digits to the left of the first one you must reverse (if it is 0 write1 or if it is 1 write 0). The (r-1)s compliment: is found by raising the base r to the number of digits in the integer number then subtracting the base r raised to the negative number of digits in the fraction number and subtracting the number from this. Using base 2, the 1s compliment of 1010 is (2 4 ) 10 1 - 1010 = 1111 1010 = 0101 Another way to find the 1s compliment is to reverse all of the digits (if it is 0 write1 or if it is 1 write 0). Compliment numbers are used for binary subtraction in computers. Subtracting with the rs compliment: add the first number to the rs compliment of the second number. if a left side carry happens delete it. if no left side carry happens, then take the rs compliment of the answer and make it negative. For example 1001 1010 = 1001 + 0110 = 1111 (no carry) so (10000 1111) = - 0001 2 By Pakita Shamoi, Spring 2013 Q2: How can you perform number base conversion of fractions? Give example. Conversion of integers: divide by the base that you are converting into. Keep the remainder as a coefficient. Then divide the new result by the base, and keep the remainder. Do this until you cannot divide any more. The remainders are the new number in the new base. Conversion of fractions: multiply by the base that you are converting into. Keep the integer as a coefficient. Then multiply the new fraction by the base, and keep the integer. Do this until there is no fraction part or you have enough digits. if the number has an integer and fraction part, then it is easier to convert them separately (in two parts). For example 26.625 First convert the integer 26 Integer remainder coefficient 26 / 2 = 13 0 a 0 =0 13 / 2 = 6 1 a 1 =1 6 / 2 = 3 0 a 2 =0 3 / 2 = 1 1 a 3 =1 1 / 2 = 0 1 a 4 =1 so the binary number for 26 = 11010 Second convert 0.625 into binary: 0.625 x 2 = 1.25 1 +0.25 a -1 =1 0.25 x 2 = 0.5 0 +0.5 a -2 =0 0.5 x 2 = 1.0 1 +0 a -3 =1 so the binary number for 0.625 = 0.101 3 By Pakita Shamoi, Spring 2013 Q3: Design a base 6 binary code where the 5s compliment of the code can be found by replacing 1 with 0 and 0 with 1. Show in a table the decimal number, its base 6 code, and its 5s compliment? Also show the calculations to prove the 5s compliment? Decimal number Base 6 code 5s compliment 0 000 111 1 001 110 2 010 101 3 101 010 4 110 001 5 111 000 The 5s compliment of 0 is (6 1 ) 6 1 0 = 5 0 = 5 The 5s compliment of 1 is (6 1 ) 6 1 1 = 5 1 = 4 The 5s compliment of 2 is (6 1 ) 6 1 2 = 5 2 = 3 The 5s compliment of 3 is (6 1 ) 6 1 3 = 5 3 = 2 The 5s compliment of 4 is (6 1 ) 6 1 4 = 5 4 = 1 The 5s compliment of 5 is (6 1 ) 6 1 5 = 5 5 = 0 4 By Pakita Shamoi, Spring 2013 Q4: Given circuit 2, write the binary logic operation (AND, OR, NOT) for A, B and C (where A means switch closed) to turn on lamp L? (A OR B) AND C = L 5 By Pakita Shamoi, Spring 2013 Q5: Describe the basic theorems and properties in Boolean algebra (e.g. Commutative, Distributive, etc.) For example, Theorem 1 proof: X + X = X, X + X = X+X 1 = (X+X) (X+X) = X+XX = X+0 = X X X = X, XX = X(X+0) =XX + XX = X(X+X) = X1 = X OR equation Dual Law (postulate) 2 X + 0 = X X 1 = X Law (postulate) 3 commutative X + Y = Y + X X Y = Y X Law (postulate) 4 distributive X (Y + Z) = XY + XZ X+(YZ) = (X+Y) (X+Z) Law (postulate) 5 X + X = 1 X X =0 Theorem 1 X + X = X X X = X Theorem 2 X + 1 = 1 X 0 = 0 Theorem 3 (X) = X Theorem 4 Associative X+ (Y + Z) = (X + Y) +Z X (Y Z) = (X Y) Z Theorem 5 DeMorgan (X+Y) = X Y (XY) = X + Y Theorem 6 absorption X + XY = X X (X+Y) = X 6 By Pakita Shamoi, Spring 2013 Q6: Which standard forms of boolean expressions do you know? Minterms: are also called standard products. These are all of the combinations of the AND of the variables. So there are 2 n minterms for n variables. Sum of Minterms = a Boolean function can be written as the sum of the minterms where the function is 1. Maxterms: are also called standard sums. These are all of the combinations of the OR of the variables. So there are 2 n maxterms for n variables. Product of Maxterms = a Boolean function can be written as the product of the maxterms where the function is 0. A B C Minterms designator Maxterms designator 0 0 0 ABC m0 A+B+C M0 0 0 1 ABC m1 A+B+C M1 0 1 0 ABC m2 A+B+C M2 0 1 1 ABC m3 A+B+C M3 1 0 0 ABC m4 A+B+C M4 1 0 1 ABC m5 A+B+C M5 1 1 0 ABC m6 A+B+C M6 1 1 1 ABC m7 A+B+C M7 7 By Pakita Shamoi, Spring 2013 Q7: What are Digital Logic Gates? 8 By Pakita Shamoi, Spring 2013 Q8: What are some of the types of Integrated Circuits for Digital Gates? 9 By Pakita Shamoi, Spring 2013 Q9: Design a 2 bit comparator that gives a 1 when the first number is bigger than the second? Step1: Inputs: two input numbers that are each 2 bits Step2: (two binary digits) so X is X1,X0 and Y is Y1,Y0. The output is one bit that F= 1 when X>Y. Step3: Equation: F = X1Y1X0Y0+ X1Y1X0Y0 + X1Y1X0Y0 + X1Y1X0Y0 + X1Y1X0Y0 + X1Y1X0Y0 Reducing this: F = X1Y1 + X1Y1X0Y0 + X1Y1X0Y0 So this circuit will need 2-OR gates, 7-AND gates, 3-NOT gates. Using one reduction: F = X1Y1 + (X1Y1 + X1Y1)X0Y0 So this circuit will need 2-OR gates, 5-AND gates, 3-NOT gates. Step 4 >>>>>>> X1 X0 Y1 Y0 F 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 Figure 2 X1Y1+X1Y1 Y0 F X0 Y1 X1 X0Y0 X1Y1 X1Y1 X1Y1 (X1Y1+X1Y1)X0Y0 10 By Pakita Shamoi, Spring 2013 Q10: Design a 4 bit odd parity generator. Inputs: 4 binary bits. The output is one bit that F= 1 when there are an even number of 1s or 0 in the input. Equation: All minterms: F = X1X0Y1Y0 + X1X0Y1Y0 + X1X0Y1Y0 + X1X0Y1Y0 + X1X0Y1Y0 + X1X0Y1Y0 + X1X0Y1Y0 + X1X0Y1Y0 So this circuit will need 7-OR gates, 24-AND gates, 4-NOT gates. Using the distributive function once: F = X1X0(Y1Y0 + Y1Y0) + X1X0(Y1Y0 + Y1Y0) + X1X0(Y1Y0 + Y1Y0) +X1X0(Y1Y0 + Y1Y0) Using the distributive function again: F = (X1X0+X1X0)(Y1Y0 + Y1Y0) + (X1X0+X1X0)(Y1Y0 + Y1Y0) So this circuit will need 5-OR gates, 8-AND gates, 4-NOT gates. Using XOR and XNOR gates: F = (X1X0)( Y1Y0) + (X1X0)(Y1Y0) So this circuit will need 1-OR gates, 2-AND gates, 2-XOR gates, 2-XNOR gates. X1 X0 Y1 Y0 F 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 1 1 0 1 1 0 1 0 1 1 1 0 1 0 0 0 0 1 0 0 1 1 1 0 1 0 1 1 0 1 1 0 1 1 0 0 1 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 Figure 3 Y0 F Y1 X0 X1 (X1X0) (Y1Y0) Y1Y0 Y1Y0 X1X0 X1X0 (X1X0) (Y1Y0) 11 By Pakita Shamoi, Spring 2013 Q11: Write the truth table for F = (A+C+D)(A+C+D)(A+C+D)(A+B). A B C D F2 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 12 By Pakita Shamoi, Spring 2013 Q12: What is the Boolean Map? What types of Boolean Maps do you know? How can we make an equation smaller using a Boolean Map? Give example. 13 By Pakita Shamoi, Spring 2013 Q13: Write the functions as the sum of minterms and product of maxterms: F(A,B,C,D) = (A+B+C)(A+B)(A+C+D)(A+B+C+D)(B+C+D) Maxterms = (A+B+C+D)(A+B+C+D)(A+B+C+D)(A+B+C+D)(A+B+C+D) (A+B+C+D)(A+B+C+D) = ABCD + ABCD + ABCD + ABCD + ABCD + ABCD + ABCD Minterms = ABCD + ABCD + ABCD + ABCD + ABCD + ABCD + ABCD + ABCD + ABCD A B C D Minterms designator Maxterms designator 0 0 0 0 ABCD m0 A+B+C+D M0 0 0 0 1 ABCD m1 A+B+C+D M1 0 0 1 0 ABCD m2 A+B+C+D M2 0 0 1 1 ABCD m3 A+B+C+D M3 0 1 0 0 ABCD m4 A+B+C+D M4 0 1 0 1 ABCD m5 A+B+C+D M5 0 1 1 0 ABCD m6 A+B+C+D M6 0 1 1 1 ABCD m7 A+B+C+D M7 1 0 0 0 ABCD m8 A+B+C+D M8 1 0 0 1 ABCD m9 A+B+C+D M9 1 0 1 0 ABCD m10 A+B+C+D M10 1 0 1 1 ABCD m11 A+B+C+D M11 1 1 0 0 ABCD m12 A+B+C+D M12 1 1 0 1 ABCD m13 A+B+C+D M13 1 1 1 0 ABCD m14 A+B+C+D M14 1 1 1 1 ABCD m15 A+B+C+D M15 14 By Pakita Shamoi, Spring 2013 Q14: Using maps, make the following function into a simple Sum of Products form: F = ABCD + ACD + BCD + ABCD + BCD F = BD + ABC + ABD 15 By Pakita Shamoi, Spring 2013 Q15: What is Dont-Care Condition when we work with Boolean maps or equations? 16 By Pakita Shamoi, Spring 2013 Q16: Design a 4 bit Gray code to binary converter for 0 to 9 decimal? Inputs: 4 Gray code bits. The output is one bit that is the right side bit for the binary number B1. 17 By Pakita Shamoi, Spring 2013 Q17: Simplify the following Boolean function and draw the circuit with only NAND gates? F = AC + ACE + ACE + ACD + ADE 18 By Pakita Shamoi, Spring 2013 Q18: Describe the algorithm for converting a circuit into a NOR only circuit (AND, OR, NOT, etc. needs to be replaced in a certain way by NOR gates). 19 By Pakita Shamoi, Spring 2013 Q19: Design a 3-bit full adder circuit. The circuit will take two a 3 bit numbers (X and Y) on the input and make (output) one 3 bit number that is the sum of the two input numbers? 20 By Pakita Shamoi, Spring 2013 X1 1 Out1 Y1 X2 Out2 Y2 C X0 Out0 Y0 3-bit full adder: (below) Q20: Design a 3-bit full subtractor circuit. The circuit will take two a 3 bit numbers (X and Y) on the input and make (output) one 3 bit number that is the difference (X-Y) of the two input numbers? You can use 1s or 2s complement subtraction. 21 By Pakita Shamoi, Spring 2013 Q21: What is 7-segment display? Design a BCD to 7-segment code converter (start with a truth table). 22 By Pakita Shamoi, Spring 2013 Using four XOR gates and one 4-bit full adder, design a 4-bit adder / subtractor circuit? This circuit will have one additional input V. If V=0 then the circuit will add, but if V=1 then the circuit will subtract. Use the 2s compliment subtraction, BUT if no left side carry happens, then you do not need to take the 2s compliment of the answer and make it negative. 23 By Pakita Shamoi, Spring 2013 Q23: Design a binary multiplier that multiplies a 4-bit number B (B3,B2,B1,B0) and a 3-bit number A (A2,A1,A0) and produces the product C (C6,C5,C4,C3,C2,C1,C0)? This can be done with 12 gates and two 4-bit full adders. The gates are used to make the partial products, and the full adders are used to add them together 24 By Pakita Shamoi, Spring 2013 Q24: What is a decoder? What is an encoder? Where they can be used? Provide the corresponding truth tables, examples and figures. 25 By Pakita Shamoi, Spring 2013 Q25:What is a Multiplexer? What is a Demultiplexer? Where they can be used? 26 By Pakita Shamoi, Spring 2013 Multiplexer is on the next slide 27 By Pakita Shamoi, Spring 2013 Q26: Design a Full Subtractor using a decoder? 28 By Pakita Shamoi, Spring 2013 Q27: Which flip-flops do you know? What is the difference between a latch and a flip-flop? Provide the corresponding truth tables, examples and figures. 29 The difference is that latch is level-triggered, whereas flip-flop is edge-triggered Q28: Why we design master-slave flip-flops? Provide the design for JK master-slave flip-flop. One problem of JK flip-flop is that when J=1 and K=1 and CP=1, then the output will keep changing. The final state will not be known. This is called a toggle output problem. 30 By Pakita Shamoi, Spring 2013 Q29: What is a state equation? Provide example. 31 By Pakita Shamoi, Spring 2013 Q30: Design a 3-Bit Binary Counter. Provide the corresponding truth tables, examples and figures. 32 By Pakita Shamoi, Spring 2013