From Nand to Tetris (CS492B)

Fall Semester 2017

Do you really understand how a computer works? After taking this course, you definitely will, because you will build a computer yourself—starting with nothing but individual logic gates, and ending with a fully functional computer that we can program in a high-level language.

Don't worry—you need no VLSI skills and no soldering iron. We will simulate the hardware that we build using a simple hardware description language. It is easy to learn, and you'll be surprised how quickly you'll build a fully functional CPU (and, hopefully, how much fun it is to do so completely from the ground up).

We will need to cover some topics from computer architecture and compilers. You do not need to have taken any of these courses—we will cover everything we need.

Prerequisite: You must know how to program and you should have taken CS206 (Data structures).

Course information

Lecturer:
Otfried Cheong Office: E3-1 3434, Phone: 3542.
Lectures

The class meets Wednesday from 16:00 to 17:15 and on Friday from 13:00 to 14:15 in classroom #1 (room 1101) in building E3-1. Lectures are given in English.

Grading policy

Students must submit all projects.

The final grade will then be composed as follows (small changes reserved):

  • Projects (30%), Midterm (30%), Final (30%), Participation (10%).

Since the course is taken by students ranging from second year undergraduates all the way to Ph.D. students, we will ensure fairness as follows:

  • Extra projects for graduate students;
  • Separate exams for graduate students;
  • Separate grading for undergraduates and graduate students.
Participation

Attendance will be taken in nearly every class. If you miss at most 4 lectures, you receive 10 attendance points. For 5 missed lectures, you receive 9 attendance points, and so on. For 14 or more missed lectures you receive no attendance points.

Going to a conference, workshop, doctor, interview, is no excuse for missing the class — you can use the four free missed classes for this.

Exams

There will be a midterm and a final exam:

The midterm exam is on October 25 from 16:00 to 18:00 in our usual classroom.

The final exam is on November 24 from 13:00 to 14:25 in our usual classroom.

Syllabus

Here is a rough list of what we will cover in each week of the semester.

Week 1 Introduction
Week 2 Combinational logic
Week 3 Sequential logic
Week 4 Machine language
Week 5 Computer architecture
Week 6 Assembler
Week 7 Virtual machine I
Week 8 Midterm exam
Week 9 Virtual machine II
Week 10 High level language
Week 11 Compiler I
Week 12 Compiler II
Week 13 Operating System I
Week 14 Operating System II
Week 15 Review
Week 16 Final Exam

Piazza

This term we will be using Piazza for class announcements, discussion, and asking questions.

Here is our Piazza class page.

You are responsible for checking the announcements on our Piazza class page regularly (if you make a Piazza account and enroll for the course, announcements will be mailed to you automatically.)

If you do not understand something, it is important that you ask questions. Piazza allows you to ask questions and get answers from the instructor, the teaching assistants, and your classmates. You can ask questions anonymously, so don't be shy and ask!

Both Korean and English are acceptable on Piazza :-). You make it easier for me if you write in English, but if the TAs can answer your question, then Korean is just fine.

To ask questions, you need to register on Piazza and enroll as a student. To do so, go to the enrollment page. Select "Join as student". You will then need to use your KAIST email address (ending with @kaist.ac.kr) to create an account.

Textbook and support site

We follow the book The Elements of Computing Systems by Nisan and Schocken (MIT Press, 2005).

The book comes with a web site, which contains PDF files of the first six chapters and all the software we need to go through the projects.

Course progress

The material covered in the lectures so far:

Date Topic Slides Code
08-30 Introduction, Boolean functions, circuits and gates introduction code
09-01 More circuits and gates code
09-06 Number representation and adders
09-08 Latches, Flip-Flops, the clock and sequential circuits
09-13 Realistic memory, machine language real memory
09-15 Computer architecture
No class (business trip)
09-27 Review homework #5 & #6, CPU Emulator
09-29 Assembler programming
Chuseok week
10-11 Finishing our computer, Subroutines, Stack pointer
10-13 Comparing with Atmel atmega8 atmega8 data sheet, instruction set
Midterm week: No class, no exam
10-25 Midterm exam: 16:00–18:00
10-27 Midterm review
11-01 No class (business trip)
11-03 The virtual machine slides
11-08 The Jack language
11-10 Lexical analysis and parsing code
11-15 Hardware multiplication review, compiling Jack to VM code
11-17 Translating VM to Hack I slides
11-22 Translating VM to Hack II
11-24 Final exam: 13:00–14:25
11-29 No class (business trip)
12-01 The standard library
12-06 No class (KAIST interviews)
12-08 No class (business trip)

Projects

There will be many projects in this course, where you build a small part of your computer, or program some part of its software. You will have between one and three weeks to complete each project. All programming projects are submitted using the submission server. The deadline is at midnight on the evening of the deadline day.