Combinational Logic Lab

Log in and create a new project in CircuitVerse.
Whenever you want to save your work, click on Project -> Save Online.
Save often. Your work is NOT saved automatically.


Exercise 1:  XOR

For this exercise, you will need the following elements:

Build a minimal sum-of-products circuit that behaves as follows.

A B  Out

0 0   0

0 1   1

1 0   1

1 1   0

This is called an eXclusive OR.

(You cannot use the built-in XorGate element in your circuit.)

Save this work. You will need to show it to your teacher at the end of the lab.


Exercise 2: Selector

For this circuit, you must click on Circuit -> New Circuit + to create a new circuit named Selector within the same project. You should see a new blank tab called named Selector. You will create exactly one circuit on this tab.

For this exercise, you will need the following elements:

Place an Input element. Click on it and look at the PROPERTIES box in the bottom left part of the screen. In the Label field, type Sel. You should see Sel appear next to that Input element. Place two more Input elements, and label them In0 and In1. Place an Output element, and label it Out.

Build a minimal sum-of-products circuit, so that when Sel is 0, the circuit outputs whatever value is at In0, and when Sel is 1, the circuit outputs whatever value is at In1. For example, if Sel = 1, In0 = 1, and In1 = 0, then Out = 0. This circuit is called a Selector (and it should remind you of an if).

Hint: First, make a truth table for this device and then use that to make a Karnaugh Map.

Save this work.


Exercise 3: 4-Bit Selector

