The Elements of Computing Systems
Building a Modern Computer from First Principles
By Noam Nisan and Shimon Schocken
TECS book cover The Elements of Computing Systems is an awesome introduction the how computers work. It starts with digital logic design and in 12 projects leads the student up through writing a compiler for a simple object oriented language.

All the course materials and the first half of the book are available on the course's web site:

Here are some articles I've written related to the book:

From NAND to DFF   Building a DFF using the TECS hardware simulator.

The Real World is a Hazardous Place   Using the TECS hardware simulator to investigate glitches.

Hack II — Escaping the Harvard Straitjacket   A follow-on project to the Hack Computer that adds a data path between the Data and Program Memories.

When More is Less   Signed Integer Overflow and the Nand2Tetris Division Algorithm.

Warp Speed, Mr. Sulu   A Math Coprocessor for the Hack Computer.