CS 341L Computer Architecture

CS 341L Introduction to Computer Architecture and Organization, Spring 2019

Course Information

  • Lecture Time/Location: Lecture 9:30am-10:45am Tue Thu, Centennial Engineering Center 1032
  • Lab Time/Location: 3:00pm-3:50pm Fri, Centennial Engineering Center B146A

Instructor

Jedidiah McClurg, Assistant Professor of CS

  • Contact: jrmcclurg (at) unm (dot) edu
  • Office: FEC 3040
  • Office Hours: Tue 11am-12pm, Thu 11am-12pm, Fri 4pm-5pm (look for me in FEC 3040 or FEC 3105)

NOTE: There are two people with my first name in the the CS department. My apologies in advance for any confusion!

Teaching Assistant (TA)

Jeff Sharpe

  • Contact: jeffunm (at) unm (dot) edu
  • Office Hours: Mon 9:30am-11:30am, Wed 9:30am-11:30am (in FEC 3105)

Course Overview

Computers are everywhere -- your laptop, wireless router, cable modem, smartphone, digital watch, videogame console, etc. all contain a computer of some type. Although these devices may differ in functionality and performance, they share some common elements: (1) the central processing unit (CPU) -- a chip that executes instructions, (2) memory -- used for storing information to be operated on by the CPU, and (3) storage and input/output (I/O) devices -- used for persistent storage, interaction with the user, etc. The study of these components and how they are connected is called computer architecture. Our goal in this class will be to understand how to assemble a basic computer from the ground up, starting with digital logic gates, and working our way up to more complex devices like the CPU.

Prerequisites

The prerequisites are 241L Data Organization and ECE 238L Computer Logic Design.

Online Community and Communication

We will use Piazza in the class. This is a great way to ask questions and communicate with the instructor and your classmates. Participation on Piazza is required, and will factor into the ``participation'' component of the grade.

The class Piazza link is: https://piazza.com/unm/spring2019/cs341l/home

I will use Piazza to communicate with the class. I also ask that if you have questions about the course, you first do a quick search on the Piazza page, to make sure your question has not already been answered there. If not, please go ahead and post your question on Piazza so that I, the TA, or another student can answer it publicly. This will help to streamline the communication.

NOTE: if you have a question you do not wish to publicize (e.g., about your grades, etc.), you can either create a "private post" on Piazza, or email me or the TA directly.

Textbook and Other Reading Materials

NOTE: this textbook is recommended, but NOT REQUIRED. I will assign readings from the text to supplement the lectures, but you are only responsible for the information presented in lecture.

  • Computer Organization and Design, Fourth (4th) Edition by Hennessy & Patterson

The 4th Edition has a blue cover. There is also a "Revised 4th Edition" which has essentially the same content, and has a yellow cover.

You do not need the CD that accompanies the book. You should be able to get a used copy of one of the two above textbook editions, if you want to. You also may be able to obtain a PDF version of the book for low cost.

You might be able to use the 5th Edition for this class, but I'm not sure how the section numbering and technical content corresponds to that of the 4th Edition, so your mileage may vary.

Grading

The following percentages show how final grades will be calculated. I will not perform any rounding on the scores (e.g., a score of 92.999 will not be rounded up to 93). I may or may not curve the overall grades, depending on how well the class performs overall, however, I expect each student to work hard, and not rely on the curve!

item percentage
labs 40%
homeworks 10%
exam 1 20%
exam 2 20%
participation 10%

Letter grades will be calculated based on the following intervals:

range grade
[99,100] A+
[93,99) A
[90,93) A-
[87,90) B+
[83,87) B
[80,83) B-
[77,80) C+
[73,77) C
[70,73) C-
[67,70) D+
[63,67) D
[60,63) D-
[0,60) F

Attendance

Class attendance will factor into the Participation component of the grade. Further details TBA.

Collaboration

TBA.

Respectfulness and Academic Honesty

I expect every student to show respect to me and the rest of the class. This course is preparation for your future career, so make sure you are behaving with the same level of professionalism that would be expected at a future full-time position. My general rule of thumb is: informal is okay, but disrespectful is not.

  • I prefer to be addressed by my first name ("Jed" or "Jedidiah"), but "Dr. McClurg" is also fine.
  • It is vital that you do your best to be participate in the class, and communicate with the instructor(s) about any course-related difficulties you are facing.

Plagiarism/cheating is NOT acceptable, and will be met with quick and harsh penalties. I do not want to see any academic dishonesty in this class!

Accommodation

