This lab is optional. There are no labs during the week of October 14 because of the holiday, but we’re posting this optional lab for you to do on your own—for extra practice and/or to help you in your work on the problem sets.
Create a subfolder called lab6
within your
cs111
folder, and put all of the files for this lab in that
folder.
In Problem Set 5, you will be using a circuit-design tool called Logicly.
If you haven’t installed it yet, you can follow the instructions found here:
Important: There appears to be a bug in Logicly that causes it to occasionally display red wires. If this happens, save your file, close down Logicly, and then reopen it. This will typically fix the problem.
To learn how to use it, let’s build a circuit that represents a
NAND
gate, which has the following truth table:
x | y | x NAND y |
---|---|---|
0 | 0 | 1 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
On a piece of paper, create the minterm expansion formula for this truth table. Here is a reminder of the steps:
Delete all rows from the truth table where the value of the function is 0.
For each remaining row, create a minterm as follows:
For each variable that has a 1 in that row, write the name of the variable. If the input variable is 0 in that row, write the variable with a negation symbol to NOT it.
AND all of these variables together (using multiplication).
Combine all of the minterms for the rows using OR (i.e., addition).
Download the following starter file for the circuit, storing it
in your lab6
folder:
lab6_task1.logicly
Open the downloaded file in Logicly. Note that we’ve provided you with:
switches for the inputs x
and y
a NOT
gate for the negation of each input; for example, the
leftmost switch is for x
itself, and the NOT
gate
immediately to its right is for NOT x
a light bulb for the output.
You may need to use the Pan Tool (the hand icon available at the top of the screen) and the magnification slider available in the lower right-hand corner to adjust how much of your circuit is visible. After using the Pan Tool, don’t forget to switch back to the Selection Tool (the arrow icon).
Implement the circuit based on your midterm expansion formula. Remember that:
Once you have completed the circuit, test it by clicking the input switches to turn them on and off. Check to see if you obtain the correct output for all possible inputs.
Let’s say that we want to build a partial arithmetic logic unit that
accepts three inputs (x
, y
, and op
) and produces two
outputs (r1
and r0
):
inputs x
and y
represent one-digit operands – i.e., one-digit
numbers that we want to perform arithmetic on.
the op
input indicates which arithmetic operation we want to perform:
a value of 0 for op
means that the circuit should
compute and output x + y
a value of 1 for op
means that the circuit should compute
and output x * y
.
outputs r1
and r0
are the two bits of the result:
x y ----- r1 r0
In the case of addition, r1
is the carry bit. In the case of
multiplication, r1
will always be 0.
Here are the steps you should take:
Begin by reviewing the following truth table:
inputs outputs | op | x | y || r1 | r0 | notes |----|---|---||----|----| | 0 | 0 | 0 || 0 | 0 | 0 + 0 = 00 | 0 | 0 | 1 || 0 | 1 | 0 + 1 = 01 | 0 | 1 | 0 || 0 | 1 | 1 + 0 = 01 | 0 | 1 | 1 || 1 | 0 | 1 + 1 = 10 | 1 | 0 | 0 || 0 | 0 | 0 * 0 = 00 | 1 | 0 | 1 || 0 | 0 | 0 * 1 = 00 | 1 | 1 | 0 || 0 | 0 | 1 * 0 = 00 | 1 | 1 | 1 || 0 | 1 | 1 * 1 = 01
Next, use minterm expansion twice – once for each output bit – and create a separate formula for each of those bits.
Now download the following starter file for the circuit,
saving it in your lab6
folder:
lab6task2.logicly
Open the downloaded file in Logicly and implement the circuit.
Give each output bit (r1
and r0
) its own subcircuit.
Once you have completed the circuit, test it by clicking the input switches to turn them on and off. Check to see if you obtain the correct outputs for all possible inputs.
Last updated on October 10, 2024.