CS 350: Computer Organization & Assembly Language Programming

Staff

Instructor: Kyle C. Hale
  Office Hours: M 4:30-6:00PM; Th 9:30-11:00AM, or by appointment. (SB 229C)
  E-mail: khale [at] cs [dot] iit [dot] edu

TAs:

Chaoqi Ma
  Office Hours: M 12:00 - 1:00PM (SB 004)
  E-mail: cma17 [at] hawk [dot] iit [dot] edu

Zachary Mckee (L01)
  Office Hours: T 1:00 - 2:00PM (SB 108)
  E-mail: zmckee [at] hawk [dot] iit [dot] edu

Philip Sijimon (L01)
  Office Hours: T 2:00 - 3:00PM (SB 108)
  E-mail: psijimon [at] hawk [dot] iit [dot] edu

Syed Rizvi (L02)
  Office Hours: W 11:30AM - 12:30PM (SB 108)
  E-mail: srizvi13 [at] hawk [dot] iit [dot] edu

Samuel Furr (L03)
  Office Hours: F 2:10 - 3:10PM (SB 108)
  E-mail: sfurr [at] hawk [dot] iit [dot] edu

Nathan Jones (L03)
  Office Hours: F 4:05 - 5:05PM(SB 108)
  E-mail: njones10 [at] hawk [dot] iit [dot] edu

Course Info

Course number: CS 350

Semester: Spring 2018

Lecture Time: Mod/Wed 3:15PM - 4:30PM

Lecture Location:Siegel Hall 118

Lab 01 Time: Fri 3:15PM - 4:05PM

Lab 01 Location: SB 108

Lab 02 Time: Fri 3:15PM - 4:05PM

Lab 02 Location: SB 112E

Lab 03 Time: Fri 3:15PM - 4:05PM

Lab 03 Location: SB 112F

Overview

This course will be your entry into the world of computer systems. This is where you will begin to see the "nuts and bolts" of computers—how they're designed, how they're implemented, how they're programmed at the lowest levels, and how the whole system fits together. As such, this is a "bottom-up" course. By the end, when you write your high-level programs, whether they're in C, Python, Ruby, Node.js, or brainfuck, you should be able to reason about how the code you write turns into low-level operations on the hardware. You will be able to cut through levels of abstraction to gain a deeper understanding of how computer systems work. After finishing this course, you will no longer take for granted the mesmerizing array of languages and tools that "just work." The path will be open for you to become a practitioner of the dark arts of systems programming who shuns Clarke's third law and who, when in need of a Linux machine, writes it in C.

Note that CS 350 is a required core course for both the CS and CIS undergraduate curriculums

Communication

Please do not hesitate to interact with the instructor, the TAs, and your classmates. Do not wait until the last minute to come see your instructor! We will be primarily using Piazza as a course communication mechanism. If you have an issue or question that is not strictly private (especially one you think would benefit everyone were it answered), please use Piazza as your first resource. The instructors, the TAs, and your fellow classmates will be there to help. Note that you can also post anonymously if you so choose.

Lecture Schedule

Week Date Item Topic Notes Reading
1 Mon 1/8 Lec 1 Intro, logistics, abstraction No labs 1st week of class
Lec 1 Notes
Lec 1 Slides
Optional reading: As We May Think - Vannevar Bush
Optional reading: Feynman Chs. 1/2
1 Wed 1/10 Lec 2 Digital representations I Optional reading: Annotated Turing (good book in general for intro to Turing Machines)
2 Mon 1/15 holiday MLK Day
2 Wed 1/17 Lec 3 Digital representations II Lec 2 notes Optional reading: It from Bit
3 Mon 1/22 Lec 4 Intro to C Programmming
3 Wed 1/24 Lec 5 Boolean algebra & logic design
4 Mon 1/29 Lec 6 Floating point; more logic
4 Wed 1/31 Lec 7 Combinational Logic
5 Mon 2/5 Lec 8 Sequential Logic & Storage Elements
5 Wed 2/7 Lec 9 Memory, Sequential Circuits, Flip Flops
6 Mon 2/12 Quiz 1 (See Tests)
6 Wed 2/14 Lec 10 State Machines & the Von Neumann Architecture
7 Mon 2/19 Lec 11 von Neumann Architecture, the instruction cycle
7 Wed 2/21 Lec 12 The Simple Decimal Computer
8 Mon 2/26 Lec 13 LC-3 Intro, LC-3 datapath, LC-3 control, instr. execution Required reading: Patt & Patel Ch. 5
8 Wed 2/28 Lec 14 LC-3 operations & Control
9 Mon 3/5 Lec 15 LC-3 ISA, assembly
9 Wed 3/7 Exam 1 (See Tests)
10 Mon 3/12 holiday Spring Break (No classes)
10 Wed 3/14 holiday Spring Break (No classes)
10 Fri 3/16 holiday Spring Break (No classes)
11 Mon 3/19 Lec 16 Assembly language & assemblers Required Reading:Patt & Patel Ch. 7
11 Wed 3/21 Lec 17 Traps, subroutines, linkage
12 Mon 3/26 Lec 18 The runtime stack, C execution model Optional reading: The stack
12 Wed 3/28 Lec 19 Dynamic memory, C execution model
13 Mon 4/2 Lec 20 Linking & loading, Libraries, Buffer Overflows
13 Wed 4/4 Quiz 2
13 Wed 4/6 Lec 21 Intro to I/O
14 Mon 4/9 Lec 22 I/O programming Required Reading: Patt & Patel Ch. 8
14 Wed 4/11 Lec 23 Computer Architecture I (Memory system) Required Reading: Hennessy & Patterson 7.1-7.2
15 Mon 4/16 Lec 24 Computer Architecture II
15 Wed 4/18 Lec 25 Computer Architecture III
16 Mon 4/23 Lec 26 TBD
16 Wed 4/25 Exam 2 (See Tests)

