A logic gate is an arrangement of electronicallyally-controlled switches arranged to calculate operations from boolean algebra. Logic gates have been constructed from relays, fluidics and optical elements. Nikola Tesla first filed the patents on a series of logic gates (patent no. US645576).
In practice, most modern logic gates are built from a grouping of transistors. For example, the boolean AND function can be implemented with two switches, A and B. A power lead is connected to one switch, and a wire is connected between the two, such that both A and B have to be "on" in order for the circuit to conduct electricity. If the switches themselves are electronically controlled, the circuit can be considered a logic gate, in this instance an AND gate.
inputs|output A B | 0 0 | 0 1 0 | 0 0 1 | 0 1 1 | 1
The US symbol for an AND gate is: and the IEC symbol is .
Another important arrangement is an OR gate. It also has two switches, but they are arranged so that if either switch is "on", the output will also be "on".
A B |out 0 0 | 0 1 0 | 1 0 1 | 1 1 1 | 1
The US circuit symbol for an OR gate is: and the IEC symbol is: .
A simpler arrangement is the NOT gate. Instead of a switch that lets current flow when it is pressed, we have a special switch that when pushed breaks the current when it is pressed - this can be used to construct a NOT gate.
A |out 0 | 1 1 | 0
The US circuit symbol for a NOT gate is: and the IEC symbol is: .
In electronics a NOT gate is more commonly called an inverter. The circle on the symbol is called a bubble, and is generally used in circuit diagrams to indicate an inverted input or output.
Using these reversed switches allows us to make alternate versions of the AND and OR gates, by virtue of DeMorgan's Law. Note that the layout of the switches in the two circuits is swapped when we turn the switches "backwards". Also note how the output of the first pair controls the operation of the NOT gate.
This may seem like an unnecessary complication, but in fact this is very useful. By removing the NOT gate from these alternate circuits, we create the so-called NAND (for NOT-AND) and NOR (for NOT-OR) gates.
The US circuit symbol for a NAND gate is: and the IEC symbol is: .
The US circuit symbol for a NOR gate is: and the IEC symbol is: .
In practice, the cheapest gate to manufacture is usually the NAND gate. Additionally, Charles Peirce showed that NAND gates alone (as well as NOR gates alone) can be used to reproduce all the other logic gates.
Two more gates are the exclusive-OR or XOR function and its inverse, exclusive-NOR or XNOR. Exclusive-OR is true only when exactly one of its inputs is true. In practice, these gates are built from combinations of simpler logic gates.
The US circuit symbol for an XOR gate is: and the IEC symbol is: .
The US circuit symbol for an XNOR gate is:
The preceding simple logic gates can be combined to form more complicated boolean logic circuits. Logic circuits are often classified in two groups: combinatorial logic, in which the outputs are continuous-time functions of the inputs, and sequential logic, in which the outputs depend on information stored by the circuit as well as on the inputs.
In practice, the gates are made from field effect transistors (FETs), particularly metal-oxide-semiconductor FETs (MOSFETs).