Sampath Balivada
Sampath Balivada

Sampath Balivada

Logic Gates - Nand2Tetris

Logic Gates - Nand2Tetris

Quite frankly, the basis of technology existence.

Sampath Balivada's photo
Sampath Balivada

Published on Oct 18, 2021

2 min read

Some of the quotes and information are part of the Nand2Tetris course available on Coursera.

So chips or what we refer to as CPUs are created as a combination of gates. Usually in billions. These gates are transistors that are etched in silicon. So, someone drew billions of transistors on a piece of metalloid (silicon) and now you are able to read this article on your device. Dammit... that's probably the most complex thing ever existed in the entire known history of humankind and the fact is that it is built on simple mathematical logic. This mathematical logic is combined and formulated as logic gates.

What is a logic gate then?

For starters, a logic gate is like a black box, that takes single or multiple inputs and produces a single output. So, if we were to imagine that in a real-world scenario, think of it like a cardboard box with copper wires going in and one wire coming out. We let electricity flow to different input wires and depending on which input wires have electricity flowing through them, something happens inside and we get electricity through the output wire or we don't.

Now, there are different types of logic gates like AND, OR, XOR, NAND, etc. Often in computer science, we say that computers are built using just one logic gate, i.e. NAND gate. This is because we can create any gate with a combination of NAND gates. We can basically chain one box's output to another box's input.

Do we really use only NAND gates in a CPU?

For a virtual computer, this can be okay but for an actual chip, it's not the most ideal way to go. For a real-world CPU, we can build a chip using different types of gates based on the different types of workloads that we run on the chip. Using multiple gates to create a new gate is not always the best way as less number of gates directly relates to speed.

So how are chips designed in real life?

Prototyping and testing chips practically in a lab is a costly affair. Fabrication is hard and very very costly. And if somehow we end up missing out on that one gate, it's more than impossible to repair something at the scale of nanometers. So we use VHSIC Hardware Description Language (VHDL or simply called HDL)

The above is my understanding of the hardware inside a computer from the perspective of a computer scientist and not a substitute for the actual learnings of a chip designer.

Share this