# Logic gate

(Redirected from Logic Gate)

A logic gate is an arrangement of electronically-controlled switches arranged to calculate operations from boolean algebra.

For example, the boolean "AND" function can be implemented with two switches A and B. The wire is connected from switch A to B. Both A and B have to be on, in order for the circuit to be on.

Now, make the switches controlled by electricity, and the ciruit is a logic gate, an "AND gate." It has a truth table like this:

```A B | out
0 0 | 0
1 0 | 0
0 1 | 0
1 1 | 1
```

Another important arrangement is an "OR" gate. This also has two switches, but arranged so that either switch can turn on the output of the circuit. This has a truth table of:

```A B | out
0 0 | 0
1 0 | 1
0 1 | 1
1 1 | 1
```

The final arrangement is a "NOT" gate. Basically, it is a single switch A arranged so that the input turns off output. Its truth table is:

```A | out
0 | 1
1 | 0
```

These three operations are mathematically sifficient to implement a computer. Binary numbers can be added by creating logic to perform the necessary truth table.

Subsets of these operations can even be used to create the functions not provided by a logic family. By DeMorgan's Law, "AND" and "NOT" can be used to create "OR", and "OR" and "NOT" can be used to create "AND". Engineers sometimes use this in a trick called "negative logic" in which "and" operations become "or" operations just by considering 1 to be 0 and 0 to be 1.

There are several standard voltages for real electronic logic. The most common is 5V = 1, and 0V = 0. Most such circuits can operate comfortably from a 6V battery system. Other popular voltages are 3.3V (used for much VLSI), and 1.2-15V, used for a low-power logic family called "complementary metal oxide semiconductor."

In a computer, simple forms of logic (including archaic relay logic) have a resistor pull the input to 5V (or Vcc, as it is usually annotated). Thus an unconnected input will "float high" and the switch of the gate controlled by that input will turn off (or on). When a switch goes on, it usually connects an output to ground, zero volts, "pulling down" the gate's outputs storngly enough to overcome the resistor, and turn on (or off) the connected gates' switches.

In practice, the simplest, cheapest operation to actually implement is usually a logical "NAND". Mechanically, one wants to ground most of any circuit, usually by mounting the switches directly on the grounding metal. One then wants to have the powered part of the circuit cover the smallest amount of metal, to save wiring expenses. The truth table is: A B | out 0 0 | 1 0 1 | 1 1 0 | 1 1 1 | 0

This operation combines an "AND" and a "NOT" function. Charles Pierce showed a NAND operation is enough to create all possible binary digital computer circuits.

If the switches available to a logic family are normally turned on, and turned off by a powered input, the favored primitive operation is a "NOR."