Courses/Computer Science/CPSC 355.W2014/Lecture Notes

Course notes are available from here.

= Scribe Notes =

Courses/Computer_Science/CPSC_355.W2014/Lecture Notes/Scribe

(if you scribe a class session, your lowest homework grade will be upgraded a letter grade)

= Week 1: Introduction =

January 8: Overview
Courses/Computer_Science/CPSC_355.W2014/Lecture Notes/Overview

January 10: What is a Computer?
Courses/Computer_Science/CPSC_355.W2014/Lecture Notes/WhatIsComputer

= Week 2: Architecture Overview, Computer Organization =

This week, we will examine the main concepts involved in computer organization: in other words, the general design principles along which a digital calculation device might be organized and constructed.

A glance at the overall translation of C to x86 and SPARC assembly. Producing and examining assembly language. Producing and examining the ELF object file (a preview of week N).

Readings


 * A Tiny Guide to Programming in 32-bit x86 Assembly Language (you don't need to absorb this 100% right now, but skim through it for a summary of major IA-32 architectural features.
 * K&R: Chapter 1 (A Tutorial Introduction to C)
 * Paul: Chapter 1:
 * 1.1 Introduction
 * 1.2 Calculators
 * 1.4 von Neumann
 * 1.5 The Stack Machine
 * 1.6 The JVM
 * 1.7 Accumulator Machines
 * 1.8 Load/Store Machines
 * 1.9 Assemblers
 * 1.10 Summary

January 13: Elements of The ISA
Courses/Computer_Science/CPSC_355.W2014/Lecture Notes/ISAIntro

January 15: Translation of C to ASM
Courses/Computer_Science/CPSC_355.W2014/Lecture Notes/IntroC2ASM

January 17: Instruction Semantics, Examining Program Execution
This week was really a teaser for the rest of the semester: you saw the most important "details" of the ISA (its major components and how they operate) as well as the process of translating C code into x86 assembly and machine code.

Courses/Computer_Science/CPSC_355.W2014/Lecture Notes/IA32Intro

= Week 3: Digital Logic, Binary Numbers =

Readings


 * K&R:
 * Chapter 2 (Types)
 * Chapter 3 (Control Flow)
 * Paul: Chapter 3, especially:
 * 3.1
 * 3.2
 * 3.3
 * 3.5

January 20: Binary and Hexadecimal Number Systems

 * prev. week was a teaser: you saw
 * the architecture high level organization
 * the process of turning source into assembly

Today we covered the basics of the binary and hexadecimal number systems. We looked at some basic boolean formulas to see the utility of binary in digital devices.

Now we need to go back and look at the fundamental underpinnings of all this: number systems and digital logic

January 22: Programming Meets Binary and Hex
We will see how x=x+1 can be implemented in assembly

Outline:


 * sanity check
 * class starter puzzles (review binary and hex)
 * octal in a nutshell
 * program x = x + 1, run in gdb
 * demonstrates translation (again)
 * demonstrates using gdb (again)
 * highlights use of hex numbers in source and ASM
 * hand-executing x86 ASM activity

January 24:
= Week 4: Binary Arithmetic, Logic Operations =

This week we will consider the foundational procedures for emulating basic mathematics and logical operations on numbers by their bit-level manipulation by hardware circuits.

Readings


 * Paul: Chapter 4, especially:
 * 4.1: Intro
 * 4.2: Binary Numbers and Addition
 * 4.3: Half and Full Adders
 * 4.4: Modulus Arithmetic
 * 4.5: Subtraction
 * 4.6: Two's Complement...
 * 4.7: Unsigned Arithmetic
 * 4.13: Summary


 * Optional:
 * 4.8
 * 4.9
 * 4.10
 * 4.11
 * 4.12

January 27
Today we discussed how simple binary arithmetic could be implemented to support an ADD instruction in a machine instruction set. This functionality was based on modeling the process of addition as the combination of basic circuits and gates using AND, OR, and XOR.

January 29: Subtraction and Negative Numbers
Courses/Computer_Science/CPSC_355.W2014/Lecture Notes/SUBinx86

January 31: Instruction Implementation
Courses/Computer_Science/CPSC_355.W2014/Lecture Notes/InstrImpl

= Week 5: Execution Artifact, Test =

This week, we will take leave of our "foundational" knowledge of how many of the low-level details work and begin a more intense examination of the ABI and the execution artifact itself: the object code produced by a compiler and assembler that is eventually read and executed by a CPU.

Readings


 * K&R: Chapter 4 (Functions)
 * K&R: Chapter 5 (Pointers and Arrays)
 * Paul: Chapter 9 (External Text and Data)

February 3: Intro to ELF
Courses/Computer_Science/CPSC_355.W2014/Lecture Notes/ELFIntro

February 5: Midterm Exam
5 pages.

6 problems, mostly short answer.

100 points.

50 minutes.

No text.

No notes.

No calculator, computer, etc.

Write answers directly on the exam sheet.

Be prepared to write both C and ASM code.

February 7: ELF Continued
Courses/Computer_Science/CPSC_355.W2014/Lecture Notes/ELFCont

= Week 6: Machine Instructions =

This week we will examine the part of the ISA that defines the structure and semantics of machine instructions, paying particular attention to IA-32 in class; the readings will discuss SPARC, and we will cover SPARC in more detail in week N.

Readings


 * Paul: Chapter 8 (Machine Instructions)

February 10, 12, 14
= Week 7: Data Representation, Data Structures =

This week we will examine how data structures (i.e., collections of primitive types) are represented to and manipulated by the CPU.

Readings
 * K&R: Chapter 6 (Structures)
 * Paul: Chapter 6 (Data Structures)

February 24, 26, 28
= Week 8: External Data and Text, Execution Support / ABI =

Assembly programs, particularly for RISC-style architectures, usually operate on data in registers (i.e., small storage elements located in the CPU itself and defined by the ISA). Programs typically use more than this finite amount of storage, so the ISA and ABI must provide a way for programs to access a larger memory.

We will continue our consideration of how programs are able to use more than just statically allocated primitive types. We will pay particular attention to the stack, an area of dynamic memory typically used to store data needed by functions and subroutines.

Readings


 * Paul: Chapter 5 (The Stack)
 * Paul: re-read Chapter 9

March 3, 5, 7
= Week 9: Functions, Routines, Subroutines =

Readings


 * K&R (read or re-read Chapter 4)
 * Paul: Chapter 7 (Subroutines)
 * 7.1 -- 7.5

March 10, 12, 14
= Week 10: Subroutines =

Readings


 * Paul: Chapter 7 (Subroutines)
 * 7.6--7.11

March 17, 19, 21
= Week 11: SPARC Case Study =

Readings


 * Paul: Chapter 2 (SPARC Architecture)

March 31, April 2, 4
= Week 12: I/O, Interrupts =

Readings


 * K&R: Chapter 7 (Input and Output)
 * Paul: Skim Chapter 10 (Input/Output)

April 7, 9, 11
= Week 13: Flex, Demos =