This course ended
on December 7, 2022

CPSC 220: Computer Architecture

      Department of Mathematics and Computer Science
      Hobart and William Smith Colleges

      Fall, 2022.

      Instructor:  David J. Eck  (

      Course Handout:
      Monday, Wednesday, Friday, 12:10–1:10, Stern 203.
      Lab: Thursday, 11:50–1:20, Rosenberg 009.
      Regular Office Hours, Lansing 313:  Monday, Wednesday, and Thursday 1:30 to 3:00.
      Usually Available:  Tuesday, 1:00 to 3:30 and in the hour before class and lab.
Labs and Assignments
Lab 1, August 25
Numbers and Bits

Sample solution
Lab 2, September 1
Larc Programming 1

Sample solutions
Lab 3, September 8
Larc Programming 2

Sample solutions
Lab 4, September 15
Combinational Circuits

Sample solution
Lab 5, September 22
Memory Circuits

Sample solution
Lab 6, September 29
Computational Circuits

Sample solution
Lab 7, October 6
Larc in Logisim 1
Lab 8, October 13
Larc in Logisim 2

Sample solution
Lab 9, October 20
Intro to yasm and ddd

Sample solution
Lab 10, October 27
x86-64: Control Structures

Sample solution
Lab 11, November 3
x86-64: Functions

Sample solution
Lab 12, November 10
x86-64: Files and Floats

Sample solution
Labs 13 and 14, November 17 and December 1: Life

Sample solution (basic one-person version)
Full solution (with menu, files, and extra credit)

Final Exam: December 6

The final exam for this course will be given during the exam period scheduled by the Registrar: Tuesday, December 6 at 7:00 PM. The study guide is available:

Final Exam Information

Fifteenth Week: November 27 and 29; December 2

Welcome to the last week of the semester! On Monday and Wednesday, I will discuss CPU pipelining. Friday will be review for the final exam. Please bring questions!

Once again, Wikipedia pages can be consulted for information about pipelining in general, instruction pipelining, and the "classic RISC pipeline". And here is an article on Pipeline hazzards. (These articles tend to be more technical than our discussion will be.)

Fourteenth Week: November 21

Because of Thanksgiving break, we only have class on Monday this week. (Happy Thanksgiving!)

We started covering virtual memory last week. We will continue that topic on Monday. You might want to look at the Wikipedia page on virtual memory. I am using the term virtual memory to refer to two things: providing each application with its own virtual address space, and potentially swapping out pages to disk to provide extra storage for data that doesn't fit in main memory. (You will often see the term used for one of these but not the other, and sometimes for both combined, which can be confusing.)

(You might also check out core memory on Widipedia, since it came up in class — and note the cost of about one dollar per bit.)

Thirteenth Week: November 14, 16, and 18

We are ready to move on from x86-64 assembly language programming. For the remainder of the semester, we will look at some of the more advanced aspects of computer architecture, without going into a great deal of depth. We will start this week with multiprocessing and interrupts. Jorgensen has a brief overview of those topics in Chapters 19 and 20. I will do more about multiprocessing and less about interrupts than the textbook. It is possible that we will start on the next topic, virtual memory and memory protection, by the end of the week.

Lab 11 is due by 3:00 on Monday, and Lab 12 is due on Thursday. (I won't actually look for Lab 12 until Friday afternoon.) There is just one more lab, which you can work on for the last two lab periods of the semester. It will be due on the last day of classes.

Twelfth Week: November 7, 9, and 11

Here is the web page from Friday's class: November 11

There is a test in class on Wednesday, November 9. Here is the info:

Study guide for the second test

Aside from the test, we will finish our study of x86-64 assembly. In the end, we will do almost nothing with syscalls, relying on C standard functions instead. Last Friday, we already looked briefly at floating point instructions in x86-64 assembly. We will finish that topic and do some examples. Floating point instructions are covered in Chapter 18 of Jorgensen.

Because of the test, and because it's a longer lab than usual, Last week's lab, Lab 11 will be due next Monday, November 14, instead of Friday, November 11, as originally scheduled.

Here's the sample x86-64 assembly program that uses floating point instructions:


And here's the example that uses files:


Eleventh Week: October 31; November 2 and 4

We will continue this week with our look at at functions. We will discuss some functions in the C standard library, including printf and scanf. Note that this material is not in the textbook. We will also talk about system services, which are called using the syscall instruction. System services are covered in Chapter 13 of Jorgensen. If you would like a very short introduction to the C programming language, see:

A short overview of C

Here is a sample assembly language program from class on October 31, using functions from the C standard library:


And here is the sample assembly language program from the November 2 class that uses the C standard library to read simple expressions entered by the user:


Tenth Week: October 24, 26, and 28

We have mostly finished with implementing control structures in assembly language. This week, we will be looking at functions, how to call them, how to write them, and how a stack is used to implement them. In addition to writing and calling functions in assembly language, we will discuss how to call assembly language functions from programs written in C and how to call functions written in C from assembly language programs. This means that we need to learn about the C "calling convention" which specifies how parameters and return values work in C. (Note that the term "function" is used for all subroutines in C, including subroutines that do not return a value.) The textbook reading is Chapters 9 and 12 in Jorgensen. This topic should take us into next week.

Here is the example from class on Wednesday, which defined and uses a factorial function, but with a non-standard calling convention:


And here is the handout from Wednesday, which lists x86-64 registers and their use in the standard calling convention. There is also a list of important x86-64 assembly language instructions:

Registers and Instructions Handout

Ninth Week: October 17, 19, and 21

We will finish most of Jorgensen, Chapters 7 and 8. This material includes the basic x86-64 arithmetic, logic, and jump instructions. Towards the end of this week and going into next week, we will discuss how to use assembly code to implement control instructions like those used in C and Java programs.

The Larc-in-Logisim project is due this Thursday. Upcoming labs will focus on x86-64 assembly language programming using the yasm assembler.

Here is the sample x86-64 assembly language program for printing a 3N+1 sequence, which we looked at in class on Wednesday:


There is also a copy in /classes/cs220.

Eighth Week: October 12 and 14

There is no class on Monday because of Fall Break.

On Wednesday and Friday, we will discuss how to use the yasm assembler and the ddd debugger. We will be using these tools for much of the rest of the semester to process x86-64 assembly language programs. They are covered in Chapters 5 and 6 of Jorgensen. We will then start discussing x86-64 assembly language instructions, which will take us into Chapter 7.

Seventh Week: October 3, 5, and 7

The labs for this week and next week will be the final Logisim project—building a simulation of the Larc model computer in Logisim. I will discuss that project in some detail on Wednesday.

We have just begun moving into the next phase of the course, were we will study x86-64 assembly language and the x86-64 architecture. Textbook readings from now on will be from x86-64 Assembly Language Programming with Ubuntu, by Ed Jorgensen. The material for this week comes from Chapters 2, 3, and 4. Chapter 2 is a short introduction to computer architecture in general, plus information about x86-64 registers. Chapter 3 is mostly a review of data representation that we covered earlier in the course, but it is oriented more towards x86-64 and C data types. Note in particular that in this textbook, characters will always be 8-bit ASCII characters. Chapter 4 begins the study of x86-64 assembly by discussing the overall format of an assembly language program. We will probably start Chapter 4 by Friday.

Sixth Week: September 26, 28, and 30

There is a test in class on Wednesday, September 28.

Click here for the study guide

Because we moved more quickly than I expected through logic circuits, we spent most of last week talking about other topics. We looked at the memory hierarchy and caching, which is covered in Tarnoff, Chapter 13. (However, Tarnoff spends much of that chapter on hard disks, which we did not cover.) We also started talking about the x86 architecture, which is covered in even more detail in Tarnoff, Chapter 16.

On Monday of this week, we will review for the test. On Friday, we will look at the structure of the Larc computer and how it can be simulated in Logisim.

Fifth Week: September 19, 21, and 23

Last week, we covered basic memory circuits: the S-R latch, the D-latch, and the D-flip-flop. This week, we will look at how these memory circuits are used to build computing devices. We will be studying more complex sequential circuits. The lab this week will cover memory circuits, with the more general sequential circuits to follow next week.

Memory circuits are covered in Chapter 10 of Tarnoff and sequential circuits in Chapter 11. However, note that Tarnoff does not use exactly the same terminology and circuit structure that I am using in class. My advice for this material is that, in general, you should depend on your notes from class.

Some people have had trouble downloading Logisim. Here is a link to the Logisim jar file.

Here are the two Logisim files that were demonstrated in class on Wednesday, September 14, which implement multiplication and division of 16-bit numbers: multiplication.circ and division.circ. These files can be opened by Logisim.

There is a test coming up next week, on Wednesday, September 28. A study guide for the test will be avaialbe on Friday.

Fourth Week: September 12, 14, and 16

We will continue talking about logic circuits. We are talking about "combinational logic circuits," which have no loops. Combinational circuits correspond to Boolean expressions, and we will look at that idea more closely. For the reading, continue Sections 5.1 through 5.3 of Tarnoff, Chapter 5. We will do some things that are covered in Sections 6.1 through 6.3 of Tarnoff, Chapter 6, but in less depth than Tarnoff's book.

We might start looking at the other type of circuit, "sequential logic circuits," on Friday.

Last Friday, the 9th, I demonstrated Logisim in class. I showed two example files. These are files that can be opened by Logisim. gates-from-transistors.circ shows that AND, OR, and NOT gates can be built from transistors. MUX-examples.circ shows how to construct multiplexers.

Addition circuits, multiplexers, and decoders are coverd in Tarnoff, Chapter 8. That chapter uses Karnaugh maps to simplify circuits, but I will not cover them. It also covers some additional applications, such as a 7-segment display, which I will not cover.

Third Week: September 5, 7, and 9

On Monday, we will spend some time on division of binary numbers. We will then finish our discussion of the Larc ISA by looking at the instructions that access memory, at strings and the syscalls for string I/O, and at the jalr instruction and how it is used to implement subroutine calls. For the lab this week, you will write Larc programs that use these features.

By the end of Wednesday's class, we should start our next major topic: Logic circuits and how they are used to build computer hardware. The textbook reading on the material for this week and the start of next week is Tarnoff, Chapter 4 and Sections 5.1 through 5.3 of Tarnoff, Chapter 5. Note that I will not use Tarnoff's notation for the Boolean operations AND, OR, and NOT.

In class on Wednesday, I demonstrated two Larcsim programs:  subroutine-example.s  and  count-spaces.s.

Second Week: August 29 and 31; September 2

The main topic for this week is the Larc ISA. In the next two labs, you will be writing simple assembly language programs for Larc and running them in a simulator. You should read the documentation for the Larc ISA and for the simulator:

The Larc Machine Language
The Larc Simulator

We will also look at arithmetic opertions on binary integers. The textbook material on that topic is Tarnoff, Chapter 3, Sections 3.1 to 3.4.

If you are interested in learning more about Linux and, in particular, about using the command line, see If you log into your Linux account, note that some of the default settings for the GUI are awful. To make the experience less annoying, you are encouraged to change those settings following these instructions from that web site.

Here are links to PDFs of the two sides of the handout from the class on August 29: Larc ML table and Larc syscall table.

First Week: August 22, 24, and 26

Welcome to the course!

This course will introduce you to the concrete, low-level details of computing on both the hardware and software level. After a short overview of the course, we will start by looking at the problem of data representation. All data in a computer is represented as binary numbers — zeros and ones. This week, we will discuss how integer and real numbers are represented in binary and in hexadecimal form. In the next few weeks, we will see how to do integer arithmetic with binary integers and how to implement those arithemetic operations in hardware.

It is possible that you will get all the information that you need from this week's lectures and lab (and from past experience with binary numbers). But for more details on binary and hexadecimal integers, you can read Tarnoff, Chapter 2, Sections 2.1 to 2.4 and 2.7. By the end of the week, we will also cover binary representation for numbers of type float, which is covered in Tarnoff, Chapter 3, Section 3.4.

You should read the syllabus, and you should read through the lab writeup before lab on Thursday.