# Gate Exercise

## Objective

To gain experience building circuits which use logic gates to compute logical expressions.

For this lab, you will write a circuit which displays binary numbers in the range 0-3 on a "seven segment" display, which can display any subset of seven line segments to form numbers (i.e. an alarm clock display).

Your circuit will have one 2-bit input pin to represent a number 0-3. To get the two bits of it separated, use a "splitter" under the wiring menu. It will also feature a seven-segment display (found under the "Input/Output" menu).

In between, will be a number of gates connecting the two. The goal of the circuit is to have the seven-segment display wired so that it shows the decimal value of the binary number represented by the pins.

## Tips

• From the two-bit number, we want four wires where each corresponds to the possible values 0, 1, 2, and 3. Use AND gates to get these wires. This is called "decoding" the number. Exactly one of these wires will be on at any time.
• Next "or" in all of the possible values for each of the seven segments and connect them up.
• Try connecting a power right into each of the seven-segment inputs to see which one controls which segment.
• Logic gates can have their inputs negated before they come in. This will reduce the number of not gates involved.
• Logic gates also have a variable number of inputs. You don't need to restrict your circuit to two-input gates!

## Extra Credit

Using a two-bit input to represent the numbers 0-3 requires understanding the concepts of the lab just as much as representing all 10 digits, but require much fewer gates.

For extra credit, make your circuit handle either:

• The digits 0-7 using a three-bit input.
• The digits 0-9 using a four-bit input (but ignoring the 10-15 values).

## Submitting

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