All Topics  
Logic gate

 

 

 

 

 

Logic gate


 
 


A logic gate performs a logical operation on one or more logic inputs and produces a single logic output.
Because the output is also a logic-level value, an output of one logic gate can connect to the input of one or more other logic gates. The logic normally performed is Boolean logicBoolean logic

Boolean logic is a complete system for logical operations....
 and is most commonly found in digital circuitFacts About Digital circuit

A digital circuit is based on a number of discrete voltage levels, as distinct from an analog circuit that uses continuous v...
s. Logic gates are primarily implemented electronicallyElectronics

The field of electronics comprises the study and use of systems that operate by controlling the flow of electrons in device...
 using diodeDiode

In electronics, a diode is a component that restricts the direction of movement of charge carriers....
s or transistorTransistor

The transistor is a three terminal solid state semiconductor device that can be used for amplification, switching, voltage s...
s, but can also be constructed using electromagnetic relayRelay Overview

A relay is an electrical switch that opens and closes under control of another electrical circuit....
s, fluidicsFluidics

Fluidics is the use of a fluid or compressible medium to perform analog or digital operations similar to those performed wit...
, opticsOptics

Optics is a branch of physics that describes the behavior and properties of light and the interaction of light with matter....
, moleculesMolecular logic gate

A molecular logic gate in nanotechnology is a logic gate on a molecular level....
, or even mechanicalAnalytical engine

The analytical engine, an important step in the history of computers, was the design of a mechanical general-purpose digital...
 elements.

In electronic logic, a logic level is represented by a voltage or current, (which depends on the type of electronic logic in use). Each logic gate requires power so that it can source and sink currents to achieve the correct output voltage. In logic circuit diagrams the power is not shown, but in a full electronic schematic, power connections are required.

Truth table

A truth table is a table that describes the behaviour of a logic gate. It lists the value of the output for every possible combination of the inputs and can be used to simplify the number of logic gates and level of nesting in an electronic circuit. In general the truth table does not lead to an efficient implementation; a minimization procedure, using Karnaugh maps, the Quine–McCluskey algorithmQuine–McCluskey algorithm

The QuineMcCluskey algorithm is a method used for minimization of boolean functions....
 or a heuristic algorithm is required for reducing the circuit complexity.

Background

The simplest form of electronic logic is diode logicDiode logic

Diode logic is a logic family that makes use of diodes to construct logic gates for Boolean logic circuits....
. This allows AND and OR gates to be built, but not inverters, and so is an incomplete form of logic. Further, without some kind of amplification it is not possible to have such basic logic operations cascaded as required for more complex logic functions. To build a complete logic system, valves (vacuum tubes) or transistorTransistor

The transistor is a three terminal solid state semiconductor device that can be used for amplification, switching, voltage s...
s can be used. The simplest family of logic gates using bipolar transistors is called resistor-transistor logicResistor-transistor logic

Resistor-transistor logic is a class of digital circuits built from bipolar junction transistors, and resistors; it is the e...
, or RTL. Unlike diode logic gates, RTL gates can be cascaded indefinitely to produce more complex logic functions. These gates were used in early integrated circuitIntegrated circuit

A monolithic integrated circuit is a miniaturized electronic circuit which has been manufactured in the surface of a thin ...
s. For higher speed, the resistors used in RTL were replaced by diodes, leading to diode-transistor logicDiode-transistor logic

Diode-Transistor Logic is a class of digital circuits built from bipolar junction transistors, diodes and resistors; it is t...
, or DTL. It was then discovered that one transistor could do the job of two diodes in the space of one diode even better, by more quickly switching off the following stage, so transistor-transistor logicTransistor-transistor logic

Transistor-Transistor Logic is a class of digital circuits built from bipolar junction transistors , and resistors....
, or TTL, was created. In virtually every type of contemporary chip implementation of digital systems, the bipolar transistors have been replaced by complementary field-effect transistors to reduce size and power consumption still further, thereby resulting in complementary metal-oxide-semiconductor logic.

For small-scale logic, designers now use prefabricated logic gates from families of devices such as the TTLFacts About Transistor-transistor logic

Transistor-Transistor Logic is a class of digital circuits built from bipolar junction transistors , and resistors....
 7400 series7400 series

The 7400 series of TTL integrated circuit SSI devices were historically important as the first widespread family of IC dev...
 by Texas InstrumentsTexas Instruments

| homepage =}}Texas Instruments , better known in the electronics industry as TI, is an American company ba...
 and the CMOSCMOS Summary

