Logic gate
A logic gate is a device that performs a Boolean function, which is a logical operation performed on one or more binary inputs. It produces a single binary output. The term can refer to an ideal logic gate, which has, for instance, zero rise time and unlimited fan-out. It can also refer to a non-ideal physical device (see ideal and real op-amps for comparison).
The main way of building logic gates uses diodes or transistors that act as electronic switches. Today, most logic gates are made from MOSFETs (metal–oxide–semiconductor field-effect transistors). They can also be built using vacuum tubes, electromagnetic relays with relay logic, fluidic logic, pneumatic logic, optics, molecules, acoustics, or even mechanical or thermal parts.
Logic gates can be connected in a chain, just as Boolean functions can be combined. This allows engineers to build a physical model of all of Boolean logic, and so all of the algorithms and mathematics that can be described with it. Logic circuits include devices such as multiplexers, registers, arithmetic logic units (ALUs), and computer memory. They also reach all the way up to complete microprocessors, which may contain more than 100 million logic gates.
Compound logic gates, AND-OR-invert (AOI) and OR-AND-invert (OAI), are often used in circuit design. Their construction using MOSFETs is simpler and more efficient than combining the individual gates.
There are seven basic logic gates: NOT, OR, NOR (Negation of the OR statement), AND, NAND (Negation of the AND statement), XOR (Exclusive OR), and XNOR (Negation of the Exclusive OR statement).
The binary number system was improved by Gottfried Wilhelm Leibniz and published in 1705. It was influenced by the ancient I Ching's binary system, and Leibniz showed that it combined arithmetic and logic. In 1837, Charles Babbage designed an analytical engine that used mechanical logic gates based on gears. In 1886, Charles Sanders Peirce described how electrical switching circuits could carry out logical operations. Early Electromechanical computers were built from switches and relay logic, before vacuum tubes (thermionic valves) and transistors were used to build later electronic computers. Ludwig Wittgenstein introduced a 16-row truth table as proposition 5.101 in Tractatus Logico-Philosophicus (1921). Walther Bothe, inventor of the coincidence circuit, received part of the 1954 Nobel Prize in physics for the first modern electronic AND gate, made in 1924. From 1935 to 1938, Konrad Zuse designed and built electromechanical logic gates for his computer Z1.
From 1934 to 1936, NEC engineer Akira Nakashima, Claude Shannon and Victor Shestakov introduced switching circuit theory in a series of papers. They showed that two-valued Boolean algebra, which they found independently, could describe how switching circuits work. Using electrical switches to carry out logic is the basic idea behind all electronic digital computers. This theory became the foundation of digital circuit design, and it became widely known in the electrical engineering community during and after World War II. Its careful, theory-based approach replaced the older methods used before it. In 1948, Bardeen and Brattain patented an insulated-gate transistor (IGFET) with an inversion layer, and their concept forms the basis of CMOS technology today. In 1957, Frosch and Derick were able to make PMOS and NMOS planar gates. A team at Bell Labs later showed a working MOS with PMOS and NMOS gates. Both types were later combined into complementary MOS (CMOS) logic by Chih-Tang Sah and Frank Wanlass at Fairchild Semiconductor in 1963.
Symbols
Two sets of symbols for basic logic gates are commonly used. Both are defined in ANSI/IEEE Std 91-1984 and its supplement ANSI/IEEE Std 91a-1991. The "distinctive shape" set is used for simple drawings. It comes from United States Military Standard MIL-STD-806 from the 1950s and 1960s, which is why it is sometimes called "military." The "rectangular shape" set gives every type of gate a rectangular outline and can show a much wider range of devices. The IEC 60617-12 standard has been adopted by other standards, such as EN 60617-12:1999 in Europe, BS EN 60617-12:1999 in the United Kingdom, and DIN EN 60617-12:1998 in Germany.
The goal of IEEE Std 91-1984 and IEC 617-12 was to give engineers one shared way to draw the complex logic in digital circuits, from medium-sized circuits like a 4-bit counter to large ones like a microprocessor. In the 1980s, schematic drawings were the main way to design circuit boards and custom ICs known as gate arrays. Today, custom ICs and the field-programmable gate array are usually designed with Hardware Description Languages (HDL) such as Verilog or VHDL.
De Morgan equivalent symbols
Using De Morgan's laws, an AND function is the same as an OR function with negated inputs and outputs. An OR function is the same as an AND function with negated inputs and outputs. A NAND gate is equivalent to an OR gate with negated inputs, and a NOR gate is equivalent to an AND gate with negated inputs. This gives alternative symbols that use the opposite main shape with the inputs and outputs negated. These symbols can make logic circuit diagrams clearer.
A De Morgan symbol can show more clearly what a gate is mainly for and which inputs and outputs are in the "on" (active) state. For example, a NAND gate that turns on a motor when either switch is pressed is easier to understand as an OR gate with negated inputs. De Morgan's theorem is most often used to build logic gates using only NAND gates or only NOR gates, for economic reasons.
Truth tables
This section compares the outputs of various logic gates.
| Input | Output | |
| A | Buffer | Inverter |
| 0 | 0 | 1 |
| 1 | 1 | 0 |
| Input | Output | ||||||||
| A | B | AND | NAND | OR | NOR | XOR | XNOR | IMPLY | NIMPLY |
| 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
Universal logic gates
Further information on the theoretical basis: Functional completeness
Charles Sanders Peirce showed in 1880–1881 that NOR gates alone (or NAND gates alone) can be used to reproduce the functions of all the other logic gates. However, his work on this was not published until 1933. The first published proof was by Henry M. Sheffer in 1913. For this reason, the NAND operation is sometimes called Sheffer stroke, and the logical NOR is sometimes called Peirce's arrow. Because of this, these gates are sometimes called universal logic gates.
| Type | NAND construction | NOR construction |
|---|---|---|
| NOT | ||
| AND | ||
| NAND | ||
| OR | ||
| NOR | ||
| XOR | ||
| XNOR | ||
| IMPLY | ||
| NIMPLY |
Data storage and sequential logic
Main article: Sequential logic
Logic gates can also hold a state, which lets them store data. A storage element can be built by connecting several gates in a "latch" circuit, and latches are used in static random-access memory. More advanced designs use clock signals and change only on a rising or falling edge of the clock. These are called edge-triggered "flip-flops". A flip-flop is also called a bistable circuit, because it has two stable states that it can keep. Several flip-flops together, used to store a number with many bits, form a register. A system built this way has memory and is called a sequential logic system, because its output depends on earlier states, meaning the order of its inputs. In contrast, the output of combinational logic depends only on its current inputs.
These logic circuits are used in computer memory. They differ in speed, complexity, and reliability, and many different designs are used depending on the application.
Manufacturing
See also: Unconventional computing and Semiconductor device fabrication
Logic gates can be built from relays, valves (vacuum tubes), or transistors, and a functionally complete system can be made from them. Electronic gates are much faster, use much less power, and are much smaller, usually by a factor of a million or more. A switch circuit makes a continuous metal path for current to flow in either direction. A semiconductor gate works more like a high-gain voltage amplifier. It takes in a tiny current and produces a low-impedance voltage at its output, and current cannot flow back from the output to the input.
Main article: Logic family
Designers often use ready-made gates from families such as the TTL 7400 series by Texas Instruments and the CMOS 4000 series by RCA. Many of these fixed gates are now being replaced by programmable logic devices like FPGAs, which can hold many gates in one chip and be reprogrammed to change a design. Gates can be cascaded, so one gate's output can feed the inputs of other gates. Each output can only drive a limited number of inputs, the "fan-out limit", and every gate has a "propagation delay" before a change in input shows at the output. These delays add up in synchronous circuits. Several logic families exist, including RDL, RTL, DTL, TTL, and CMOS, which differ in power use, speed, cost, and size. RTL, built with bipolar transistors, was used in early integrated circuits. It was later replaced by diode–transistor logic, then by TTL. As chips grew more complex, field-effect transistors (MOSFETs), including PMOS and NMOS, took over, and most modern chips use CMOS to save power.
Main article: Three-state logic
Three-state gates can give a high, low, or high-impedance output, and they are used on buses of the CPU so several chips can send data. Many early computers, such as the Harvard Mark I, used relay logic gates built from electromechanical relays. Gates have also been made with pneumatic devices, with molecular logic gates, from DNA nanotechnology (used in the computer MAYA, see MAYA-II), from quantum logic gate effects tied to quantum mechanical behavior, and as Photonic logic gates using nonlinear optical effects. In principle, any gate that is functionally complete, such as a NOR or NAND gate, can build any digital logic circuit, and multiplexers made from simple gates can replace three-state bus systems.
| Logic family | Abbreviation | Description |
|---|---|---|
| Diode logic | DL | |
| Tunnel diode logic | TDL | Exactly the same as diode logic but can perform at a higher speed. |
| Neon logic | NL | Uses neon bulbs or 3-element neon trigger tubes to perform logic. |
| Core diode logic | CDL | Performed by semiconductor diodes and small ferrite toroidal cores for moderate speed and moderate power level. |
| 4Layer Device Logic | 4LDL | Uses thyristors and SCRs to perform logic operations where high current and or high voltages are required. |
| Direct-coupled transistor logic | DCTL | Uses transistors switching between saturated and cutoff states to perform logic. The transistors require carefully controlled parameters. Economical because few other components are needed, but tends to be susceptible to noise because of the lower voltage levels employed. Often considered to be the father to modern TTL logic. |
| Metal–oxide–semiconductor logic | MOS | Uses MOSFETs (metal–oxide–semiconductor field-effect transistors), the basis for most modern logic gates. The MOS logic family includes PMOS logic, NMOS logic, complementary MOS (CMOS), and BiCMOS (bipolar CMOS). |
| Current-mode logic | CML | Uses transistors to perform logic but biasing is from constant current sources to prevent saturation and allow extremely fast switching. Has high noise immunity despite fairly low logic levels. |
| Quantum-dot cellular automata | QCA | Uses tunnelable q-bits for synthesizing the binary logic bits. The electrostatic repulsive force in between two electrons in the quantum dots assigns the electron configurations (that defines state 1 or state 0) under the suitably driven polarizations. This is a transistorless, currentless, junctionless binary logic synthesis technique allowing it to have very fast operation speeds. |
| Ferroelectric FET | FeFET | FeFET transistors can retain their state to speed recovery in case of a power loss. |

Quiz time!
5 questions about Logic gate
What kind of output does a logic gate produce?
Keep exploring
This article is a child-friendly adaptation of the Wikipedia article on Logic gate, available under CC BY-SA 4.0.
Images from Wikimedia Commons. Tap any image to view credits and license.