# Circuit Design

Using the types of logic gates we discussed, we can start building simple circuits and mimic what actual computers do.

First, though, we need to know how to represent these gates.

Here are all of the gates we discussed. Notice that exclusive or is labeled EOR instead of XOR, and XNOR is labeled ENOR instead; either way is fine – the critical portion is the way the gate is drawn.

Couple guidelines when drawing gates:

• It is important for the and gate’s back to be a straight line, and the or gate have a curve at the back.

• To invert (or “not”) a gate, you simply add a small circle in the front. Hence, the difference between the and and nand gates is just a small circle. Same with or and nor, and xor and xnor.

• The lines behind xor and xnor gates should also be curved.

When drawing gates on an exam, we will absolutely be docking points if your gates aren’t looking as they should be. Penmanship is important in this case!

In this class, these gates are all one-bit inputs; that is, each A and B you see in the diagram above is just a single bit. (8 bits = 1 byte.)

## Example Problem: Compare Characters

A character is usually 1 byte (8 bits). Design a circuit that will determine if two characters are the same.

We’ll have to have 8 gates because all of our gates only take 1 bit per input, and they are all 2-input gates. The first step is figuring out which gates produce true when both inputs are the same.

The gate that does this best is xnor. When both inputs are false, xnor produces true; when both inputs are false, xnor produces true. In every other case xnor produces false, which is exactly what we’re looking for.

Now it’s just a matter of linking up the gates together. For the two characters to be the same, the output of every xnor gate must be true. That sounds an awful lot like an and gate.