Exam Schedule

Week Date Item Length Covers File Date Note
6 Mon 2/12 Quiz 1 30 min Lec 1-7, Lab 0-2
9 Wed 3/7 Exam 1 75 min Apx 35% on Q1 material, 65% on Lec 8-14, Labs 3-6
13 Wed 4/4 Quiz 2 30 min Lec 13-19, Lab 7-8
16 Wed 4/25 Exam 2 75 min Apx 25% on Q2 material, 75% on Lec 19-end, Lab 9-end

Labs & Project

Lab Covers Lec Due Date Handout Notes (TBP = To Be Posted)
0 --- None Lab 0 Posted 1/9

Books

There are no required textbooks for this course. This means it is absolutely essential that you attend class, participate in discussions, and come to office hours. I am, however, recommending the following textbook for this course, as it is where the project will come from:

Introduction to Computing Systems: From Bits & Gates to C & Beyond (2nd Edition), by Yale Patt and Sanjay Patel, 2004 McGraw-Hill. The text's Student Resources website contains links to the LC-3 Simulator and lab manual.

A classic book on introductory computer architecture. If you'd like to learn more about processor architecture, and would like to learn how to design your own control and datapaths (this book uses MIPS), this is a great resource:

Computer Organization and Design (5th Edition), by David Patterson and John Hennessy, 2013 Morgan Kauffmann.

A good book dedicated to logic design, which we cover in the first half of this course.

Fundamentals of Logic Design (7th Edition) by Charles Roth and Larry Kinney, 2013 CL Engineering.

This is also a useful book to have on your shelf. It is a bit newer. It does not go into quite as much detail, but does guide you through building your own virtual computer:

The Elements of Computing Systems: Building a Modern Computer from First Principles (1st Edition), by Noam Nisan and Shimon Schocken, 2005 MIT Press.

This course takes a "bottom-up" approach to programming, in that we start from the principles of digital logic design and computer organization. You'll soon be taking CS 351, which is closely related and complementary to this course. If you want to get ahead, you should consider purchasing this book (you'll need it anyway) and skimming. There is a good deal of overlap, but from a slightly different perspective:

Computer Systems: A Programmer's Perspective (3rd Edition), by Randal Bryant and David O'Hallaron, 2015 Pearson.

Learning C

For this class, though our programs will be written in C on Linux, this is not a class on how to program in C on Linux. We'll spend some time in class looking at pointers and structures, but we won't cover all of the C and Linux you need for the course. You'll need to learn the rest on your own (or with other students (see Working Together on Labs below). If you are considering specializing in computer systems, e.g. computer architecture, operating systems, networking, and distributed systems, you'll find that a mastery of the C language is absolutely essential.

Here is a good interactive, online reference for learning C. If you can make it through this tutorial, you will likely be fine with C in this course. Here is a quick reference card for C syntax and common functionality.

The following book is one you will find on the shelf of any good systems programmer. It is the definitive reference for the original ANSI C language, written by its designers. While we will be mostly using the updated C99 specification of the language, it is still an excellent book to own:

The C Programming Language (2nd Edition), by Brian Kernighan and Dennis Ritchie, 1988 Prentice Hall.

Here is another decent book for learning C with a more practical bent. It is aimed towards people intending to build real, resilient systems with the C language:

