# Multiplexer Exercise

## Objective

To gain experience using multiplexers and also using sub-circuits in Logisim.

One critical component of a CPU is the ALU: the arithmetic logic unit. This component allows us to actually perform computations. For this Lab you will create a sub-circuit that will function as a simple logic unit. That is, it will do the logic functions of a CPU (and, or, xor and not in this case) but not yet any arithmetic (because we haven't seen how to yet!).

Start by creating a sub-circuit in Logisim by choosing Project->Add Circuit from the main menu. This circuit should have the following pins:

• Two 8-bit input pins. These represent the two values that are being input into our logic unit.
• One 2-bit input pin. This represents the "operation code" and will tell our logic unit which of the four operations we are performing:
1. AND
2. OR
3. XOR
4. NOT
• One 8-bit output pin. This should be wired to the result of the operation. That is, if the operation code is 00, the output should be input0 ANDED with input1, and so on.

In the case of the NOT operation, only the first input is used. The output should be the inverse of that first input in that case.

Test your circuit by placing it in the "main" area and wiring some pins into it so that you can test that it works as expected.

## Tips

1. Begin by placing all of the pins and setting them to the right bit-width and input/output.
2. Place the 4 gates you will need for each operation and wire them to the inputs (you will need to set the data bits to 8).
3. Wire the four outputs of those into a multiplexer (using the one available in the "Plexers" menu in Logisim). Use the operation code pin as the select bits for the mux.
4. The output of the mux should be the output of the sub-circuit.

## Submitting

When your circuit works, please submit the .circ file under the lab assignment on Canvas