# Mini Lab: Combinational Logic

Assigned:
Monday, Sep 4, 2017
Due:
You do not need to submit any work for this mini lab.
Summary:
You will learn to use Logisim, a program that simulates digital logic circuits, and practice building larger combinational logic circuits from logic gates.
Collaboration:
You can work individually or in groups of your choice, with up to three students.
Submitting:
You do not need to turn in any work for this lab. If you are unable to finish all of the exercises during class time, I recommend that you complete this work on your own.

We often think of logic circuits in two distinct ways. The first is as a mechanism for computing logical formulas, which we used in the previous class. The second approach is to think of logical circuits as components performing some useful operation. This is often how we think of utility components like decoders and multiplexors, or the adders and memory elements we will see in the coming weeks. These view are not mutually exclusive. You will practice both approaches while learning to use Logisim in today’s in-class lab.

## Preparation

Logisim is a free graphical tool for designing and simulating logic diagrams. We are using an improved version of logisim, based on Logisim Evolution from GitHub. If you would like to set up Logisim on your personal machine, I can show you how to transfer the program from MathLAN to your own machine.

To start Logisim on a MathLAN machine, run the following command in a terminal window:

\$ java -jar /home/curtsinger/bin/logisim.jar &


You will need to keep the terminal window open as long as you are using Logisim.

## Exercises

### Exercise 0: Tutorial

1. To learn the basics of logisim, complete the Beginner’s Tutorial of the Guide to Being a Logisim User, up through step 4.
2. Read about the libraries and attributes of Logisim through its explorer pane, attribute table, and tool/component attributes.
3. Read about creating circuits in Logisim (but don’t go on to Using subcircuits yet).

### Exercise 1: Implementing Logical Formulas

Now that you can find your way around Logisim, we’ll practice using basic logic gates by reducing boolean formulas and implementing them as Logisim circuits. You will use Logisim’s “pin” element for both inputs and outputs. Inputs have a square outline, while outputs have a circular outline. You can switch a pin from input to output using the attributes menu, or you can use the two pin element buttons in the toolbar along the top of the window.

Reduce the following boolean expressions to sum of products form using Karnaugh Maps, then implement them as logisim circuits (source: Null & Lobur: Focus on Karnaugh Maps, exercise 2).

Can’t see any formulas? Make sure you enable all scripts on this page if you are using the NoScript browser plugin.

### Exercise 2: Decoders and Multiplexers

The reading for class today introduced two useful combinational building blocks: decoders and multiplexers. To practice using logic gates, you will build a three-bit decoder and an eight-input multiplexer in Logisim.

#### Build a Decoder

Recall that a decoder takes some number of bits of input, interprets these bits as a binary number, and then turns on the corresponding output pin; a decoder is effectively a binary to unary converter. The three-bit decoder you are building will have three input pins and eight output pins. When the three inputs are all zero, the zeroth output pin is on. If all three inputs are on (encoding the number seven in binary), the seventh output is on. Likewise for all the numbers inbetween. You are free to establish the order of bits however you like.

I recommend that you use separate pins and wires for each bit of input, but if you are feeling adventurous you can use Logisim’s busses. A bus is a bundles of wires, which means they can carry more than one bit of input. You can connect a bus to a multi-bit pin (see the component attributes to set the number of bits). To break individual bits out of a bus, use a splitter. These can be a little tricky to configure, but the mentors can help you.

You can think of a three-bit decoder as a series of eight logical formulas, each mapping the three input pins to one of the output pins. You can also approach this problem from the component viewpoint. Rather than thinking of an AND gate as the logical conjunction, you can think of it as a device that determines whether one input is mirrored to the output. For a two input AND gate, if one input is on, the output will mirror the second input to the AND gate. If one of the AND gate inputs is turned off, the output of the AND gate will always be off. It’s okay if one of these approaches doesn’t make sense; we will practice both in the future.

#### Build a Multiplexer

Once you have implemented a decoder using logic gates, build an eight-input multiplexer. A eight-input multiplexer has eight data inputs, three selector input bits, and one output. If the selector inputs encode the binary number zero, then the zeroth input should pass through to the output. If the selector inputs are encode the number two, then the second input should pass through to the output. Hint: a decoder is a useful building block in a multiplexer. The inputs to your three-bit decoder can serve as the selector bits for the multiplexer.