Project solutions for the Nand to Tetris course.
The best way to understand how a computer works is to built one from scratch. And that is exactly what Nand to Tetris course does.
This repository contains my Nand to Tetris project solutions. The course is comprised of two parts, hardware and software. this parts:
- Project 1: Boolean Logic
- Project 2: Boolean Arithmetic
- Project 3: Sequential Logic
- Project 4: Machine Language
- Project 5: Computer Architecture
- Project 6: Assembler
- Project 7: VM I: Stack Arithmetic
-
Chapter 1: Boolean Logic. Beginning at the Nand level, we specify and build a set of elementary logic gates, multiplexors, and their multi-bit versions. In addition, we describe how chips can be built and tested using a simple version of HDL (Hardware Description Language) and the supplied Hardware Simulator.
-
Chapter 2: Boolean Arithmetic. Continuing with combinational logic, we specify and build a set of adders. half-adder, full-adder, and parallel adder. Next, we specify an Arithmetic Logic Unit (ALU) and describe its proposed implementation.
-
Chapter 3: Sequential Logic. Beginning with D-Flip-Flops, we build a ecursive hierarchy of memory systems: 1-bit register, multi-bit register, and a Random Access Memory (RAM). We also build a counter chip, which will later function as the computer's program counter.
-
Chapter 4: Computer Architecture. We specify a simple machine language, giving both its binary and symbolic instruction sets. Next, we guide the students through the process of integrating all the previously built chips into a unified architecture, capable of executing programs written in the specified language. We also specify how the architecture interacts with memory-mapped screen and keyboard devices. This completes the construction of the hardware platform.
-
Chapter 5: Assembler. Following an overview of the machine and assembly languages presented in the previous chapter, we specify an assembler. We expect the students to implement this assembler (as well as all the subsequent translators) in Java, but other object-oriented languages can also be used.
-
Chapters 6-7: Virtual Machine. We discuss the virtues of a virtual machine approach, and specify a stack-based VM. Next, we guide the students through the process of writing a VM implementation, which will later serve as the backend of the compiler. Chapter 6 focuses on stack arithmetic, and chapter 7 on the procedure call stack.
The course is based upon The Elements of Computing Systems by Noam Nisan and Shimon Schocken. Also the official course website contains all the project materials and software tools needed.