Complementary metaloxidesemiconductor , is a major class of integrated circuits....
 4000 series4000 series

The 4000 series is the general classification used to refer to the industry standard integrated circuits which implement a v...
 by RCARCA

RCA, formerly an initialism for the Radio Corporation of America, is now a trademark used by two companies for product...
, and their more recent descendants. Increasingly, these fixed-function logic gates are being replaced by programmable logic deviceProgrammable logic device

A programmable logic device or PLD is an electronic component used to build digital circuits....
s, which allow designers to pack a large number of mixed logic gates into a single integrated circuitIntegrated circuit

A monolithic integrated circuit is a miniaturized electronic circuit which has been manufactured in the surface of a thin ...
. The field-programmable nature of programmable logic deviceProgrammable logic device

A programmable logic device or PLD is an electronic component used to build digital circuits....
s such as FPGAField-programmable gate array

A field programmable gate array is a semiconductor device containing programmable logic components and programmable interco...
s has removed the 'hard' property of hardware; it is now possible to change the logic design of a hardware system by reprogramming some of its components, thus allowing the features or function of a hardware implementation of a logic system to be changed.

Electronic logic gates differ significantly from their relay-and-switch equivalents. They are much faster, consume much less power, and are much smaller (all by a factor of a million or more in most cases). Also, there is a fundamental structural difference. The switch circuit creates a continuous metallic path for current to flow (in either direction) between its input and its output. The semiconductor logic gate, on the other hand, acts as a high-gainGain

In electronics, gain is usually taken as the mean ratio of the signal output of a system to the signal input of the system....
 voltageVoltage

Voltage is the difference of electrical potential between two points of an electrical network, expressed in volts ....
 amplifierElectronic amplifier

The term amplifier as used in this article can mean either a circuit using a single active device or a complete system su...
, which sinks a tiny current at its input and produces a low-impedance voltage at its output. It is not possible for current to flow between the output and the input of a semiconductor logic gate.

Another important advantage of standardised integrated circuitIntegrated circuit

A monolithic integrated circuit is a miniaturized electronic circuit which has been manufactured in the surface of a thin ...
 logic familiesLogic family

In computer engineering, a logic family of monolithic digital integrated circuit devices is a group of electronic logic gate...
, such as the 7400 and 4000 families, is that they are cascadable. This means that the output of one gate can be wired to the inputs of one or several other gates, and so on. Systems of arbitrary complexity can be built without great concern of the designer for the internal workings of the gates, provided the limitations of each integrated circuit are considered.

The output of one gate can only drive a finite number of inputs to other gates, a number called the 'fanoutFanout

Fanout is a measure of the ability of a logic gate output, implemented electronically, to drive a number of inputs of other ...
 limit'. Also, there is always a delay, called the 'propagation delayPropagation delay

In electronics and digital circuits, the propagation delay is the amount of time starting from when the input to a logic gat...
', from a change in input of a gate to the corresponding change in its output. When gates are cascaded, the total propagation delay is approximately the sum of the individual delays, an effect which can become a problem in high-speed circuits. Additional delay can be caused when a large number of inputs are connected to an output, due to the distributed capacitanceCapacitance

Capacitance is a measure of the amount of electric charge stored for a given electric potential....
 of all the inputs and wiring and the finite amount of current that each output can provide.

Logic gates and hardware


NANDSheffer stroke

The Sheffer stroke, written "|" or "↑", denotes a logical operation that is equivalent to the negation of the conjuncti...
 and NORNOR gate

The NOR gate is a digital logic gate that implements logical NOR - it behaves according to the truth table to the right....
 logic gates are the two pillars of logic, in that all other types of Boolean logic gates (i.e., ANDAND gate Overview

The AND gate is a digital logic gate that implements logical conjunction - it behaves according to the truth table to the ri...
, OROR gate

The OR gate is a digital logic gate that implements logical disjunction - it behaves according to the truth table to the rig...
, NOTNOT gate

The NOT gate is a digital logic gate that behaves according to the truth table to the right....
, XORXOR gate

The XOR gate is a digital logic gate that implements exclusive disjunction - it behaves according to the truth table to the...
, XNORXNOR gate

The XNOR gate is a digital logic gate whose function is the inverse of the exclusive OR gate....
) can be created from a suitable network of just NAND or just NOR gate(s). They can be built from relays or transistors, or any other technology that can create an inverter and a two-input AND or OR gate. Hence the NAND and NOR gates are called the universal gates.

