Have an Android phone?

Try our new game!

Logic gate

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

NOT, AND and OR - the most widely known gates
In recent days logic gates are usually electronic devices. For such devices "logical zero" means low voltage (or connected to the ground) and "logical one" means higher voltage (usually several volts). However is it possible to make purely mechanical, pneumatical, optical various other types of logic gates. Each type has its own representation of the logical levels (leaver position, pressure present, light on and so on). In general, computer can be made from almost everything.

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.

NOT, AND, OR

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 and NOR

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.

XOR

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.

The two input XOR (exclusive OR) logic gate)


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

See also

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

References

  1. 1 Reference about the basic logic gates
  2. 2 Reference on XOR element

Links