In accordance with University Policy 2310 and the Americans with Disabilities Act (ADA), academic accommodations may be made for any student who notifies me (the instructor) of the need for an accommodation. It is imperative that you take the initiative to bring such needs to my attention, as I am not legally permitted to inquire. Students who may require assistance in emergency evacuations should contact me as to the most appropriate procedures to follow. Contact Accessibility Resource Center at 277-3506 for additional information"

Schedule

This schedule is tentative, and is subject to change.

week date topics reading assignment
1 Jan 15 Intro 1.1 - 1.4, notes01 homework 1 due at midnight
Jan 17 Intro 1.5 - 1.9, notes02
Jan 18 intro to lab1 [Git]
2 Jan 22 Instruction Set 2.1 - 2.4, notes03
Jan 24 Instruction Set 2.5 - 2.7, notes04
Jan 25 (work on lab1) lab 1 released
3 Jan 29 Instruction Set 2.8 - 2.9, notes05
Jan 31 no class (instructor traveling) 2.10, notes06
Feb 01 (work on lab1)
4 Feb 05 Instruction Set 2.11 - 2.12, notes07
Feb 07 Instruction Set 2.13 - 2.14, notes08
Feb 08 (work on lab1)
5 Feb 12 no class (instructor traveling) 3.1 - 3.2, notes09
Feb 14 Computer Arithmetic 3.3, notes10
Feb 15 (work on lab1) lab 1 due at midnight
6 Feb 19 no class (inclement weather) lab 2 released
Feb 21 Computer Arithmetic 3.4 - 3.6, notes11
Feb 22 (work on lab2)
7 Feb 26 CPU 4.1 - 4.2, notes12
Feb 28 CPU 4.3, notes13
Mar 01 (work on lab2)
8 Mar 05 CPU 4.4, notes14
Mar 07 Exam 1 during class
Mar 08 (work on lab2) lab 2 due on Sunday Mar 10 at midnight
9 Mar 12 no class (holiday)
Mar 14 no class (holiday)
Mar 15 no class (holiday)
10 Mar 19 CPU 4.5 - 4.6, notes15
Mar 21 CPU 4.7, notes16
Mar 22 (finalize lab2)
11 Mar 26 CPU 4.8, notes17
Mar 28 no class (instructor traveling)
Mar 29 no class (instructor traveling)
12 Apr 02 Memory 5.1, notes18
Apr 04 Memory 5.2, notes19 lab 3 released
Apr 05 (work on lab3)
13 Apr 09 Memory 5.3, notes20
Apr 11 Memory 5.4, notes21
Apr 12 (work on lab3)
14 Apr 16 I/O 6.1 - 6.4, notes22
Apr 18 I/O 6.5 - 6.6, notes23
Apr 19 (work on lab3)
15 Apr 23 no class
Apr 25 I/O 6.7, notes24 lab 4 released
Apr 26 (work on lab3) lab 3 due
16 Apr 30 exam review
May 02 exam review
May 03 (work on lab4)
17 May 7 Exam 2 @ 7:30am-9:30am in regular classroom
May 9 no class (final exam week)
May 10 no class (final exam week) lab 4 due

Lab Topics

There will be 4 labs. Details TBA.

Homework

There will be approximately 1 homework per week, to help encourage you to keep up-to-date on the course material. Details TBA.

Computing Resources

We will spend some time working on the labs in class.

In order to work on the labs outside of class, you will need access to a Linux machine. I would strongly recommend using Ubuntu Linux.

You will need a CS Account to use any of the UNM CS machines, including the ones in our B146 lab. If you don't have a CS Account, go to the SSG office in 3550 FEC.

There is a computer lab in the Farris Engineering Center (FEC 2065), which should be accessible to students with a CS Account. You will need a proximity-enabled student ID card to open the door (you can check whether you have such a card by looking for a 5-digit number on the back, below the magnetic strip). If you want access added to your proximity-enabled card, please ask at the front desk in the main CS office (FEC 2200).

You can access a random machine in the FEC computer lab via SSH:

ssh -X moons.cs.unm.edu

You can also access the machines in our classroom (B146A Centennial Engineering Center) by using SSH:

ssh -X b146-xx.cs.unm.edu

(where xx goes from 01 to 76).

Additionally, you can access a random virtual machine run by the CS department:

ssh -X trucks.cs.unm.edu

Another alternative is to set up your own Linux machine. The easiest way to do this is to install VirtualBox. You can install this on Windows/MAC/Linux. Then, download an Ubuntu Linux disk image, create a new virtual machine (VM) within VirtualBox, and boot your VM using the disk image.

