1. Goals for this week:

  1. Gain experience with the Logisim logic circuit simulator.

  2. Introduce Lab assignment 3.

  3. Run through the Logisim tutorial for building an XOR component.

2. Starting Point Code

Start by creating a week03 in your cs31/weeklylab subdirectory and copying over some files:

cd ~/cs31/weeklylab
mkdir week03
cd week03
pwd
  /home/you/cs31/weeklylab/week03
cp ~newhall/public/cs31/week03/* .
ls
firstcircuit.circ

3. Learning Logisim

For this lab, we’ll be using Logisim to create and test digital circuits using the logic gates (AND, OR, NOT, etc.) we’ve been talking about in class.

We will start by demo’ing some the basics of Logisim (adding gates, inputs, and outputs) by implement a simple circuit. You and your partner will next run through the logisim tutorial to create an XOR circuit.

3.1. Together

  • First, open firstcircuit.circ with logisim:

    $ logisim firstcircuit.circ

    Together, we are going to implement a 1-bit circuit that computes (X AND Y) OR X, and we will add some tester circuitry around it.

    After we try this out together, you can double click on "firstcircuit" circuit and see my solution to each step.

  • Next, we will create a new circuit interface to the circuit we just built. add this new circuit to a tester circuit containing some tester functionality. (details about creating sub-circuits are in the "Subcircuits" part of the Logisim User’s Guide).

    1. Let’s first create a new circuit by choosing Project→Add Circuit, and enter the name of the new circuit 1-bit X. You should now see 3 circuits in the subcircuits folder: main, firstcircuit and 1-bit X.

    2. Copy your circuit into the new 1-bit X window. Only include the input and output (do not include the counter or clock parts). Add two inputs and the single output, and add labels to each (X, Y, 1-bit X). And you can add probes to the inputs if you’d like.

    3. Next, select the 1-bit X circuit and add a label for it (1-bit X)

    4. Finally, lets add a new tester circuit (Project→Add Circuit) Add your 1-bit X circuit and add some inputs and outputs to the circuit. If you hover with your mouse over the input and outputs, you will see their labels. You can also add a counter and a clock to test.

3.2. Advice on Using Logisim

  • Save your changes frequently. Occasionally logisim freaks out and you need to exit logisim and restart it. If you have saved your changes as you go, you will not lose your work if this happens.

  • I suggest working in the CS lab on Logisim rather than logging in remotely.

  • Logisim will run very slowly if you are remotely logged in due to X-forwarding events (i.e., using ssh -Y on Mac or Linux to enable X-forwarding).

  • Alternatively, you can install Logisim on your own computer, and use git to push/pull your .circ file to/from your computer and your CS account. If you do this, you still need to ensure that your circuit file works on Logisim running on our system, the school computer labs is where we’ll be doing the grading!

4. Lab 3 Assignment

Next, let’s look over the Lab assignment and then get started on it!

After I talk through the assignment, you and your partner should start by running through the Logisim tutorial: Beginner’s Guide to build an XOR gate using only AND, OR, and NOT gates (plus inputs and outputs). Build your gate as a new component that you can then deploy in main.

5. Handy References