• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microcontroller Tips

Microcontroller engineering resources, new microcontroller products and electronics engineering news

  • Products
    • 8-bit
    • 16-bit
    • 32-bit
    • 64-bit
  • Applications
    • Automotive
    • Connectivity
    • Consumer Electronics
    • Industrial
    • Medical
    • Security
  • EE Forums
    • EDABoard.com
    • Electro-Tech-Online.com
  • Videos
    • TI Microcontroller Videos
  • EE Resources
    • DesignFast
    • eBooks / Tech Tips
    • FAQs
    • LEAP Awards
    • Podcasts
    • Webinars
    • White Papers
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide

What are basic logic gates?

June 3, 2022 By Jeff Shepard

Logic gates are the building blocks of digital circuits. The basic logic gates include AND, OR, NOT, NAND, NOR, XOR, and XNOR. They can be implemented in digital hardware using transistors and/or diodes. In a few applications, they are implemented using electromechanical relays, fluidics, pneumatics, or optical elements. A series of logic gates can be used to implement complex Boolean functions.

This FAQ begins with a review of the seven basic logic gate types, reviews the concepts of the compound and universal gates, and closes with a brief look at quantum gates that will provide the basis for future generations of quantum computers.

The seven basic logic gates are:

  • AND produces a 0 output unless both the X and Y inputs are both 1, when the output is 1.
  • NAND is the negation of AND, it produces a 1 output unless both the X and Y inputs are both 1, when the output is 0.
  • OR produces a 0 output only when both the X and Y inputs are 0, otherwise the output is 1.
  • NOR is the negation of OR and produces a 1 output when both inputs are 0, otherwise the output is 0.
  • XOR is an exclusive OR and outputs 1 if there is only a single 1 input between X and Y, inputs of two 0s or two 1s produce an output of 0.
  • XNOR is the inverse of XOR and inputs of two 0s and two 1s will produce an output of 1, it produces an output of 0 if there is a single 1 input between X and Y.
  • NOT is also called an inverter; if the input is 1, the output is 0, and if the input is a 0 the output is 1.

The most common symbols for logic gates in the U.S. are from the American National Standards Institute (ANSI). The same symbols are called the Mil-standard symbols since they are also recognized by the U.S. Department of Defense (Figure 1). A circle on a symbol is called a bubble and indicates a logic negation between external and internal logic states (1 to 0, or vice versa). Variations of these symbols have been developed by the National Electrical Manufacturers Association (NEMA), the International Electrotechnical Commission (IEC), and other standards bodies.

Figure 1: The seven ANSI symbols for basic logic gates. (Image: Digilent)

These basic logic gates are used to build logic circuits, including multiplexers, arithmetic logic units (ALUs), registers, computer memories, and other structures (Figure 2). While logic gates can be made using various devices and structures, MOSFET-based gates are the most common type found in digital electronic devices. In addition, compound logic gates such as AND-OR-Invert (AOI) and OR-AND-Invert (OAI) are often employed in actual circuit designs since they tend to be simpler to use in complex structures and are more energy efficient compared with an equivalent function implemented with simple logic gates.

Figure 2: A 4:1 multiplexer using four input AND gates and three OR gates. (Image: Wikipedia)

Universal gates

NAND and NOR gates are called universal gates since they can be used to implement any Boolean function using any other type of gate (Figure 3). Both NAND and NOR gates are the basic gates used in all digital logic integrated circuits. In practical designs, an AND gate is generally fabricated as a NAND gate followed by an inverter, and an OR gate is fabricated as a NOR gate followed by an inverter.

Figure 3: The NAND gate is an example of a universal gate that can be used to build all basic logic gates. (Engineers Garage)

Quantum gates

Quantum gates operate on quantum bits (qubits) that can simultaneously exist in two states, unlike classical bits that are either a ‘1’ or a ‘0’. The two basic qubit states can be expressed as |0⟩ and |1⟩ in Dirac notation. |0⟩ is the quantum state that will always give the result 0 when converted to classical logic by a measurement, and |1⟩ will always convert to 1: However, a qubit can also exist as a linear combination of both states.

