Logic Gates, the heart of a CPU in Computers | Explained Simply

In less than a century, computers have made a significant jump in performance, reliability, affordability and adoption! If we can attribute a single innovation for this, it would’ve been the invention of transistors. But a transistor is a simple electronic device. It can’t do much alone. But a few transistors can make up a Logic Gate! And all our computers depend on Logic Gates for most, if not all of the computation that it performs.

While Transistors did change the face of computing forever, I am giving Logic Gates all the credit for the revolution. It was brought by Integrated Circuits. Today, with top end photolithography techniques, we can have 10nm fabrication process, where each component can be as small as 10nm! If you start putting them one after another, 10 reps every second, it would take around 3 months 25 days and 18 hours to complete a distance of 1 meter!

But while ICs are great! You can’t really understand ICs, they are really just a fabrication process, the underlying technology of transistors and logic gates remain the same. Welcome to semiconductors!

How this part fits into the series?

Well, as you know that this is an ongoing series, Starts at Part 1 where I described about the principles of computing and described binary logic. All of that was an abstract concept, this part will tell you exactly how does the hardware calculates those concepts. How transistors combine to calculate 1+3=4. Previous parts are highly recommended as such!

Transistors: What is that?

Well, I would forgive you if you thought that transistors are old, and only used in radios. As it turns out, neither transistors, nor radios are any outdated. We just found better ways to use them than a transistor radio. Our cell phones, satellites, everything communicates over radios! And every one of them has billions of transistors.

A transistor is simply a small, active electronic component. It can act as a switch (on/off), or amplify a signal. Since transistors are notoriously simple (yet somehow people tend to think of them as very difficult), I can’t go on to explain them. I will link a few good quality videos and links on transistors if you want to know how a transistors work.

What are Logic Gates

Well, transistors are quite useful for switching and amplification, but if we want to do some calculations with transistors, we have to arrange them in complex patterns, and when we face complexity beyond comprehension, we do what we did best, we add a layer of abstraction. Logic Gates are simply an abstraction to make sense of complex circuitry that can calculate.

Basically, logic gates enables us to perform binary operations with transistors. We use Logic Gates to build almost all digital circuits, be it CPU, GPU, RAM, BIOS everything, all of them contains Logic Gates. As such, Logic Gates are a building block. One arrangement of logic gates can do calculations and another pattern acts as memory. As you can imagine, they are fun.

What does Logic Gates look like?

LOGIC GATE OR BUG?Logic gates look like bugs if you are to purchase them. but if you’re familiar with electronics, this is the standard SMD packaging of any electronics. And What Logic Gates actually look like is hard to show. Because, in microprocessors, you can’t see logic gates, you can just see transistors, a lot of them.

How to build logic gates

Schematic of a NAND Gate built from transistors

Before we talk about this circuit that shows the schematic of a NAND Gate, let’s talk about transistors, specifically NPN transistors, I can’t go in depth, but when we apply a small voltage across the BASE (the side where A and B connects) and Emitter (the side with an arrow), this allows the transistor to conduct (larger) current across Collector-Emitter.

This means, if we keep the terminal A to OFF, this means, no current can conduct across Collector-Emitter. And regardless of the state of B, electricity can’t flow through both of the transistors to reach the ground. Which means, electricity will flow through OUT and reach Ground.

I know it’s confusing to say that, so, I have made a video explaining logic gates from the ground up! Honestly, I don’t think it is possible to explain logic gates without video. I re wrote 26 times, everytime it ended up looking like textbook. So, this is what I think the best way to build gates ground up! I explained transistors, then I kept modifying that circuit to make an understanding!

You should have a look at the video to understand logic gates! Because I searched entire youtube and was unable to find a single video that taught how to build the circuit one by one. There are quite a few videos that explained how the complete circuits worked, but none that explained how do we build these. It’s not like someone had a dream and came up with this circuit, we added logical layers to build the circuit!

To see them in action follow the following links:

  1. Simple Transistor Explanation
  2. Simple Switch LED circuit (Transistor as a switch)
  3. NOT Gate
  4. AND Gate
  5. NAND Gate

Different types of Gates

In Part 1 of this series, Page 2, I have explained the  AND, OR and NOT gates in detail. So, here we will discuss the remaining of the popular Gates viz. NAND, NOR and XOR.

NAND (Negated AND)


This is one of the most common Logic gates, because it’s a UNIVERSAL GATE. Basically, using only NAND Gates, we can build all other gates. So, it is the most useful Gate. Denoted by a D with a nought, this is the mostly used circuit.

NOR (Negated OR)

LOGIC GATE NORNOR is also a UNIVERSAL GATE. And using NOR, we can also build all other gates. Note that, NAND and NOT symbols are just AND and OR symbols with a nought. It’s because by Negated AND and OR, we can have NAND and NOR

XOR (Exclusive LOGIC GATE for XOROR)

The Exclusive OR is a logic gate that’s very useful, but not universal. Here it’s called an EXCLUSIVE OR because, it’s an OR gate AND not an AND gate. So, when you turn both inputs to ON. It turns into a off. Which means, if we provide the same input to a NAND and OR gate, transfer their inputs through a AND gate, we have a XOR gate.


AND gateThis is a basic logic gate and it takes two inputs, and returns an output. The output is ON only if both its inputs are ON. Except the outputs are OFF.



Logic Gates - Symbol, Boolean Algebra and Truth Table ...This is also a basic logic gate and takes two inputs, returns one output. The output is ON if either of the two inputs are ON and returns OFF if both are OFF.



I think you have a clear idea on how NAND, AND and NOT works. But I don’t think you understand NOR, OR and XOR as deeply. So, I’ve made another video, continuing from the first part. Here, I have explained in detail, how the circuits work.

NOTE: Due to cold, I have made several mistakes while speaking. But nevertheless, here are the demos.

  1. NOR Gate
  2. OR Gate
  3. XOR Gate

That’s it for today! In the next parts, I will explain how computers use these gates do anything! From playing video games to type this post. These Logic gates do everything!

Recent Posts

Recent Comments




Be First to Comment

    Share your valuable feedback