For an input of 2 variables, there are 16 possible boolean algebraic functions. These 16 functions are enumerated below, together with their outputs for each combination of inputs variables.

INPUT A 0 0 1 1
B 0 1 0 1
OUTPUT 0 0 0 0 0
A AND B 0 0 0 1
A > B * 0 0 1 0
A 0 0 1 1
A < B * 0 1 0 0
B 0 1 0 1
A XOR B 0 1 1 0
A OR B 0 1 1 1
A NOR B 1 0 0 0
A XNOR B 1 0 0 1
NOT B 1 0 1 0
A = B * 1 0 1 1
NOT A 1 1 0 0
A = B * 1 1 0 1
A NAND B 1 1 1 0
1 1 1 1 1


The four functions labeled with a "*" are the logical implicationLogical implication

In mathematics and mathematical logic, the concept of logical implication encompasses a specific logical function, a specifi...
 functions: "A = B" can be read as "A implies B"; it follows that "A > B" is "A does not imply B". These four functions are less common and are usually not implemented directly as logic gates.

Symbols


There are two sets of symbols in common use, both now defined by ANSIAmerican National Standards Institute

The American National Standards Institute or ANSI is a private nonprofit organization that oversees the development of volu...
/IEEEInstitute of Electrical and Electronics Engineers

The Institute of Electrical and Electronics Engineers or IEEE is an international non-profit, professional organizati...
 Std 91-1984 and its supplement ANSI/IEEE Std 91a-1991. The "distinctive shape" set, based on traditional schematics, is used for simple drawings and is quicker to draw by hand. It is sometimes unofficially described as "military", reflecting its origin if not its modern usage. The "rectangular shape" set, based on IECInternational Electrotechnical Commission

The International Electrotechnical Commission is an international standards organization dealing with electrical, electroni...
 60617-12, has rectangular outlines for all types of gate, and allows representation of a much wider range of devices than is possible with the traditional symbols. The IEC's system has been adopted by other standards, such as ENEuropean Committee for Standardization

CEN, the European Committee for Standardization or Comit Europen de Normalisation, is a private non-profit organ...
 60617-12:1999 in Europe and BS EN 60617-12:1999 in the United Kingdom.

The goal of IEEE Std 91-1984 was to provide a uniform method of describing the complex logic functions of digital circuits with schematic symbols. These functions were more complex than simple AND and OR gates. They could be medium scale circuits such as a 4-bit counter to a large scale circuits such as a microprocessor. The 1984 version did not include the "distinctive shape" symbols. These were added to the 1991 supplement with this note: "The distinctive-shape symbol is, according to IEC Publication 617, Part 12, not preferred, but is not considered to be in contradiction to that standard."

In the 1980s, schematics were the predominant method to design both circuit boards and custom ICs known as gate arrayGate array

A gate array or uncommitted logic array is an approach to the design and manufacture of application-specific integrate...
s. Today custom ICs and the field-programmable gate arrayField-programmable gate array

A field programmable gate array is a semiconductor device containing programmable logic components and programmable interco...
 are typically designed with Hardware Description LanguagesHardware description language

In electronics, a hardware description language or HDL is any language from a class of computer languages for formal d...
 (HDL) such as VerilogVerilog

Verilog is a hardware description language used to model electronic systems....
 or VHDL. The need for complex logic symbols has diminished and distinctive shape symbols are still the predominate style.

Type Distinctive shape Rectangular shape Boolean algebra between A & B Truth table
ANDAND gate

The AND gate is a digital logic gate that implements logical conjunction - it behaves according to the truth table to the ri...
INPUT OUTPUT
A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1
OROR gate

The OR gate is a digital logic gate that implements logical disjunction - it behaves according to the truth table to the rig...
INPUT OUTPUT
A B A OR B
0 0 0
0 1 1
1 0 1
1 1 1
NOTNOT gate

The NOT gate is a digital logic gate that behaves according to the truth table to the right....
INPUT OUTPUT
A NOT A
0 1
1 0
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 (active-low) input or output.
NANDSheffer stroke

The Sheffer stroke, written "|" or "↑", denotes a logical operation that is equivalent to the negation of the conjuncti...
INPUT OUTPUT
A B A NAND B
0 0 1
0 1 1
1 0 1
1 1 0
NORNOR gate

The NOR gate is a digital logic gate that implements logical NOR - it behaves according to the truth table to the right....
INPUT OUTPUT
A B A NOR B
0 0 1
0 1 0
1 0 0
1 1 0
In practice, the cheapest gate to manufacture is usually the NAND gate. Additionally, Charles PeirceCharles Peirce

