Launch the Logisim application to begin. To do this, type
You can learn about Logisim beyond the scope of this lab (or download it to use at home) from the Logisim website.
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 "Select 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?
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.
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.
Show your five circuits (NAND, XOR, 2 to 1 MUX, and 4 to 1 MUX) to your TA. |
Let's implement the circuit we've been talking about in lecture, that increments a value ad infinitum. The difference between this circuit and the circuits you've built for lab so far is that you need some registers. The following will show you how to add registers to your circuit.
You may notice that when you connect the adder to a register, you will get a "Incompatible widths" error. This means that your wire is trying to connect two pins together with different bit widths. If you click on one the adder with the "Selection" tool, you will notice that in the box below circuit browser will have a field called "Data Bit Width". This field controls the number of bits the the adder will add. Change this field to 8 and the "Incompatible widths" error should now go away.
In general, the box below the circuit browser will list the properties of a given circuit element. Other circuit elements will have other properties.
Now let's see if you built your circuit correctly.
Note: You can use Simulate->Go In To State->*Circuit Name*, but that allows you go into the first circuit of that type. If you placed two Fib8 circuits down, it only takes you to the first Fib8 circuit to put down.
Show your AddMachine circuit to your TA. |
Now we're ready to do something really cool; translate a FSM into a digital logic circuit.
If you've been paying attention in lecture you've noticed that the circuit we built in part 2 looks eerily similar to the diagram of a general FSM circiut. We're going to modify our circuit to implement the following FSM:
If two ones in a row or two zeroes in a row have ever been seen, output zeros forever. Otherwise, output a one.
Note that the FSM is implemented by the following diagram:
Observe that the following is a truth table for the FSM:
st1 | st0 | input | | | next st1 | next st0 | output |
---|---|---|---|---|---|---|
0 |
0 |
0 |
| |
0 |
1 |
1 |
0 |
0 |
1 |
| |
1 |
0 |
1 |
0 |
1 |
0 |
| |
1 |
1 |
0 |
0 |
1 |
1 |
| |
1 |
0 |
1 |
1 |
0 |
0 |
| |
0 |
1 |
1 |
1 |
0 |
1 |
| |
1 |
1 |
0 |
1 |
1 |
0 |
| |
1 |
1 |
0 |
1 |
1 |
1 |
| |
1 |
1 |
0 |
Note that the top level of the circuit looks almost exactly the same as our previous adder circuit, but now there's a FSMLogic block instead of a adder block. FSMLogic is the combinational logic block for this FSM. I have handled the output bit for you, as it's the most complicated to simplify and implement. You should complete the circuit by completing the StateBitOne and StateBitZero subcircuits.
You could go from the truth table to SOP to a circuit, or you could notice that for each state bit, there are only two situations in which it is zero. This could make your life easier if you think a bit outside the box...
Show your StateBitZero circuit to your TA and demonstrate that it behaves correctly. | |
Show your StateBitOne circuit to your TA and demonstrate that it behaves correctly. |