Leaving your completed Selector circuit in one tab, go to another tab (or create another tab) in the same project. In this tab, click on Circuit -> Insert SubCircuit. In the pop-up dialog, click on Selector. (You'll see a circle appear next to it.) Now click Insert SubCircuit. You'll see a new circuit element appear, which will allow you to use the Selector you built as a component of a larger circuit.

You will now create a 4-bit Selector. For this exercise, you will need the following elements:

Build a circuit with inputs A0, B0, C0, D0, and A1, B1, C1, D1, and Sel, and with outputs OutA, OutB, OutC, OutD. When Sel = 0, then OutA = A0, OutB = B0, OutC = C0, and OutD = D0. When Sel = 1, then OutA = A1, OutB = B1, OutC = C1, and OutD = D1. In other words, Sel is used to select whether to output A0/B0/C0/D0 or A1/B1/C1/D1.

Save this work. You will need to show it to your teacher at the end of the lab.


Background:  Binary Numbers

Writing numbers in binary simply means writing them in base-two, using only the digits 0 and 1. (A binary digit is called a bit.)

Quantity  Base-Ten  Binary

              0         0

.             1         1

..            2        10

...           3        11

....          4       100

.....         5       101

......        6       110

.......       7       111

........      8      1000

In base ten, the rightmost digit is the ones place. The digit to its left is the tens place, then the hundreds place, and so on through powers of ten. For example, the base-ten number 5,908 consists of 5 thousands, 9 hundreds, 0 tens, and 8 ones.

Thousands Hundreds Tens Ones

       5     9     0     8

We can write base-ten numbers in expanded form as follows.

5,908

= 5 × 1,000 + 9 × 100 + 0 × 10  + 8 × 1

= 5 × 10³   + 9 × 10² + 0 × 10¹ + 8 × 10°

In binary, the rightmost digit is the ones place. The digit to its left is the twos place, then the fours place, then the eights place, and so on through powers of two. For example, the binary number 1101 consists of 1 eight, 1 four, 0 twos, and 1 one.

Eights Fours Twos Ones

    1    1    0    1

We can write binary numbers in expanded form as follows.

1101

= 1 × 8  + 1 × 4  + 0 × 2  + 1 × 1

= 1 × 2³ + 1 × 2² + 0 × 2¹ + 1 × 2°

We can convert a binary number to base-ten simply by adding up these terms.

1101

= 1 × 8  + 1 × 4  + 0 × 2  + 1 × 1

=     8  +     4  +     0  +     1

= 13


Exercise 4:  Adding 2 Bits

Build a circuit that adds two 1-bit inputs together, and uses a 2-bit output for the sum. In other words, if the inputs are 0 and 0, the output should be 00 (zero).  If the inputs are 0 and 1 (in either order), the output should be 01 (one).  If the inputs are 1 and 1, the output should be 10 (two).

For this exercise, you will need the following elements:

Hints:  First, make a truth table for this device. Then consider each output bit separately. And look for an opportunity to use an XOR gate.


Exercise 5:  Adding 3 Bits

For this circuit, you must click on Circuit -> New Circuit + to create a new circuit named Adder within the same project. You should see a new blank tab called named Adder. You will create exactly one circuit on this tab.

Design and build a circuit that adds three 1-bit inputs together, and uses a 2-bit output for the sum. For example:

0 + 0 + 0 = 00 (zero)
1 + 0 + 0 = 01 (one)
1 + 0 + 1 = 10 (two)
1 + 1 + 1 = 11 (three)

For this exercise, you will need the following elements:

Hint:  First, make a truth table for this device and then use that to make a Karnaugh Map for each output. And look for opportunities to use XOR gates.

Save this work. You will need to show it to your teacher at the end of the lab.



Background:  Adding in Binary

Multi-digit binary numbers can be added using exactly the same algorithm you learned for adding base-ten numbers.  Namely, add each column beginning with the least significant digit, being sure to carry a 1 to the next column whenever the sum is 10 (two) or higher.


  ¹

  1 1 0

+ 1 1 1

-------

1 1 0 1

 Computing 6 + 7 = 13


Suppose we wish to build a circuit to add a single column.  It will require three inputs—a digit from the first addend A, a digit from the second addend B, and the bit carried from the last column Cin.  Furthermore, each column has two outputs—the sum F, and the bit to carry to the next column Cout.

We can now connect n column-adders to add two n-bit numbers. For example, the following uses three column-adders to compute 6 + 7 = 13.

But here's the punchline:  You've already built a column adder! The adder you built takes three 1-bit inputs, adds them together, and outputs the 2-bit sum.  You only need to re-label the inputs and the ouputs.


Exercise 6:  Adding 4-bit Binary Numbers

Label the inputs in your Adder circuit as A, B, and Cin, and the outputs as F and Cout.

Leaving your completed Adder circuit in one tab, go to another tab (or create another tab) in the same project. In this tab, click on Circuit -> Insert SubCircuit. In the pop-up dialog, click on Adder. (You'll see a circle appear next to it.) Now click Insert SubCircuit. You'll see a new circuit element appear, which will allow you to use the Adder you built as a component of a larger circuit.

You will now create a 4-bit Adder. For this exercise, you will need the following elements:

Build a circuit with inputs A3, A2, A1, A0, and B3, B2, B1, B0, and with outputs F4, F3, F2, F1, F0. A3/A2/A1/A0 represents a 4-bit binary number, where A0 is the low-order-bit (ones place) and A3 is the high-order bit (eights place). F4/F3/F2/F1/F0 should output the sum of A3/A2/A1/A0 and B3/B2/B1/B0.

Save this work. You will need to show it to your teacher at the end of the lab. Your teacher will give you two numbers from 0 to 15, and it will be your job to know how to enter those numbers into your circuit and read off their sum.


If you have completed all of the above correctly, then you have earned a 90%.
Complete additional challenges to earn up to 100%.


Additional Challenges


Display a 3-bit binary number using DigitalLed elements arranged like the dots on the face of a 6-sided die.

Display a 3-bit binary number using DigitalLed elements arranged like a 7-segment display (without using the built-in display elements).

Create a circuit for subtracting multi-bit numbers.

Create a circuit for multiplying multi-bit numbers.

Create a simple arithmetic logic unit (capable of performing more than one operation).

Invent your own combinational logic device!