## 1. Goals for this week:

1. Gain experience with the Logisim logic circuit simulator.

2. Introduce Lab 3.

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

## 2. Logisim setup

See the Logisim Install page for instructions on how to set up Logisim on a your personal computer.

## 3. Starting point code

You can download the a sample firstcircuit.circ file to your computer for the demos. Use right click and save as, or cmd click on OSX if the file opens in the browser. Save the file to a folder you can easily access such as your desktop, your home directory, etc.

## 4. Preview Notes

We will talk much more about logic gates and their connections to binary arithmetic in the next couple of class lectures. For today’s in lab exercise, a few slides will suffice.

## 5. 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.

### 5.1. Together

• First, open `firstcircuit.circ` with Logisim. You can do this by starting logisim then going to the File→Open menu and navigating to the folder containing the `firstcircuit.circ` file.

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 entering 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.

### 5.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.

• 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).

## 6. 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.