Note on Using Windows/Mac for SSH

SSH with X-forwarding (i.e., the -X option, as shown above) allows you to log into a remote machine and run graphical programs. All of the commands on this page assume you're using Linux, but it's also possible to use SSH with X-forwarding from a Windows or Mac machine. The instructors will not provide detailed support for Windows/Mac users, however, students have had success using Mobaxterm on Windows and XQuartz on Mac to connect to the CS machines via SSH.

Accessing Your Personal Repository for the Labs

I have created a Git repository for each student. You should have already received an invite to access your repository on LoboGit. If you did not receive such an invite, contact me immediately.

The name of your repository will be teamXX, where XX are digits. You should be able to view the repository online at https://lobogit.unm.edu/arch-s19/teamXX.

You will use the git tool on Linux to access the repository.

Cloning the Repository via HTTPS (Easy)

This is the easiest method of accessing your repository. Git will prompt you for your UNM NetID/password.

cd ~
mkdir -p arch-s19
cd arch-s19
git clone https://lobogit.unm.edu/arch-s19/teamXX.git
cd teamXX

Here, you should be able to type ls (list files) and see a basic README file.

Cloning the Repository via SSH (More Difficult)

If you don't wish to type your NetID/password, you can instead use public-key authentication. First (if you haven't already done so), you need to create a key pair for public-key authentication (git will use this instead of username/password for authentication).

mkdir -p ~/.ssh
chmod 700 ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa -b 4096 -C "YOUR_ADDRESS@unm.edu" -f id_rsa

(where YOUR_ADDRESS@unm.edu is your UNM email address). This creates a public key (id_rsa.pub) and a private key (id_rsa). KEEP YOUR PRIVATE KEY SECURE AT ALL TIMES! Open the public key (id_rsa.pub) in a text editor

pluma ~/.ssh/id_rsa.pub

and copy the contents into the "SSH Keys" section of your "Settings" on LoboGit. Once the public key is added on LoboGit, you can do

cd ~
mkdir -p arch-s19
cd arch-s19
git clone git@lobogit.unm.edu:arch-s19/teamXX.git
cd teamXX

Here, you should be able to type ls (list files) and see the basic README file.

Using Your Instructor-Provided VM

For use in the labs, you will be given a virtual machine (VM) with sudo permissions, i.e., you will have administrative privileges (unlike on the CS lab machines). This will give you greater freedom in experimenting with the machine's protocol stack.

BE CAREFUL when using sudo on your machine! With great power comes great responsibility!

Your VM can only be reached via one of our lab machines (the machines in B146). If you are not in the classroom, you can access the machines remotely:

ssh -X username@b146-xx.cs.unm.edu

(where username is your CS username, and xx is between 01 and 76).

First, open a new terminal on a lab machine, or connect to one via SSH.

At the terminal prompt, type the following commands

cd /b146vpn
openvpn b146fw-udp-1194.ovpn

and enter your CS username/password when prompted. This authenticates you with the virtual private network (VPN) needed to access your VM.

NOTE: if you get an error about the address already being in use, that means the VPN client is already running! In this case, just skip the CTRL-Z step and continue with the instructions.

Once the VPN says it's connected, press CTRL+Z (hold down on the CTRL key and then press the Z key). Then type the command bg and hit ENTER (this makes sure the VPN continues to run in the background).

At this point, you should be able to log into your VM:

ssh -X username@10.200.2.yyy

NOTE: Replace username with the username you've been sent via email (it should be the same as your NetID username). The 10.200.2.yyy is a unique IP address for your VM, which you will be sent via email. DO NOT try to log into a VM unless you have been assigned a username and IP address via email!

Your VM password is initially set PassXXXXXX!, where XXXXXX is the unique six-digit ID you were assigned via email at the beginning of the class. The first time you log in, you will be asked to change your password. When asked for "Current UNIX password", repeat the PassXXXXXX! password, and then you'll be asked to type a new password twice. The new password can be anything you want (this VM account is not connected to your UNM account, or your CS account -- the VM will only be used in this class).

Finally, install some tools:

sudo apt-get install gcc-arm-linux-gnueabi

As a basic test, create a simple "Hello World" C program called test.c, and then try to compile it for ARMv7-A:

arm-linux-gnueabi-gcc -march=armv7-a -S test.c -o test.s
arm-linux-gnueabi-as test.s -o test

The test binary will not run on your VM, since it's an ARM binary (your VM is an x86 machine). However, you can look at the test.s file to see the ARM assembly code.