Learn C the Hard Way: Practical Exercises on the Computational Subjects You Keep Avoiding (Like C) (1st Edition), by Zed Shaw, 2015 Addison-Wesley Professional.

Of course, the best way to learn a programming language is to see examples from master programmers. In this light, we will be looking at some examples from one of the most widely used and successful open-source codebases in existence, the Linux kernel. We will be looking at C design patterns used there, possibly including more advanced uses like object-oriented design patterns in C.

Learning the UNIX Environment

At this point, you are probably still used to using a Mac or a Windows system. In the CS world however, if you want to have any hope of being productive, you absolutely must learn to work in a UNIX-like environment (e.g. Linux, FreeBSD). I encourage you to use a desktop hypervisor (such as Parallels, VMware, or VirtualBox ), download a Linux distribution of your choice (Ubuntu, Mint, Debian, Fedora, OpenSUSE, and Arch are good choices), and boot it as a VM to get the lay of the land.

Probably the most useful skill you'll need to acquire is navigation at the UNIX command shell. Here is a good tutorial for that. Here is a nice reference that will allow you to look up commands that you encounter but do not know.

Here is a nice overview of UNIX programming, especially the design philosophies and common themes.

Here is a good book on programming in the UNIX environment, from the lowest levels:

Programming from the Ground Up by Jonathan Bartlett, 2016 CreateSpace Independent Publishing.

For more advanced shell usage and Linux system administration:

Linux Server Hacks: 100 Industrial-Strength Tips and Tools, by Rob Flickenger, 2003 O'Reilly Media.

Development Environment

You will be mostly writing C and assembly in this course. You are free to write it any way you like. You must, however, make sure it compiles and runs correctly on the course server, described below. You'll want to make sure that your compiler (gcc) is roughly the same version as that on the course server, otherwise you can expect strange differences. If you want to play it safe, just write your code on the course server.

Course Server

We'll be using the server named fourier.cs.iit.edu. If you have registered for the course already, you should already have received an e-mail notifying you of your account creation. If this is not the case, you need to let me know ASAP!

The first lab will have details on getting on the machine to do your work. If you want to get started early, you'll first want to use a terminal emulator. If you're on a Mac, you can just use the Terminal application (or iTerm2, which has some bells and whistles). If you're on Windows machine, you'll want to use Cygwin, which emulates a UNIX-like environment. If you're using a Linux distro, you probably don't even need to be reading this section.

From your terminal, you can log in to the course server this way:


$> ssh your-id@fourier.cs.iit.edu

Note that the $> above simply indicates that you are sitting at a terminal (it represents the prompt). You will probably see something different, depending on which machine and which shell you're using. For example, you might see a prompt like:

[kyle@localhost]$ 

The command you enter actually starts with the ssh component.

If you are not familiar with navigating in a command-line environment, now is the time. The sooner you wean yourself off a GUI-based point-and-click environment, the better off you'll be moving forward in your systems classes. See the Linux section for some pointers on how to get started.

Other Useful Links and Resources

This is a list of other resources that you might find useful for this class and for doing work in the systems area in general. Feel free to peruse them at your own convenience.

Books

These books are not all technical, but are broadly applicaable to computer systems, science, engineering, and programming.

Programming Pearls (2nd Edition) by Jon Bentley, 1999 Addison-Wesley. A good reference for design patterns and common idioms used in C and C++ programming.
CMOS VLSI Design: A Circuits and Systems Perspective (4th Edition), by Neil Weste and David Harris, 2010 Pearson. Probably the best textbook out there on VLSI design. You might find yourself curious about how all this stuff gets implemented on a silicon die. You won't encounter a course covering these topics in our department, however. You'll have to take an ECE course. However, this book gives a fairly gentle introduction to integrated circuit design for those dedicated enough for self study.
Feynman Lectures on Computation by Richard P. Feynman, 2000 Westview Press. A wonderful series of lectures given by the famous and brillian theoretical physicist. An unusual perspective on computing systems and computation in general. Highly recommended.
Racing the Beam: The Atari Video Computer System (Platform Studies), by Nick Montfort, 2009 MIT Press. A great book about the Atari console and the technical acheivements that made it possible. If you're interested in the intersection of computer systems and game programming, this is a book for you.
The Supermen: The Story of Seymour Cray and the Technical Wizards Behind the Supercomputer, by Charles J. Murray, 1997 Wiley. An engaging narrative about the development of the first supercomputers, from the Army Research Lab's code-breaking machines of WWII to the CDC6600 and the blazing machines from Seymour Cray. If you're interested in the history of computer science and engineering, this is a nice quick read.

Links