Introduction
Have you ever wondered how the computer in your hand actually works?
“Build a Modern Computer from First Principles: Nand to Tetris Part 1” is a popular Coursera course that takes you on a deep dive into the fundamental building blocks of a computer. Forget pre-built components — this course starts from the absolute ground up, using first principles to break down complexity and show you how a computer works from the inside out.
Architecture of a modern computer
The Von-Neumann architecture is the fundamental design model for most modern computers. It was proposed by John von Neumann in 1945 and has remained the basis for computer architecture ever since.
The four main components of the Von-Neumann architecture are:
- Central processing unit (CPU): The brain of the computer, which executes instructions and performs calculations.
- Memory: Stores data and program code that the CPU can access.
- Input/output (I/O) devices: Allow the user to interact with the computer, such as a keyboard, mouse, monitor, and printer.
- Bus: A system of data pathways that connects the different components together.
The CPU fetches instructions and data from memory and executes them one by one. The instructions are written in machine language, which the CPU can directly understand.
The four main components of the Von-Neumann architecture are:
- Central processing unit (CPU): The brain of the computer, which executes instructions and performs calculations.
- Memory: Stores data and program code that the CPU can access.
- Input/output (I/O) devices: Allow the user to interact with the computer, such as a keyboard, mouse, monitor, and printer.
- Bus: A system of data pathways that connects the different components together.
The CPU fetches instructions and data from memory and executes them one by one. The instructions are written in machine language, which the CPU can directly understand.

Week 1: Fundamental Logtic Gates
You might already know that computers use just two digits: 0 and 1. But how do these simple bits perform complex tasks? The answer lies in logic gates!
Imagine combining these bits like building blocks. These logic gates, like the AND gate, take two bits as input and follow specific rules. The AND gate only outputs a 1 if both inputs are 1, acting like a digital “both-and” scenario.
This course dives into various gates like the AND, crucial for understanding the ALU (Arithmetic Logic Unit), covered later. However, there’s a special gate named NAND, the namesake of this course.
The NAND gate flips the AND gate’s logic. It outputs a 0 only when both inputs are 1, otherwise it’s a 1. Here’s the twist: every other logic gate can be built from NAND gates! This makes NAND the universal gate, the fundamental building block of computer logic.
In short, with just 0s, 1s, and the power of NAND gates, computers perform complex calculations and run the programs we use every day.
Imagine combining these bits like building blocks. These logic gates, like the AND gate, take two bits as input and follow specific rules. The AND gate only outputs a 1 if both inputs are 1, acting like a digital “both-and” scenario.
This course dives into various gates like the AND, crucial for understanding the ALU (Arithmetic Logic Unit), covered later. However, there’s a special gate named NAND, the namesake of this course.
The NAND gate flips the AND gate’s logic. It outputs a 0 only when both inputs are 1, otherwise it’s a 1. Here’s the twist: every other logic gate can be built from NAND gates! This makes NAND the universal gate, the fundamental building block of computer logic.
In short, with just 0s, 1s, and the power of NAND gates, computers perform complex calculations and run the programs we use every day.
Week 2: The ALU
Building on the logic gates from last week, this week tackles the ALU (Arithmetic Logic Unit). The ALU is the CPU’s workhorse, performing calculations and comparisons. It takes two binary inputs (16-bit in this course) and executes a predefined function (like addition) to generate an output. Imagine feeding the binary for 12 (00001100) and 8 (00001000), selecting “add” as the function, and the ALU spits out the binary for 20 (00010100)! The magic lies in how the ALU combines various logic gates to perform these operations efficiently.
Week 3: The RAM
This week dives into another core component: Random Access Memory (RAM). Unlike storage drives, RAM focuses on speed. It uses special Flip-Flop gates to hold data. These gates act like tiny switches with two settings (0 or 1) and two inputs. One input receives new data, while the other cleverly feeds the gate’s current output back to itself. This loop maintains the data until a new value arrives.
Another key concept introduced is the CPU clock. This clock synchronizes the flow of data between the CPU and RAM, ensuring information is accessed and stored at the right moments. By combining many Flip-Flops (16 in this course), we create a register capable of storing a single 16-bit value. Modern RAM boasts a vast array of these registers, each with a unique address for efficient data retrieval.
Another key concept introduced is the CPU clock. This clock synchronizes the flow of data between the CPU and RAM, ensuring information is accessed and stored at the right moments. By combining many Flip-Flops (16 in this course), we create a register capable of storing a single 16-bit value. Modern RAM boasts a vast array of these registers, each with a unique address for efficient data retrieval.
Week 4: The Machine Language
This week delves into machine language, the core language CPUs understand. You’ll explore how to work with registers, memory, and fundamental programming concepts like variables, loops, pointers, and I/O. This exploration sheds light on how modern programming languages interact with the CPU at a low level. It’s a true eye-opener, revealing the inner workings of computer programs and the essence of programming itself.
Week 5: Computer Architecture
This week’s goal was to create a complete computer system from the individual components you built in previous weeks. The course introduced the Von-Neumann Architecture, which defines the fundamental structure of most computers.
Leveraging the Von-Neumann Architecture and the fetch-decode-execute cycle, you built a functional computer called the Hack computer, designed by the course instructor. The Hack computer implements the core components of a computer system, including memory, CPU, and I/O.
Leveraging the Von-Neumann Architecture and the fetch-decode-execute cycle, you built a functional computer called the Hack computer, designed by the course instructor. The Hack computer implements the core components of a computer system, including memory, CPU, and I/O.
Week 6: Assembler
This week, unveil the secrets of assemblers! These programs act as translators, taking our human-readable assembly code (think text instructions) and transforming it into the raw machine code (0s and 1s) that the CPU understands. It’s like giving the CPU a set of clear instructions in its own language.
But here’s the exciting twist: you get to build your own assembler this week! It’s a challenging but rewarding experience. By crafting your own translation tool, you’ll gain a deeper understanding of how every program we use today is ultimately broken down and converted into a language the CPU can execute. It’s a fascinating glimpse into the inner workings of computers and the magic behind software!
But here’s the exciting twist: you get to build your own assembler this week! It’s a challenging but rewarding experience. By crafting your own translation tool, you’ll gain a deeper understanding of how every program we use today is ultimately broken down and converted into a language the CPU can execute. It’s a fascinating glimpse into the inner workings of computers and the magic behind software!
Conclusion
In a world overflowing with programming tutorials, Nand2Tetris stands out. It dives deep, revealing the hidden foundations of computing. We don’t just learn to code; we build a computer from the ground up, understanding why programming languages work the way they do. This journey through computer science fundamentals is an eye-opener for anyone who wants to truly grasp the magic behind computers.
Final words
I hope you enjoyed reading this article.
If you have any questions or remarks feel free to contact me.
Your Mario 💚
If you have any questions or remarks feel free to contact me.
Your Mario 💚