Others view: Four Russians (algorithm) ♦ welcome ♦ Matrix ♦ rss.xml ♦ Forum and issue tracker ♦ Conway's Game of Life ♦ 2D Fast Fourier Transform ♦

**Logic gate** is a device to perform a logical operation on one or more logic inputs, producing usually single logic output^{[1]}.

The simple logic gates that we describe first normally have only one output. Some circuits have two outputs, producing both the expected output and its inverted value (see NOT element below). They are also sometimes called logic gates.

The three logic gates that most of the sources introduce first are AND, NOT and OR. This is not a typical set of the modern computer, neither is minimal required set to implement any desired logic (either AND or OR is redundant in this collection and could be removed). However they seem closely matching human logic and boolean constructs in most of programming languages. Hence these three gates are easy to understand, and more sophisticated gates can be represented as a combination of them. Hence we also describe this trio first.

Logic gate NOT has only one input, and the signal level at the output is the opposite to the signal level at the input. In other words, if the element receives logical one in the input, it produces logical zero at the output, and if it receives zero in the input, it produces one and the output. The NOT gate is also called inverter, as it performs logical inversion.

Logic gate AND produces logical one at output only if it receives logical one at *all* its inputs (logical conjunction). The example shows gate with two inputs, and it produces one in the output only if both of these two inputs are set to one.

Logic gate OR produces logical one at output if it receives *at least one* logical one at any of its inputs (logical disjunction). Logic gates AND and OR can have any number of inputs.

NAND gate can be made by connecting NOT element to the output of AND element, and NOR gate can be made by connecting NOT gate to the output of OR gate. NAND and NOR are the most common "real world" gates, implemented in industrial chips. One type of the element (either NAND or NOR) is enough to buid a circuit realizing any logical operation.

*This gate is described in detail in separate article, XOR gate*

**XOR gate** is a logic gate that performs the exclusive OR operation. Verbally this operation can be defined as "either A or B, but not both". Exclusive OR (XOR) gate are less common but they are important in circuits that compare values for equality, compute checksums or perform some arithmetics^{[2]}.

Most of the commercially produced XOR gates have exactly two inputs and provide logical value 1 on the output only if values at both inputs are *the same*. This means, it produces 0 for input combinations 00 and 11 and 1 for combination 10 and 01. This operation is also called exclusive disjunction.

XOR gates with multiple inputs can be build by cascading the two input XOR gates.

- Delay line (also covers various signal generators)
- Trigger (or flip-flop) - memory capable devices

- Introductions to Logic Gates
- Boolean algebra and logic gates
- Logic gate article on Hardwaresecrets (focuses on hardware implementations)