Lab: Digital Logic

 


Introduction

In this mini-lab you will experiment with digital logic design using the Logicly simulator.

This lab should be done individually, although you may certainly discuss your progress with your neighbors.

Reminder: A' means NOT A; A + B means A OR B; AB and A * B both mean A AND B.



Logicly

Start the Logicly simulator by going to https://logic.ly/demo/. If this does not work in your browser, you may download Logicly from https://logic.ly/.

  1. AND circuit
    Add two Toggle Switches and an AND gate to your circuit board. Wire the two switches to the AND gate. Add a light bulb to your circuit board and wire the output of your AND gate to the light bulb. Once you have this simple circuit set up, experiment with flipping the switches to change the inputs to your AND gate. Make sure that the gate does what you expect it to do. Repeat the experiment with the OR gate and the NOT gate. There is nothing to turn in for this exercise.
  2. Here is the truth table for the Exclusive Or (or "exactly-one") function (XOR):

    A  B  |  Out
    ------|----
    0  0  |  0 
    0  1  |  1
    1  0  |  1
    1  1  |  0 
    

    Write a Boolean expression that corresponds to this truth table, and implement your expression using AND, OR, and NOT gates in Logicly. (In other words, do not use the built-in XOR gate.) Test your circuit to make sure that it generates the appropriate output for all possible inputs. For this exercise you will hand in your Boolean expression as well as a print-out or drawing of your circuit.

    Saving your work: If you have downloaded Logicly to your own machine, you can go to File->Save As to save your file. If you are running Logicly through the browser, you cannot save the circuit board as a file, but you can take a screenshot to capture your circuit diagrams.

  3. The "exactly one" function can be generalized to any number of inputs. No matter how many inputs there are, the output is true if and only if exactly one of the inputs is true. Create a truth table for a three-input "exactly one" function. Write a Boolean expression that corresponds to that truth table, and implement your expression in gates using Logicly. (Here is a Markdown template you can use for the truth table.)

    Hint: Your Boolean expression will probably include AND clauses that include three terms. For example: A'B'C.

    For this exercise you will hand in your truth table, your Boolean expression, and a print-out or drawing of your circuit.

  4. (IF YOU HAVE TIME) During class we worked through the design of a binary adder. The first step was to build a half adder, a circuit that could add two bits together as long as there was no carry-in from a previous add. For this exercise you will build a half subtractor, a circuit that can subtract two bits as long as there is no borrow from a previous pair of bits. Build and test a circuit that implements the following truth tables:

                                      INPUTS           INPUTS
        Subtraction of 2 bits:         X   Y  Result    X   Y  Borrow 
        ----------------------        -------|------   -------|------
                                       0   0 |  0       0   0 | 0 (F)
       X     0    0    1    1         -------|------   -------|------
      -Y    -0   -1   -0   -1          0   1 |  1       0   1 | 1 (T)
            --   --   --   --         -------|------   -------|------
     Result: 0    1    1    0          1   0 |  1       1   0 | 0 (F)
     Borrow? F    T    F    F         -------|------   -------|------
    			           1   1 |  0       1   1 | 0 (F)
    

Submit your results

  1. Submit your solutions to the exercises above. You may print them out or submit your file(s) to Kit.