There are numerous ways to implement quantum gates, but all quantum gates leverage the concepts of superposition and entanglement that do not exist for classical gates. In addition, quantum gates (as well as some types of classical gates) are reversible. Reversibility means that, in theory, quantum gates never lose information. Pauli gates and Hadamard gates are examples of two types of logic gates used in quantum computing.

The Pauli gates are based on Pauli spin matrices and are similar to classic logic gates. Pauli spin matrices are useful for calculating changes to the spin of a single electron. Electron spin is a common property to form a qubit in today’s quantum gates. There is one Pauli gate/matrix for each axis in space (X, Y, and Z).

A Hadamard gate, or H-gate, is a strictly quantum structure that does not map into classic logic gates. An H-gate can be used to transform a defined quantum state, such as spin-down, into a complex quantum state, such as a superposition of both spin-up and spin-down at the same time. For example, if a spin-up or spin-down electron passes through an H-gate, it’s transformed into a more complex structure that combines spin-up and spin-down. An H-gate is sometimes used as the first computation in a quantum program because it transforms pre-set, or initialized, qubits back into their natural complex state to leverage the full capabilities of quantum computing.

For more information on quantum computing, see; “What are the basics of quantum computing?”

Summary

Logic gates form the basis of modern digital computing and are used to implement complex logic circuits such as multiplexers, arithmetic logic units (ALUs), registers, and computer memories. Many digital ICs are composed mostly of NAND and NOR gates called universal gates and can be used to implement any Boolean function using any other type of gate. To develop practical quantum computers, new logic gate approaches, and structures will be needed to handle the concepts of superposition and entanglement that do not exist for classical gates.

References

Demystifying Quantum Gates, Towards Data Science
Logic gate, Wikipedia
Logic gates, Digilent
Multiplexer, Wikipedia
Universal gates, University of Peshawar
VHDL Tutorial – 7 NAND gate as universal gate using VHDL, Engineers Garage
VHDL Tutorial – 8: NOR gate as a universal gate, Engineers Garage

 

You may also like:


  • What are the basics of quantum computing?
  • flash
    Tech refresher: Basics of flash, NAND flash, and NOR flash
  • NAND and NOR Flash
    NOR flash and NAND flash memory usage trends are evolving

Filed Under: FAQ, Featured, microcontroller, Storage Tagged With: FAQ

Primary Sidebar

DesignFast

Design Fast Logo
Component Selection Made Simple.

Try it Today
design fast globle

EE Training Center Classrooms

EE Classrooms

CURRENT DIGITAL ISSUE

A frequency you can count on There are few constants in life, but what few there are might include death, taxes, and a U.S. grid frequency that doesn’t vary by more than ±0.5 Hz. However, the certainty of the grid frequency is coming into question, thanks to the rising percentage of renewable energy sources that…

Digital Edition Back Issues

Subscribe to our Newsletter

Subscribe to weekly industry news, new product innovations and more.

Subscribe today

RSS Current EDABoard.com discussions

  • LED Drive Using Mosfet
  • Mosfet SSR triac output shunt circuit design
  • Active Balun Design
  • Thyristor Gate Drive
  • Specman training for new user

RSS Current Electro-Tech-Online.com Discussions

  • Two 300nH inductor in series, can get higher current?
  • Best way to reduce voltage in higher wattage system?
  • What is "off the shelf values for inductors"?
  • Funny Images Thread!
  • surge arresters

Footer

Microcontroller Tips

EE World Online Network

  • DesignFast
  • EE World Online
  • EDA Board Forums
  • Electro Tech Online Forums
  • Connector Tips
  • Analog IC Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • Wire and Cable Tips
  • 5G Technology World

Microcontroller Tips

  • Subscribe to our newsletter
  • Advertise with us
  • Contact us
  • About us
Follow us on Twitter Add us on Facebook Follow us on YouTube  Follow us on Instagram

Copyright © 2022 · WTWH Media LLC and its licensors. All rights reserved.
The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media.

Privacy Policy