CS61c

Lab 9 -- Introduction to Logisim

 

Preparation

Launch the Logisim application to begin. To do this, type

% java -jar ~cs61c/bin/logisim.jar

If you are having difficulty using Logisim on nova (i.e. the GUI interface is unusable), ssh into cory and run logisim from there. You can ssh using the following command:

  % ssh cory

Type in "yes" when it asks you something about a key, then enter in your password.

You can learn about Logisim beyond the scope of this lab (or download it to use at home) from the Logisim website. If you download logisim for your home computer, it is recommend that you use the JAR. From the TA's experience, versions specific for Windows and MacOS X are notoriously slow.


Part 0: The Basics (Warm-Up)

We'll begin by creating a very simple circuit just to get the feel for placing gates and wires.

1. Start by clicking the "AND gate" button. This will cause the shadow of an AND gate to follow your cursor around. Click once within the main schematic window to place an AND gate.

2. Click the "Input Pin" button. Now, place two input pins somewhere to the left of your AND gate.

3. Click the "Output Pin" button. Then place an output pin somewhere to the right of your AND gate. Your schematic should look something like this at this point:

4. Click the "Wire tool" button. Click and drag to connect the input pins to the left side of the AND gate. This will take several steps, as you can only draw vertical and horizontal wires. Just draw a wire horizontally, release the mouse button, then click and drag down starting from the end of the wire to continue vertically. You can attach the wire to any pin on the AND gate on the left side. Repeat the same procedure to connect the output (right side) of the And Gate to the LED. After completing these steps your schematic should look roughly like this:

5. Finally, click the "Poke" tool and try clicking on the input pins in your schematic. Observe what happens. Does this match with what you think an AND Gate should do?



Part 1: Sub-Circuits

Since C programs can contain helper functions, a schematic can contain subcircuits. In this part of the lab, we will create several subcircuits to demonstrate their use.

  1. Create a new schematic (File->New) for your work.

  2. Create a new subcircuit (Project->Add Circuit ). You will be prompted for a name for the subcircuit; call it NAND.

  3. In the new schematic window that you see create a simple NAND circuit with 2 input pins on the left side and an output pin on the right side.

  4. Go back to your "main" schematic by double-clicking "main" in the circuit selector at the left of the screen. Your original (blank) schematic will now be displayed, but your NAND circuit has been stored.

  5. Now, single click the word "NAND" in the list. This will tell Logisim that you wish to add your "NAND" circuit into your "main" circuit.

  6. Try placing your NAND circuit into the "main" schematic. If you did it correctly, you should see a gate with 2 input pins on the left and one output pin on the right. Try hooking input pins and output pins up to these and see if it works as you expect.

  7. Repeat these steps to create several more subcircuits: NOR, XOR, 2 to 1 MUX, and 4 to 1 MUX. Do not use any built in gates other than AND, OR, and NOT. However, once you've built a subcircuit, you may use it to build others.

    Hint: Look at the lecture slides for a refresher on how to build these. You may want to consider using some of your custom subcircuits when designing the others.

Checkoff

Show your five circuits (NAND, NOR, XOR, 2 to 1 MUX, and 4 to 1 MUX) to your TA.  


Part 2: Splitters

This is one of the essential tools you will need in this class. To demonstrate it's use you will construct a circuit that will output 1 when the most significant bit and least significant bit are 1.
  1. Create a new subcircuit and name it "Exer2".
  2. Add an 8 bit input pin to your circuit.
  3. Add a 1 bit output pin to your circuit.
  4. Go to the base folder and select the Splitter circuit. This circuit will take a wire and split it into a smaller set of wires.
  5. Before you place your circuit, change the "Bit Width In" property to 8, and "Fan Out" property to 3. If you move your cursor over the schematic, your cursor should look as follows:
  6. Now, select which bits to send out to which part of your fan. The least significant bit is bit 0 and the most significant bit is bit 7. Change bits 1, 2, and 6 to be coming out on fan arm 1. Alternatively, you can have bits 1, 2, and 6 to not come out on any of the fan arms by selecting "None"
  7. Once you configure your splitter, you can place your splitter into your circuit.
  8. Add an AND gate and complete the circuit.

Checkoff

Show this completed circuit to your TA.  
Describe the relationship between the output of this circuit and it's input. (Hint: Interpret the input as a number).  


Part 3: From Truth Table to Schematic

Between lecture, your reading, and this lab, you now have all the tools needed to take a truth table and implement it in a Logisim schematic. Given the following truth table, complete the tasks below.

in1 in0 | out1 out0
0 0 | 0 1
0 1 | 1 0
1 0 | 1 1
1 1 | 0 0

1. From the truth table above derive the Canonical SOP boolean equations for out1 and out0.

2. Using the rules of boolean algebra (see the lecture slides or go to Google refresh what they are) simplify your boolean equations. Once you arrive at the simplest boolean equation you may want to check to see if your equations fit the pattern of any of our well-known gates.

3. Implement your simplified boolean equations in your "main" schematic in Logisim. Feel free to use any of the subcircuits you designed earlier if they would help. Be sure you label your input and output pins appropriately using the "Text" tool. To use the text tool, select the tool and click on your schematic and start typing. If you make a mistake, you can edit the text by selecting your text object using the "selection" tool, and edit the "Text" property in the property list below the circuit browser (window where you can select your tools and circuit)

Checkoff

Show your canonical SOP of the truth table.  
Show your boolean algebra simplifications to your TA.  
Show your working schematics to your TA.