# Assignment 2, due Jan 30

Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due on Fridays at the start of class, and unless there is what insurance companies call "an act of God", the only exceptions to this rule will be by advance arrangement.

1. A base 4 adder adds numbers using base 4 arithmetic. If each base 4 digit is represented by a pair of bits, using the natural encoding where 00, 01, 10 and 11 represent 0, 1, 2 and 3. Write out the truth table for a base 4 adder. The inputs should be given in the order A, B, C, where A and B are the two 2-bit addends and C is the 1-bit carry in. The outputs should be given in the order C, S, where C is the 1-bit carry out and S is the 2-bit sum.

2. How many of each kind of logic gate would be required for a brute-force implementation of the truth table you arrived at above, using the mechanical recipe for converting a truth table for a function to a system of logic gates that was given in the notes for lecture 2.

3. Given a negative-edge-triggered master-slave type D flipflop and auxiliary logic gates, you can construct a circuit that toggles between one and zero with each clock pulse by connecting the Q output to the D input. Consider the problem of building a circuit that has a control input. When the input is high, the flipflop toggles on each clock pulse. When the input is low, the circuit does not toggle. There are two ways to build this circuit! One involves an and gate on the clock input. The other involves an exclusive-or gate in a modified version of the above feedback path.

a) Draw both circuits using a clear schematic notation.

b) Explain why the and-gate version is dangerous to use if you have no control over when the control input changes.

4. Consider the system described in the above problem as a finite-state machine. Give state tables for this system in Moore and Mealy form!