Difference Between Nand to Tetris Part I and Part II: Hardware vs. Software
Nand to Tetris Part I teaches you to build computer hardware from NAND gates up to a working CPU and RAM, while Part II focuses on constructing the software stack—including assembler, virtual machine, compiler, and OS—that runs on that hardware.
The ForrestKnight/open-source-cs repository lists both courses in its curated computer science curriculum at lines 41-42 of README.md. Understanding the difference between Nand to Tetris Part I and Part II helps learners plan their study path, as the two parts represent distinct phases of computer construction—moving from silicon-level digital logic to high-level software abstraction.
Core Differences in Scope and Focus
The primary distinction lies in what you physically construct during each course. Part I handles the physical hardware layer, while Part II builds the toolchain that makes that hardware programmable.
Part I: Hardware Construction from First Principles
Nand to Tetris Part I focuses exclusively on hardware construction. You begin with a single primitive—the NAND gate—and methodically build every digital component required for a functioning computer. The course guides you through creating logic gates, multiplexers, arithmetic logic units (ALUs), registers, memory units, and finally a complete CPU.
By the end of Part I, you have constructed the Hack computer: a fully functional 16-bit computer capable of executing binary machine code. According to the repository's curriculum notes, this portion requires approximately 5 hours per week over 6 weeks and demands only basic programming knowledge as a prerequisite.
Part II: Software Construction and Abstraction Layers
Nand to Tetris Part II shifts entirely to software construction and requires the hardware you built in Part I. This segment teaches you to build the complete toolchain needed to run high-level programs on your Hack computer.
Key components include:
- Assembler: Translates Hack assembly language into binary machine code
- VM Translator: Implements a stack-based virtual machine that bridges the gap between high-level code and assembly
- Compiler: Translates programs written in Jack (a simple Java-like high-level language) into VM code
- Operating System: Provides essential services including screen output, keyboard input, and memory management
Part II typically demands 10-15 hours per week over 6 weeks, reflecting the complexity of writing a full compiler and OS.
Prerequisites and Dependencies
The relationship between the two courses is strictly sequential. Part II requires Part I because you need a working Hack computer to execute the software you will write. The repository's curated list reflects this dependency, presenting Part I as the foundation for Part II.
While Part I accepts beginners with basic programming exposure, Part II assumes you understand the hardware architecture you previously built. This context is essential when implementing the VM translator or compiler, as you must understand how your software ultimately maps to the CPU and memory chips you constructed earlier.
Practical Examples of Coursework
The type of code you write in each part illustrates the fundamental difference in focus.
Hardware Implementation (Part I)
In Part I, you write Hardware Description Language (HDL) to define digital circuits. Starting from the NAND primitive, you construct increasingly complex components:
// NAND gate (the only primitive used)
module NAND (input a, input b, output out);
assign out = ~(a & b);
endmodule
// Building an OR gate from NANDs
module OR (input a, input b, output out);
wire na, nb;
NAND n1(.a(a), .b(a), .out(na)); // NOT a
NAND n2(.a(b), .b(b), .out(nb)); // NOT b
NAND n3(.a(na), .b(nb), .out(out)); // NAND of NOTs = OR
endmodule
These gate-level modules form the foundation of the Hack computer's CPU and memory systems.
Software Implementation (Part II)
Part II introduces multiple abstraction layers, beginning with Hack assembly language:
// Simple Hack assembly: compute 2+3 and store at RAM[0]
@2 // A-instruction: address 2 (value 2)
D=A
@3
D=D+A // D = 2 + 3
@0
M=D // RAM[0] = 5
You then progress to the Jack high-level language, which your custom compiler will translate:
// A minimal Jack program (high-level language)
class Main {
function void main() {
var int sum;
let sum = 2 + 3;
do Output.printInt(sum);
return;
}
}
The Jack program compiles into VM code, which translates to Hack machine language, finally executing on the hardware you built in Part I.
Summary
- Part I constructs the Hack computer hardware from NAND gates through the CPU and memory architecture.
- Part II builds the complete software stack (assembler, VM, compiler, OS) that runs on that hardware.
- Part II depends on Part I; you cannot complete the software construction without first having built the physical computer.
- Time commitment differs significantly: approximately 5 hours weekly for hardware versus 10-15 hours weekly for software construction.
Frequently Asked Questions
Can I take Nand to Tetris Part II without completing Part I?
No. Nand to Tetris Part II requires a working Hack computer, which is the final deliverable of Part I. The software you write in Part II—including the assembler, virtual machine, and compiler—must execute on the specific hardware architecture you construct during Part I. Without the CPU and memory chips you built, you have no platform to run or test your software.
How long does it take to complete both Nand to Tetris courses?
Completing both parts typically requires 12 weeks total, with Part I demanding approximately 5 hours per week and Part II requiring 10-15 hours per week. Part II's heavier workload reflects the complexity of compiler construction and operating system implementation.
What programming languages will I learn in Nand to Tetris?
You will work with Hardware Description Language (HDL) for circuit design in Part I, Hack assembly language in Part II, and Jack (a simple object-based language similar to Java) for high-level programming. Additionally, you will implement these tools using a mainstream language of your choice (commonly Python, Java, or JavaScript) to build the assembler, VM translator, and compiler.
Do I need physical hardware to complete Nand to Tetris?
No. Both courses use software simulators provided by the Nand to Tetris project. The Hardware Simulator allows you to test digital circuits without physical components, while the CPU Emulator and VM Emulator provide platforms for testing your software. While you could theoretically implement the Hack computer on an FPGA, the standard curriculum operates entirely within software simulations.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →