COMP2421 Computer Organization 2019/20 Semester 1
Lab 6 Logic Gate Design
In this lab, we will study how to use Logisim to design logic gates.
is a simulator software to allow you to design and simulate digital circuits. It is intended as an educational tool to help you study how digital circuits work.
Copyright By PowCoder代写 加微信 powcoder
Download and install the software from below link:
https://sourceforge.net/projects/circuit/
Building an XOR circuit
Recall the truth table of exclusive-or (XOR) operation:
COMP2421 Computer Organization 2019/20 Semester 1
An XOR circuit takes two inputs, x and y, and outputs 0 if the inputs are of the same and 1 otherwise.
The design of the circuit is shown below:
To verify the design, draw this circuit in Logisim. Logisim provides handy functions for the verification.
Step 1: Adding Gates
When building a circuit, insert the gates first to get a skeleton of the design and then draw the wires to connect them. The first thing we do is to add the two AND gates. Click the AND tool ( ) on the toolbar. Then place the gate on the canvas. Be sure to leave plenty of room for stuff on the left. Then click the AND tool again and place the second AND gate below it.
Notice the five dots on the left side of the AND gate. These are spots where wires can be attached. It happens that we will just use two of them for our XOR circuit; but for other circuits, you may find that having more than two wires going to an AND gate useful.
COMP2421 Computer Organization
2019/20 Semester 1
Now add the other gates. First click the OR tool ( two NOT gates into the canvas using the NOT tool (
); then click where you want it. Place the ).
We leave some space between the NOT gates and the AND gates; if you want to, though, you can put them up against each other and save yourself the effort of connecting them with a wire later.
Now we want to add the two inputs x and y into the diagram. Select the Input tool ( ), and place the pins down. You should also place an output pin next to the OR gate’s output using the Output tool ( ). Again, we are leaving some space between the OR gate and the output pin, but you might choose to place them right next to each other.
Tips: If you want to add a copy of the recently placed component, press Ctrl-D to duplicate the selection.
COMP2421 Computer Organization 2019/20 Semester 1
Step 2: Adding Wires
After you have all the components placed on the canvas, you are ready to start adding wires.
Select the Edit Tool ( ). When the cursor is placed over a point that receives a wire, a small green circle will be shown around it. Press the mouse button there and drag as far as you want the wire to go. Wires in Logisim must be horizontal or vertical. To connect the upper input to the NOT gate and the AND gate, three wires are added.
Logisim automatically connects wires to the gates and to each other. This includes automatically drawing a ¡°green dot¡± at an intersection shown above, indicating that the wires are connected. As you draw wires, you may see some blue or grey wires. Blue in Logisim indicates that the value at that point is “unknown,” and grey indicates that the wire is not connected to anything.
By the time you finish building the circuit, none of your wires should be blue or grey. (The unconnected legs of the AND and OR gates will still be blue: That is fine.) If you do have a blue or a grey wire after you think everything ought to be connected, something must be wrong. It is important that you connect wires to the right places. Logisim draws little green dots on the components to indicate where wires ought to connect. As you proceed, you will see the dots turn from blue to light or dark green.
Once you have all the wires connected, all of the wires you inserted will themselves be light or dark green.
COMP2421 Computer Organization 2019/20 Semester 1
Step 3: Adding Text
Adding text to the circuit is not necessary to make it work; but if you want to show your circuit to somebody, some labels help communicate the purpose of the different pieces of your circuit.
Select the text tool ( ). You can click an input pin and start typing to give it a label. (It is better to click directly the input pin than to click where you want the text to go. This way, the label will move with the pin.) You can do the same for the output pin.
Step 4: Testing Circuit
Our final step is to test our circuit to ensure that it really does what we intended. Logisim has a build-in function to simulate a defined circuit.
Let us look again at where we were. Note that the input pins both contain 0s; and so does the output pin. This already tells us that the circuit already computes a 0 when both inputs are 0.
Now try another combination of inputs. Select the poke tool ( ) and start poking the inputs by clicking on them. Each time you poke an input, its value will toggle. For example, we might first poke the bottom input.
When you change the input value, Logisim will show you what values flow through the wires by drawing them light green to indicate a 1 value or dark green (almost black) to indicate a 0 value. You can also see that the output value has changed to 1.
COMP2421 Computer Organization 2019/20 Semester 1
So far, we have tested the first two rows of our truth table, and the outputs (0 and 1) match the desired outputs.
By poking the switches through different combinations, we can verify the other two rows. If they all match, then we are done.
[Exercises]
1. Use only [NAND] gates to make a [NOR] gate.
2. Use only [NAND] gates to make a [XOR] gate.
3. Use only [NOR] gates to make a [XOR] gate.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com