The Benedict Year › The workshop

Project 2 · Weeks 10–12

The adders

Out of the gates you built, a chip that adds, and then the arithmetic logic unit, the part of the computer that calculates.

Beside Unit 4 · Making

In the course: Project 2, Boolean Arithmetic · slides and project notes at nand2tetris.org

The kind of answer

Made. Every chip is NAND gates given a shape. The maker arranges them, and the gates are still gates: the adder has nothing in it that the gates did not have, except the order you gave them. That is the unit’s rule in silicon.

On paper first

Count from 0 to 15 in binary on the fingers of one hand, a raised finger for 1. Then add two binary numbers on paper the long way, carrying as you do with ordinary numbers.

What you build

In the Hardware Simulator, choose Project 2 from the list at the top, then each chip in turn.

  • HalfAdder
  • FullAdder
  • Add16
  • Inc16
  • ALU

Each one is done when its test passes in the IDE. A pass cannot be argued with, and neither can a fail.

Week by week

About an afternoon a week. If a week runs long, let it: the strand keeps its own order, not the calendar’s.

WeekWatchDo
Week 102.1; 2.2Binary numbers and binary addition, on paper. Then the HalfAdder and the FullAdder.
Week 112.3; 2.4Negative numbers in binary, then Add16 and Inc16.
Week 122.5; 2.6The ALU. Fill in its table of six control bits on paper before you build it.

The lectures

6 lectures, about 66 minutes in all, by Nisan and Schocken. Watch with your parent, one or two at a sitting.

For the parent

HDL has no “if”. When the ALU must do one thing or another, a Mux chooses, so the ALU is mostly Muxes and the chips from last term. Drawing it large on graph paper, one box per part, helps more than staring at the editor.

Public domain I have dedicated this page to the public domain under CC0 1.0. Copy it, change it, translate it, print it and share it, for any purpose, without asking. Quotations from other writers keep their own terms.