Charles Sanders Peirce, was an American polymath, born in Cambridge, Massachusetts....
 showed that NAND gates alone (as well as NOR gates alone) can be used to reproduce the functions of all the other logic gates.



Two more gates are the exclusive-OR or XOR function and its inverse, exclusive-NOR or XNOR. The two input Exclusive-OR is true only when the two input values are different, false if they are equal, regardless of the value. If there are more than two inputs, the gate generates a true at its output if the number of trues at its input is odd. In practice, these gates are built from combinations of simpler logic gates.
XORXOR gate

The XOR gate is a digital logic gate that implements exclusive disjunction - it behaves according to the truth table to the...
INPUT OUTPUT
A B A XOR B
0 0 0
0 1 1
1 0 1
1 1 0
XNORXNOR gate

The XNOR gate is a digital logic gate whose function is the inverse of the exclusive OR gate....
INPUT OUTPUT
A B A XNOR B
0 0 1
0 1 0
1 0 0
1 1 1

DeMorgan equivalent symbols


By use of De Morgan's theoremDe Morgan's laws

In logic, De Morgan's laws are rules in formal logic relating pairs of dual logical operators in a systematic manner expres...
, an AND gate can be turned into an OR gate by inverting the sense of the logic at its inputs and outputs. This leads to a separate ends can be replaced by a simple bubble-less connection and a suitable change of gate. If the NAND is drawn as OR with input bubbles, and a NOR as AND with input bubbles, this gate substitution occurs automatically in the diagram (effectively, bubbles "cancel"). This is commonly seen in real logic diagrams - thus the reader must not get into the habit of associating the shapes exclusively as OR or AND shapes, but also take into account the bubbles at both inputs and outputs in order to determine the "true" logic function indicated.

See Active high and active low for reference.

Storage of bits


Related to the concept of logic gates (and also built from them) is the idea of storing a bit of information. None of the gates discussed up to here can store a value by itself: when the inputs change, the outputs immediately react. It is possible to make a storage element either through a capacitorCapacitor

A capacitor is an electrical device that can store energy in the electric field between a pair of closely spaced conductors....
 (which stores charge due to its physical properties) or by feedback. Connecting the output of a gate to the input causes it to be put through the logic again, and choosing the feedback correctly allows it to be preserved or modified through the use of other inputs. A set of gates arranged in this fashion is known as a "latch", and more complicated designs that utilize clockClock signal

In electronics and especially synchronous digital circuits, a clock signal is a signal used to coordinate the actions of two...
s (signals that oscillate with a known period) and change only on the rising edge are called edge-triggered "flip-flopFlip-flop (electronics)

In electronics and digital circuits, the flip-flop or bistable multivibrator is a pulsed digital circuit capable of se...
s". The combination of multiple flip-flops in parallel, to store a multiple-bit value, is known as a register. When using any of these gate setups the overall system has memory; it is then called a sequential logicSequential logic

In digital circuit theory, sequential logic is a type of logic circuit whose output depends not only on the present input bu...
 system since its output can be influenced by its previous state(s).

These registers or capacitor-based circuits are known as computer memoryComputer storage

Computer storage, computer memory, and often casually memory refer to computer components, devices and recording...
. They vary in performance, based on factors of speed, complexity, and reliability of storage, and many different types of designs are used based on the application.

Three-state logic gates



Three-state, or 3-state, logic gates have three states of the output: high (H), low (L) and high-impedance (Z). The high-impedance state plays no role in the logic, which remains strictly binary. These devices are used on busElectrical bus

An electrical bus is a physical electrical interface where many devices share the same electric connection....
es to allow multiple chips to send data. A group of three-states driving a line with a suitable control circuit is basically equivalent to a multiplexerMultiplexer

A multiplexer is a device that encodes or multiplexes information from two or more data sources into a single channel....
, which may be physically distributed over separate devices or plug-in cards.

In electronics, a high output would mean the output is sourcing current from the positive power terminal (positive voltage). A low output would mean the output is sinking current to the negative power terminal (zero voltage). High impedance would mean that the output is effectively disconnected from the circuit.

'Tri-state', a widely-used synonym of 'three-state', is a trademark of the National Semiconductor CorporationNational Semiconductor

Headquartered in Santa Clara, California, National Semiconductor is one of the largest semiconductor manufacturers....
.

Miscellaneous

Logic circuits include such devices as multiplexerMultiplexer

