Close Menu
VLSI Web
  • Home
    • About Us
    • Contact Us
    • Privacy Policy
  • Digital Design
    • Digital Circuits
    • Verilog
    • VHDL
    • System Verilog
    • UVM
  • VLSI Roles
    • RTL Design
    • Design Verification
    • Physical Design
    • DFT
    • STA
  • Interviews
  • Informative
  • VLSI Forge
Instagram LinkedIn WhatsApp Telegram
Instagram LinkedIn WhatsApp Telegram
VLSI Web
  • Home
    • About Us
    • Contact Us
    • Privacy Policy
  • Digital Design
    • Digital Circuits
    • Verilog
    • VHDL
    • System Verilog
    • UVM
  • VLSI Roles
    • RTL Design
    • Design Verification
    • Physical Design
    • DFT
    • STA
  • Interviews
  • Informative
  • VLSI Forge
VLSI Web
Digital Circuits

Logic Gates Explained: Basic, Derived and Universal Gates

Raju GorlaBy Raju Gorla20 August 2026Updated:11 October 2026No Comments3 Mins Read
Logic gates: basic and universal
Share
Facebook Twitter LinkedIn Email Telegram WhatsApp

The short answer: logic gates are the building blocks of digital circuits. The basic gates are AND, OR and NOT; the derived gates are NAND, NOR, XOR and XNOR. NAND and NOR are called universal gates because any logic function can be built using only one of them, which is one reason CMOS standard-cell libraries rely so heavily on them.

This post combines my older posts on basic gates, universal gates and realising functions with gates. Here is everything you need, in one place.

  1. Truth tables for every gate
  2. What each gate is good for
  3. Why NAND and NOR are universal
  4. Realising a function with gates
  5. Gates in Verilog

Table of Contents

  • Part 1: Truth tables for every gate
  • Part 2: What each gate is good for
  • Part 3: Why NAND and NOR are universal
  • Part 4: Realising a function with gates
  • Part 5: Gates in Verilog
  • FAQ
    • Why are NAND and NOR called universal gates?
    • Is XOR a basic gate?
    • Which gate is fastest in CMOS?
    • How many NAND gates make an XOR?

Part 1: Truth tables for every gate

A B AND OR NAND NOR XOR XNOR
0 0 0 0 1 1 0 1
0 1 0 1 1 0 1 0
1 0 0 1 1 0 1 0
1 1 1 1 0 0 0 1

NOT simply inverts its single input: 0 becomes 1 and 1 becomes 0.

Part 2: What each gate is good for

  • AND: “all conditions true”, for example enabling a write only when valid and ready are both high.
  • OR: “any condition true”, for example combining interrupt sources.
  • XOR: “inputs differ”. Used in adders, parity and comparators.
  • XNOR: “inputs equal”. Used in equality comparators.
  • NAND and NOR: the natural gates in CMOS, and universal.

Part 3: Why NAND and NOR are universal

Building NOT, AND and OR gates from NAND gates
With NOT, AND and OR available, any function can be built.

Because NOT, AND and OR can each be made from NAND gates alone, any Boolean function can be too. The same is true of NOR, by duality. In CMOS, a NAND or NOR gate needs fewer transistors than an AND or OR (which is just a NAND or NOR plus an inverter), so they are the most efficient building blocks.

Part 4: Realising a function with gates

To build F = A·B + C·D: in AND-OR form you need two AND gates and an OR gate. Using De Morgan, the same function is a two-level NAND-NAND circuit: NAND each product term, then NAND the results. F = ((A·B)’ · (C·D)’)’. This NAND-NAND form is how sum-of-products logic is often implemented in CMOS.

Part 5: Gates in Verilog

// Continuous assignments: the usual way to describe gates
assign y_and  = a & b;
assign y_or   = a | b;
assign y_not  = ~a;
assign y_nand = ~(a & b);
assign y_nor  = ~(a | b);
assign y_xor  = a ^ b;
assign y_xnor = ~(a ^ b);

In real designs you write the logic and let synthesis choose the gates from the standard-cell library.

Practise this on VLSI Forge

I built VLSI Forge so you can write RTL in your browser, run it on a real simulator and check every signal in the waveform. Free, nothing to install.

Digital logic problems

FAQ

Why are NAND and NOR called universal gates?

Because any logic function, including NOT, AND and OR, can be built using only NAND gates, or only NOR gates.

Is XOR a basic gate?

It is usually called a derived gate, since it can be built from AND, OR and NOT, but it is so useful that every library includes it.

Which gate is fastest in CMOS?

Simple inverting gates like NAND, NOR and the inverter, because they need only one stage of transistors.

How many NAND gates make an XOR?

Four.

Share. Facebook Twitter LinkedIn Email Telegram WhatsApp
Previous ArticleKarnaugh Maps and Logic Minimisation: A Step-by-Step Guide
Next Article CMOS Logic Gates and Logic Families Explained
Raju Gorla
  • Website

Related Posts

Digital Circuits

Registers and Shift Registers: SISO, SIPO, PISO and PIPO

3 September 2026
Digital Circuits

Counters and Clock Dividers in Verilog

2 September 2026
Digital Circuits

Mealy vs Moore State Machines: Differences, Examples and Verilog

1 September 2026
Add A Comment
Leave A Reply Cancel Reply

Topics
  • Digital Circuits
  • Informative
  • Interview Questions
  • Physical Design
  • RTL Design
  • STA
  • System Verilog
  • UVM
  • Verilog
Instagram LinkedIn WhatsApp Telegram
  • About
  • Contact
  • Privacy Policy
  • VLSI Forge
  • Courses
  • Feedback
© 2026 VLSI Web

Type above and press Enter to search. Press Esc to cancel.