## Encyclopedia > Logic gate

Article Content

# Logic gate

A logic gate is an arrangement of electronically-controlled switches arranged to calculate operations from boolean algebra. Logic gates have been constructed from relays, fluidics and optical elements. 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.

``` A B |out         A      B
0 0 | 0         _|_    _|_
1 0 | 0     *__|   |__|   |__out
0 1 | 0
1 1 | 1
```
The circuit symbol for an AND gate 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
A B |out           _|_
0 0 | 0         __|   |__
1 0 | 1     *__|    B    |__out
0 1 | 1        |   _|_   |
1 1 | 1        |__|   |__|
```
The circuit symbol for an OR gate is:

A simpler arrangement is the NOT gate. It can be constructed from a single switch, A, with the switch wired "backwards", such that if the switch is "on" the output is "off". We indicate these reversed switches by replacing the "|" in the diagram with a "o".

``` A |out         A
0 | 1         _o_
1 | 0     *__|   |__out
```
The circuit symbol for a NOT gate 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.

``` Alternate AND circuit        Alternate OR circuit
A
_o_                       A      B
__|   |__                   _o_    _o_
*__|    B    |______        *__|   |__|   |___
|   _o_   |      |                         |
|__|   |__|     _o_                       _o_
*__|   |__out             *__|   |__out
```

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 circuit symbol for a NAND gate is:

The circuit symbol for a NOR gate 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 circuit symbol for an XOR gate is:

The 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.

Logic circuits include such devices as multiplexers, registers, ALUs, and computer memory, all the way up through complete microprocessors which can contain more than a million gates.

In practice, the gates are made from field effect transistors (FETs), particularly metal-oxide-semiconductor FETs (MOSFETs).

See also : digital circuit, NMOS, CMOS, Venn diagram, Karnaugh map, Sheffer stroke

All Wikipedia text is available under the terms of the GNU Free Documentation License

Search Encyclopedia
 Search over one million articles, find something about almost anything!

Featured Article
 Westhampton Beach, New York ... 7.5 km² (2.9 mi²) of it is land and 0.2 km² (0.1 mi²) of it is water. The total area is 2.35% water. Demographics As of the census of ...