Lab 6: Digital Logic

 


Introduction

In this lab you will experiment with digital logic design using the Logisim simulator.

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



Logisim

Download Logisim and lab.circ to your computer (the lab machine or your laptop). The lab.circ file has some slightly nicer settings than Logisim would default to.

Start the logisim simulator, and open the lab.circ file. (Click on "Open.." under the "File" menu.)

  1. Add two input pins (the square objects with a green center) and an AND gate to your circuit board. Wire (click on the + next to Base and pick the Wiring option) the two input pins to the AND gate, and wire the output of the gate to an output pin (the round object with a green center). Once you have this simple circuit set up, click on the finger icon and experiment with changing the inputs to your AND gate(make sure that Simulation is enabled under the Simulation menu). 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 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 Logisim. 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.

  3. The exclusive or 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 exclusive or function. Write a Boolean expression that corresponds to that truth table, and implement your expression in gates using Logisim.
    Hint: Your Boolean expression will probably include AND clauses that include three terms. For example: A'BC. You have two options for implementing something like that in Logisim. You could use two 2-input AND gates, taking advantage of the fact that A'BC = (A'B)C, or you could use one 3-input AND gate. You can change the number of input pins on a gate by selecting it using the arrow tool, and clicking on the "Number Of Inputs" selector on the lower left hand side of the Logisim window.
    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