From Nand to Tetris in 12 steps
Google Tech Talks
October 10, 2007
We describe a new approach and a course that aims to demystify the integrated function of computer systems, using a hands-on approach. The course presents many abstractions, algorithms, and data structures learned in CS courses, and makes them concrete by building a complete computer system from the ground up. In particular, we guide the students through a modular series of projects that gradually construct and unit-test a simple hardware platform and a modern software hierarchy, yielding a surprisingly powerful computer system.
The hardware projects are done in a simple hardware description language and a hardware simulator supplied by us. The software projects (assembler, VM, and a compiler for a simple object-based language) can be done in any language, using the APIs and test programs supplied by us. We also build a mini-OS. The result is a GameBoy-like computer, simulated on the student's PC. We start the course (and this talk) by demonstrating some video games running on this computer, e.g. Tetris and Pong.
Building a working computer from Nand gates alone is a thrilling intellectual exercise. It demonstrates the supreme power of recursive ascent, and teaches the students that building computer systems is -- more than anything else -- a triumph of human reasoning. We are able to squeeze all this into a single course since we deal with neither efficiency nor advanced features, leaving these subjects to other courses in the program. The resulting approach is completely self-contained, requiring only programming as a pre-requisite. Hence, courses based on the approach can be given at almost any stage in a CS program.