ECE 250 / CS 250

Computer Architecture

Fall 2014
Professor Daniel J. Sorin


The objective of this course is to learn how computers work, focusing on how the computer hardware executes the software. 
The course focuses on: instruction sets, assembly language programming, basic digital logic design, processor design, memory system design, and input/output.  
Prerequisites: Everyone must have CS 201 (used to be CS 100).   ECE majors must also have ECE 110 (used to be ECE 27). 
Class Location and Hours


Class meets Monday/Wednesday/Friday from 10:20am - 11:10am at LSRC B101 (Love Auditorium).

Recitations are on Tuesday.

 Instructor, Teaching Assistants, and Answering Questions


This is a very large class, which means that students should contact other sources of information before, if necessary, contacting the professor.

* The first option for finding help is this website.

* Then check the course's Sakai and Piazza sites.

* The third option for finding help is the outstanding group of teaching assistants for this course.  Either email them (via the Piazza forum) or go to their office hours. Questions on the Piazza forum may get answered by a TA, a fellow classmate, or the professor.

* Please contact the professor only for those issues that cannot be handled by anyone else.

Graduate Teaching Assistants:  

Luwa Matthews (

Craig LaBoda (


Undergraduate Teaching Assistants:

Ruslan Ardashev, Jack Baskin, Jeannie Chung, Xavier de Gunten, Amanda Duffy, Carolyn Dugas, Andrew Gauthier, Ang Li, Ningrui Li, Sierra Smith, David Spruill, Hayden Bader, Logan Su, Zhihao Zhu, Calais Nelson, Gautam Hathi


* If you need to contact the professor, please email him or come to his office hours:

Professor Daniel J. Sorin

Office: 209C Hudson Hall

Office Hours: Monday 3:00-4:00 and Thursday 3:00-4:00 --- email me if you have class at both of these times and wish to meet with me

Email: sorin AT ee DOT duke DOT edu 

Required Textbook
David A. Patterson and John L. Hennessy. Computer Organization and Design: The Hardware/Software Interface, 5th edition, Morgan-Kaufmann.
Please do not get the "ARM" edition or the "Revised Printing" -- for some reason, the publisher has created several flavors of this book.
 Assignments and Grading
This course will require readings from the textbook, pencil and paper problems, programming assignments, and digital logic designs.

Students are responsible for:

Late homework policy -- NO exceptions, NO extensions (except in case of dean's excuse)

    0-24 hours late: 10% penalty
    24-48 hours late: 20% penalty
    >48 hours late: NO CREDIT

Start assignments and projects EARLY so that you don't get stuck at the end!

Academic Misconduct: I will not tolerate academically dishonest work.  This includes cheating on the homework and exams.  
I will refer all suspected cases of cheating to Duke's Office of Student Conduct.
Refer to the Duke Community Standard or to the instructor if you have any questions about misconduct.
 Topics, Lecture Notes, and Reading Assignments

I will post lecture notes (in PDF format) shortly before I cover them in class.  Please bring them to class. Click on topic title for link to notes.

Do not think that you can read the notes instead of attending class.  You will miss a LOT of course material if you miss class.

Topic Reading Assignments
Course Introduction and Overview
Chapter 1
Instruction Sets and Assembly Programming
Chapter 2
Digital Logic Design
Appendix B
Processor Core Design: Datapath and Control
Chapter 4: 4.1-4.4
Memory and Caches
Chapter 5
somewhat covered in Appendix A.8 
Pipelined Processor Cores
Chapter 4: 4.5-end
Parallel Processors (time permitting)
Chapter 6

Remote access to Linux machines.
We will use the Duke OIT Linux machines for portions of this course. Please read this document on how to remotely access these machines.

Unix Tutorial
You should also go through this short tutorial on Linux

File Access
You can use CIFS to access the files in your home directory. Please see the OIT documentation on CIFS.

Tools -- Text Editors
-- nedit is a fairly simple GUI-based editor on the linux machines.
-- If you want to become a more sophisticated user of Linux editors you can explore gvim, vim, or emacs on your own. (I prefer emacs.)

Tools -- Compilers (gcc)
-- compilation: gcc -o newApp test.c
-- generate compile time warnings: gcc -Wall test.c
-- include debug symbols into the application: gcc -g -o newApp test.c
-- Introduction to gcc

Tools -- Debugger (gdb)
-- Documentation -- GDB essentials

C Programming Language
-- Video snippets by Prof Drew Hilton (Duke ECE)
-- This is an MIT OpenCourseWare set of lectures that does a good job of covering the basics for C programming.

C Programming Examples
-- C Memory Layout Example array as list
-- C Bit Manipulation bit manipulation of Hex to extract float fields or for a float input with casting via pointers extract float fields from float input .

MIPS Instructions
-- Assemblers, Linkers, and the SPIM Simulator (PDF).
-- A two page MIPS quick reference guide from MIPS is here.
-- A three page document from me with MIPS instructions is here.

SPIM: A MIPS32 Simulator
Download the appropriate binary for your platform from the SPIM web site.

Assembly Programming Examples
-- sum = sum + i*i is here.
-- sum array is here.
-- recursive sum array is here.
-- recursive sum i*i is here.

Logic Design Online Book
Pragmatic Logic by William J. Eccles

Logic Design Tool
Logisim is a very nice tool that runs on any platform (Mac, Windows, Linux). You will use Logisim to design and test circuits. Click through the download links until you arrive at the site and then look for the green download button. Click download and it should autodetect your system so you get the right version.


This is a VERY tentative schedule which may change depending on time constraints and which days the instructor will be out of town.



Tuesday Recitation 



Aug 25


Unix and text editing

C programming

C programming
Sept 1

From C to binary

C programming: Intro From C to binary From C to binary
Sept 8 From C to binary C programming: pointers and memory management Assembly Assembly

Due: HW #1 (C programming)

Sept 15 Assembly Assembly programming examples / Using SPIM Intro to digital logic / combinational logic Sequential logic
Sept 22 Sequential logic

Assembly programming examples: focus on calling conventions

Functional Units

Datapath design

Due: HW #2 (Assembly)

Sept 29 Datapath design Digital design examples / Using Logisim Datapath design Midterm #1 (does not include digital logic design)
Oct 6 Exceptions/interrupts/syscalls Using Logisim for larger projects Memory hierarchies Caches
Oct 13


Caches Caches
Oct 20 Caches Cache operation examples Virtual Memory Virtual Memory
Oct 27 Virtual Memory review for Midterm #2 I/O Midterm #2 (does not include memory systems)
Nov 3 I/O Virtual memory operation examples I/O Pipelined cores
Nov 10 Pipelined cores Cache+virtual memory examples

Pipelined cores

Pipelined cores
Nov 17 Pipelined cores Pipelined operation examples Multicore Multicore
Dec 1

Sun's Niagara multicore processor

review for final exam In-class study of modern processors review for final exam
Dec 8