Hello World! An Invitation to Computer Science

Laboratory 2: Circuits Maximus

Report due the week of March 10 at the start of your group conference that week.

Before proceeding - read this entire document thoroughly!

You should work on this lab with your partner and submit one lab report with both your names on it. The report should be submitted via email. It should consist of the main text of the report (which can be in the body of the email or as an attachment) plus a series of (six) attachments representing circuit diagrams - see below.


Goals


What you need to do

In what follows, assume that we mean "true" to be represented equivalently by "1" or "on" and false to be represented equivalently by "0" or "off".

  1. Warmup. Design a circuit with two inputs and one output that corresponds to the following logic formula:

      (a AND b) OR (a AND (NOT b))
    

    1. Attach a file representing the circuit.

    2. Write a more compact Boolean expression that is equivalent to the given expression. Show the equivalence with a truth table.

  2. Contradiction! Create a circuit with one output that is never on. Attach a file representing the circuit.

  3. Some helpful modules. Create circuit modules for each of the following:

    1. a three input, one output circuit corresponding to the Boolean expression:

        a AND (NOT b) AND (NOT c)
      

    2. a three-way AND gate

    3. a four-way OR gate

    You do not need to turn in these circuits individually, but the modules will be quite helpful in subsequent exercises on this assignment.

  4. The power of NAND.

    1. Build a NAND module.

    2. Using just NAND gates, build a circuit that is equivalent in functionality to a NOT gate.

    3. Using just NAND gates, build a circuit that is equivalent in functionality to an AND gate.

    4. Using just NAND gates, build a circuit that is equivalent in functionality to an OR gate. (Attach a file just for this case.)

    5. What does this problem illustrate about the number of fundamental gates required to construct computer circuits?

  5. Parity. Write a truth table and design a corresponding circuit for computing the odd-parity of three inputs. That is the output should be 1 when an odd number of the inputs are 1 and should be 0 otherwise. Attach a file for the parity module.

  6. Reverse engineering a circuit. Experiment with the circuit module that has been emailed to you.

    1. Write a Boolean expression that corresponds to the circuit.

    2. Write a truth table that corresponds to the expression.

    3. In a clear and concise sentence, explain what the circuit computes.

  7. Full adder. Write a truth table for and construct a corresponding circuit for a 1-bit full adder. It should have three inputs (the two bits being added and one additional bit representing the "carry in") and two outputs (one for the "sum bit" and one for the "carry out"). You should take advantage of other modules used in previous parts of this assignment where possible. Attach a file for the full-adder module.

  8. 2-bit adder. Write a truth table for and construct a corresponding circuit for a 2-bit adder. It should have four inputs: two corresponding to the two-bits of the first number and two-bits corresponding to the second number. It should have three outputs corresponding to the three-bit sum. You should use two full 1-bit adders. Attach a file for the 2-bit adder module.