## CPSC 220: *Computer Architecture*

Department of Mathematics and Computer Science Hobart and William Smith Colleges Fall, 2022. Instructor: David J. Eck (eck@hws.edu) Course Handout: https://math.hws.edu/eck/courses/cpsc220_f22.html 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.

### 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 https://math.hws.edu/about_linux/. 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.