# teaching machines

## CS 352 Lecture 15 – Hack Assembly

Dear students, Now that we have all the fundamental hardware components for our computer, let’s rise another layer of abstraction. We will discuss the machine code and assembly code, which are really just encodings of the inputs that will be fed to our hardware components. The Nand2Tetris computer has the following architecture: It supports three […]

## CS 352 Lecture 14 – Program Counter

Dear students, The next homework is due in a few days, and I want to revisit some HDL concepts in hopes to roust up any questions you have. In particular, the advanced chips can benefit from array slicing, which we haven’t talked about yet. We’ll start today with an example of a hardware component that […]

## CS 352 Lecture 12 – ALU

Dear students, Now that we have hardware components that can perform boolean logic and arithmetic, let’s package them all together into a one-stop shop called the arithmetic-logic unit (ALU). This component will perform exactly one of many possible operations. Which operation it performs will be determined by 6 control pins, and it will also accept […]

## CS 352 Lecture 11 – Subtracting

Dear students, We have built a large chunk of the core arithmetic and logic hardware inside a computer. We have built AND, OR, NOT, and other boolean gates. We have built an adder. We’ve also designed some components for selecting out bytes from RAM. Things are coming together! One thing that we are not able […]

## CS 352 Lecture 10 – Adders

Dear students, Learning is a cycle of exposing your inadequate understanding and then shoring it up. So, we start with a task to help you expose any misunderstandings: Write the truth table for a demultiplexer, which has two inputs (in and sel) and two outputs (a and b). (So there should be how many columns?) […]

## CS 352 Lecture 9 – Muxes, Demuxes, and HDL

Dear students, We introduce today a couple of hardware components that will ultimately help us build memory. They are the multiplexer (or mux) and the demultiplexer (or demux). The mux takes in two inputs and a selector. The selector determines which of the two inputs feeds into the one output: if sel == 0 output […]

See the PDF.

## CS 352 Lecture 8 – 7-Segment Logic

Dear students, Today we’re round out our understanding of Karnaugh maps in the ultimate test. We’re going to design the logic to drive a 7-segment display! What is that, you ask? A 7-segment display is one of these: Image courtesy Peter Halasz. It’s called “7-segment” because it’s decomposed into seven independent LEDs, each identified by […]

## CS 352 Lecture 7 – Karnaugh Maps

Dear students, We start today with a couple more exercises on building circuit diagrams. Let’s do these one a time. Write your diagram down on paper, and then we’ll construct it together up front: Diagram This #1 You will eat a cheap pizza if it has pepperoni without olives, or if it has olives with […]

## CS 352 Lecture 6 – Transistors and Diagrams

Dear students, Today we close out our discussion of the low-level electronic circuitry and begin our ascent to higher levels of abstraction. We start by replacing relays with transistors. The problem with relays is that they tend to be slower to activate, harder to miniaturize, and have a shorter life span than other electronic switching […]