Mini-Lab: Digital Logic

Introduction

In this mini-lab you will experiment with digital logic design using the Logicly simulator.

Logicly

Start the Logicly simulator by going to https://logic.ly/demo/. If this does not work in your browser, you may download Logicly from https://logic.ly/.
1. Add two Toggle Switches and an AND gate to your circuit board. Wire the two switches to the AND gate. Add a light bulb to your circuit board and wire the output of your AND gate to the light bulb. Once you have this simple circuit set up, experiment with flipping the switches to change the inputs to your AND gate. Make sure that the gate does what you expect it to do. Repeat the experiment with the OR gate and the NOT gate. There is nothing to turn in for this exercise.

2. Here is the truth table for the exclusive or function (xor):
```A  B  |  Out
------|----
0  0  |  0
0  1  |  1
1  0  |  1
1  1  |  0
```
Write a Boolean expression that corresponds to this truth table, and implement your expression using AND, OR, and NOT gates in Logicly. Test your circuit to make sure that it generates the appropriate output for all possible inputs. For this exercise you will hand in your Boolean expression as well as a print-out or drawing of your circuit.

Saving your work: If you have downloaded Logicly to your own machine, you can go to File->Save As to save your file. If you are running Logicly through the browser, you cannot save the circuit board as a file, but you can take a screenshot to capture your circuit diagrams.

• Screenshot on a mac: Press Shift + Command + 4, then move the crosshairs to where you want to start the screenshot, and then drag them to select the area you want to capture. It will save the screenshot in a .png on your desktop.
• Screenshot on a pc:
• Follow these instructions to Use Snipping Tool.
• Open a Word document. Go to the Insert menu, choose to insert a screenshot, and either choose a shot that it available, or choose to select an area of the screen to insert in your document.
• Follow one of these suggestions to take a screenshot.

• The exclusive or function can be generalized to any number of inputs. No matter how many inputs there are, the output is true if and only if exactly one of the inputs is true. Create a truth table for a three input exclusive or function. Write a Boolean expression that corresponds to that truth table, and implement your expression in gates using Logicly.
Hint: Your Boolean expression will probably include AND clauses that include three terms. For example: A'B'C.
For this exercise you will hand in your truth table, your Boolean expression, and a print-out or drawing of your circuit.

• (IF YOU HAVE TIME) During class we worked through the design of a binary adder. The first step was to build a half adder, a circuit that could add two bits together as long as there was no carry-in from a previous add. For this exercise you will build a half subtractor, a circuit that can subtract two bits as long as there is no borrow from a previous pair of bits. Build and test a circuit that implements the following truth tables:
```                                  INPUTS           INPUTS
Subtraction of 2 bits:         X   Y  Result    X   Y  Borrow
----------------------        -------|------   -------|------
0   0 |  0       0   0 | 0 (F)
X     0    0    1    1         -------|------   -------|------
-Y    -0   -1   -0   -1          0   1 |  1       0   1 | 1 (T)
--   --   --   --         -------|------   -------|------
Result: 0    1    1    0          1   0 |  1       1   0 | 0 (F)
Borrow? F    T    F    F         -------|------   -------|------
1   1 |  0       1   1 | 0 (F)
```