Logic Gate (AND, OR, XOR, NOT, NAND, NOR And XNOR)

Basic logic gates

There are seven basic logic gates: AND, OR, XOR, NOT, NAND, NOR and XNOR.

AND gate

The AND gate produces an output of true only when both inputs are true. Otherwise, the output is false. In other words, the output is 1 only when both inputs are 1, and 0 if even one of the inputs is 0. The gate is named so because, if 0 is false and 1 is true, the gate acts in the same way as the logical and operator. Figure 1 provides a truth table showing the circuit symbol and logic combinations for an AND gate. In the symbol, the input terminals are on the left, and the output terminal is on the right.

A diagram of the AND gate's circuit symbol and logic combinations.
Figure 1. A diagram of the AND logic gate.

OR gate

In the OR gate, which is among the most widely used logic circuits in digital devices and components, the output is true if one or both inputs are true. If both inputs are false, the output is false. For the output to be 1, at least one input must be 1. The gate gets its name from behaving like the logical inclusive or. Figure 2 shows a truth table for the OR gate.

A diagram of the OR gate's circuit symbol and logic combinations.
Figure 2. A diagram of the OR logic gate.

XOR gate

The XOR, or exclusive OR, gate acts in the same way as the logical either/or. The output is true if either input is true, but not both. The output is false if both inputs are false or both inputs are true. Similarly, the output is 1 (true or high) if the inputs are different, but 0 (false or low) if the inputs are the same. Figure 3 shows a truth table for a 2-input XOR gate.

A diagram of the XOR gate's circuit symbol and logic combinations.
Figure 3. A diagram of the XOR logic gate.

NOT gate

A logical inverter, sometimes called a NOT gate to differentiate it from other types of electronic inverter devices, has only one input. A NOT gate reverses the logic state. If the gate's input is 1, then the output is 0. If the input is 0, the output is 1. One of the only logic gates that accepts a single input and produces a single output, the NOT gate is also one of the simplest since all it does is reverse the input applied. As shown in Figure 4, a truth table for a NOT gate is simple.

A diagram of the inverter or NOT gate's circuit symbol and logic combinations.
Figure 4. A diagram of the inverter or NOT logic gate.

NAND gate

The negated AND, or NAND, gate operates as an AND gate followed by a NOT gate. Its symbol is an AND gate with the circle of a NOT gate at the output. The NAND gate produces a false or low output if both inputs are true. Otherwise, the output is true. Another way to visualize it is that a NAND gate inverts the output of an AND gate. It acts in the manner of the logical operator and followed by negation. Figure 5 provides a truth table showing the logic of a NAND gate for two types of inputs.

A diagram of the NAND gate's circuit symbol and logic combinations.
Figure 5. A diagram of the NAND logic gate.

NOR gate

The NOR, or NOT OR, gate is a combination OR gate followed by an inverter. Its output is true or high if both inputs are false or low (logic 0). Otherwise, the output is false. This logic is easy to understand with the gate's truth table, shown in Figure 6.

A diagram of the NOR gate's circuit symbol and logic combinations.
Figure 6. A diagram of the NOR logic gate.

XNOR gate

The XNOR, or exclusive NOR, gate is a combination of an XOR gate followed by an inverter. Its output is true if the inputs are the same and false if the inputs are different. It produces a true output, regardless of whether the inputs are true or false. However, they must both be the same for the output to be true. The XNOR truth table looks like Figure 7.

A diagram of the XNOR gate's circuit symbol and logic combinations.
Figure 7. A diagram of the XNOR logic gate.

Tag » What Is G A T E