A multiplexer is a device that encodes or multiplexes information from two or more data sources into a single channel....
s, registersProcessor register

In computer architecture, a processor register is a small amount of very fast computer memory used to speed the execution of...
, arithmetic logic unitArithmetic logic unit

The arithmetic logic unit/arithmetic-logic unit of a computer's CPU is a part of the execution unit, a core component ...
s (ALUs), and computer memoryComputer storage

Computer storage, computer memory, and often casually memory refer to computer components, devices and recording...
, all the way up through complete microprocessorMicroprocessor

A microprocessor is a digital electronic component with transistors on a single semiconductor integrated circuit ....
s which can contain more than a 100 million gates. In practice, the gates are made from field effect transistorField effect transistor

The field-effect transistor is a transistor that relies on an electric field to control the shape and hence the conductivit...
s (FETs), particularly metal-oxide-semiconductor FETs.

Compound logic gates AND-OR-InvertAND-OR-Invert

AND-OR-Invert logic and AOI gates are two-level compound logic functions constructed from the combination of one or more A...
 (AOI) and OR-AND-Invert (OAI) are often employed in circuit design because their construction using MOSFET's is simpler and more efficient than the sum of the individual gates.

In reversible logicReversible computing

The term reversible computing refers to any computational process that is reversible, i.e., time-invertible, meaning tha...
, Toffoli gateToffoli gate

In computer science, the Toffoli gate, invented by Tommaso Toffoli, is a universal reversible logic gate, which means that a...
s are used.

History and development


The earliest logic gates were made mechanically. Charles BabbageCharles Babbage

Charles Babbage was an English mathematician, analytical philosopher, mechanical engineer and computer scientist who origi...
, around 1837, devised the Analytical EngineAnalytical engine

The analytical engine, an important step in the history of computers, was the design of a mechanical general-purpose digital...
. His logic gates relied on mechanical gearing to perform operations. Electromagnetic relays were later used for logic gates. In 1891, Almon StrowgerAlmon Strowger

Almon Brown Strowger gave his name to the electromechanical telephone exchange technology that his invention and patent insp...
 patented a device containing a logic gate switch circuit (

See also

  • And-inverter graphAnd-inverter graph Summary

    An and-inverter graph is a directed, acyclic graph that represents a structural implementation of the logical functionality ...
  • Boolean algebra topics
  • Boolean functionBoolean function

    In mathematics, a finitary boolean function is a function of the form f : Bk → B, where B =&...
  • Digital circuitDigital circuit

    A digital circuit is based on a number of discrete voltage levels, as distinct from an analog circuit that uses continuous v...
  • Espresso heuristic logic minimizer
  • FanoutFanout

    Fanout is a measure of the ability of a logic gate output, implemented electronically, to drive a number of inputs of other ...
  • Flip-flop (electronics)Flip-flop (electronics)

    In electronics and digital circuits, the flip-flop or bistable multivibrator is a pulsed digital circuit capable of se...
  • Karnaugh mapKarnaugh map

    The Karnaugh map, also known as a Veitch diagram, is a tool to facilitate management of Boolean algebraic expressions....
  • Logic familyLogic family

    In computer engineering, a logic family of monolithic digital integrated circuit devices is a group of electronic logic gate...
  • Logical graphLogical graph

    A logical graph is a special type of graph-theoretic structure in any one of several systems of graphical syntax that Charle...
  • NMOS logicNMOS logic

    nMOS logic uses n-type metal-oxide-semiconductor field effect transistors to implement logic gates and other digital circui...
  • Propositional calculusPropositional calculus

    In mathematical logic, a propositional calculus is a formal system that represents the materials and the principles of pr...
  • Race hazard
  • Reversible computingReversible computing

    The term reversible computing refers to any computational process that is reversible, i.e., time-invertible, meaning tha...
  • Truth tableTruth table

    A truth table is a mathematical table used in logic specifically in connection with boolean algebra, boolean functions, and...
  • Venn diagramVenn diagram

    Venn diagrams are illustrations used in the branch of mathematics known as set theory....


Further reading

  • Awschalom, D., D. Loss, and N. Samarth, Semiconductor Spintronics and Quantum Computation (2002), Springer-Verlag, Berlin, Germany.
  • Bostock, Geoff, Programmable Logic Devices. Technology and Applications (1988), McGraw-Hill, New York, NY.
  • Brown, Stephen D. et al., Field-Programmable Gate Arrays (1992), Kluwer Academic Publishers, Boston, MA.

External links