CS 232: Lab 0

Title image Fall 2020

Lab 0: Drawing Simple Combinational Circuits

The purpose of this lab is to familiarize you with logic gates, and representing truth tables with circuits. We will be using an on-line circuit simulator at falstad.com. There is nothing to turn in after completing this lab.

If you missed lab and want to watch the video of the first Zoom session, then do so here.

Begin by watching this video demonstrating how to use falstad.com/circuits to build and test a circuit.

  1. Draw and test a circuit with 3 inputs (A, B, and C), and 1 output. The circuit should represent the boolean expression A*B+C (A and B or C).
    1. Go to falstad, delete the demo circuit, and draw the circuit with 3 inputs on the left (put A on top, B in the middle, and C on the bottom) and one output on the right.

      Note that AND has higher precedence than OR (just like in a programming language and just like multiplication has higher precedence than addition).

    2. On a piece of paper (or on a computer, if you prefer), draw a truth table predicting the output of the circuit.
    3. Check your truth table by simulating the circuit for each of the 8 possible input combinations.
    4. Check you answer by looking at the solution in the collapsed box:

      + (see solution)

      ABCResult
      0000
      0011
      0100
      0111
      1000
      1011
      1101
      1111
  2. Draw and test a circuit with 3 inputs (A, B, and C), and 1 output. The circuit should represent the boolean expression A*(B+C) (A and (B or C)).
    1. Go to falstad, delete the demo circuit, and draw the circuit with 3 inputs on the left (put A on top, B in the middle, and C on the bottom) and one output on the right.
    2. On a piece of paper (or on a computer, if you prefer), draw a truth table predicting the output of the circuit.
    3. Check your truth table by simulating the circuit for each of the 8 possible input combinations.
    4. Check you answer by looking at the solution in the collapsed box:

      + (see solution)

      ABCResult
      0000
      0010
      0100
      0110
      1000
      1011
      1101
      1111
  3. In future projects, you will work in a different order - you will first work out a truth table, and then construct a circuit to represent it. One strategy for determining a correct set of gates is to make a sub-circuit for each row in the truth table that has a TRUE result. That sub-circuit uses AND gates and NOT gates to uniquely identify the set of inputs from that row. The output of each AND gate then goes to an OR gate, so that if the input matches any one of the patterns that should result in a TRUE output, will cause the output to be TRUE. Consider the following truth table

    ABCResult
    0000
    0010
    0100
    0110
    1000
    1011
    1101
    1111

    There are only 3 rows with TRUE results. That means the result should be true if A*B^*C or if A*B*C^ or A*B*C (i.e. if (A is TRUE and B is FALSE and C is TRUE) or if (A is TRUE and B is TRUE and C is FALSE) or if (A is TRUE and B is TRUE and C is TRUE). This truth table can therefore be represented by this circuit:

    Note that we use 2 AND gates to represent A and B and C, wiring it up so that the result of A and B is an input to an AND gate with C as the other input (the bottom pair of AND gates show this situation). Likewise, we need to OR together three values, and use 2 gates to do so. Does it matter which order we put them in?

    Note that this approach does not create a minimal circuit. But it will create a correct circuit. And correct is a good place to start.

    1. Convince yourself the above circuit represents the above table.
    2. Using the same approach, design a circuit that will reprsent this truth table.

      ABCResult
      0001
      0010
      0100
      0110
      1000
      1010
      1100
      1111

    3. Check you answer by looking at the solution in the collapsed box:

      + (see solution)