CS 316

Computer System Organization and Programming

Instructor: Kavita Bala

Cornell University Computer Science Department, Fall '07


CS 316 covers basic computer organization and systems programming. We will cover computer design, instruction sets, computer arithmetic, datapath design, GPU architectures, data formats, addressing modes, memory hierarchies including caches and virtual memory, I/O devices, and bus-based I/O systems. The projects will cover systems programming. The course is open to any undergraduate who has mastered the material in CS 211.


  • Dec 6: Office hours between now and next Thursday are as follows. These hours are subject to change and this list will be updated as needed.
    Tue,Dec 4, 2:55p-4:15p,RH 594(Adam)
    Wed,Dec 5, 10:10a-11:05a,CSUG(Daniel)
    Thu,Dec 6, 11:30a-12:30pCSUG(Ben)
    2:55p-4:15p,UP 4161(Robert)
    4:15p-5:15p,RH 594(Adam)
    Fri,Dec 7, 2:00p-3:00p,UP 5157(Jed)
    2:55p-4:15p,RH 594(Adam)
    Sat,Dec 8, 2:30p-4:00p,CSUG(Daniel)
    Sun,Dec 9, 2:30p-4:30p,UP 331(Jed)
    Mon,Dec 10,12:00p-1:00p,CSUG(Ben)
    1:00p-2:00p,UP 4161(Robert)
    Tue,Dec 11,1:00p-2:00p,CSUG(Ben)
    2:55p-4:15p,RH 594(Adam)
    Wed,Dec 12,10:10a-11:05a,CSUG(Daniel)
    1:00p-2:00p,UP 4161(Robert)
    3:00p-4:00p,RH 594(Adam)
    4:00p-5:00p,UP 5157(Jed)
  • Dec 1: The slides and C program examples from this week's sections are available. To extract the examples, type: tar zxvf pa6_examples.tar.gz.
  • Nov 30: The Corewars all-pairs results have been posted.
  • Nov 29: PA6 has been released and will be due Thu, Dec 13 at 10:00 a.m.
Old announcements:
  • Nov 27: The review session for Prelim 2 will be tomorrow (Wed), 6p-8p, in Upson 315.
  • Nov 23: Last year's Prelim 2 has been posted on the Schedule.
  • Nov 15: On Friday, November 30 from 5 - 9pm in Hollister 110, there will be a pizza party to host the CS316 Corewars Showdown.  Final project demos will occur on Thursday, December 13 from 2 - 4:30 pm in 455 Rhodes.  Closer to the due date CMS will be updated to include a sign up sheet for individual time slots.
  • Nov 15: PA5 (released yesterday) is now posted on the course web.
  • Nov 5: PA4 (released on Sat, 3 Nov) is now posted on the course web.
  • Nov 1: A section on C Programming Help has been added below.
  • Oct 27: The "Smashing Fun with Smashing Stacks" slides are available.
  • Oct 23: HW2 has been released in CMS.
  • Oct 17: Several students had trouble setting thier PATHs correctly in order to run the compiler for HW1 Part VI.  To make things more convenient, we have changed Makefiles so that setting the PATH is no longer necessary.  If you have been getting errors where "mipsel-linux-gcc" or "mipsel-linux-nm" is not found, they should now be fixed.  This change does not affect the results of the assignment nor any person that might have set their PATH already.
  • Oct 15: The MIPS Assembly Language Reference has been added to the links at the bottom of this page.
  • Oct 15: In HW1 Question VI Part HW4, you were asked to compare hw3.s and hw4.s and explain the action of the volatile keyword.  However, because basic  compiler optimization are turned off when making these files, the output programs from these examples ended up being identical.  To make this question more meaningful, we have produced new versions of hw3.c and hw4.c and placed them in the directory /usr/local/cs316/hw1_newExamples.  For this one part of the assignment, Question VI Part HW4, use these programs instead of the originals as the basis for your answer.  The steps you used to compile and run the original programs will all work the same for these new examples.  The new versions are also available in CMS.
  • Oct 12: The cs316 Logisim library has been updated to fix a bug in the encoding of branch instructions.
  • Oct 8: The cs316 Logisim library has been updated yet again. The previous "fixes" to the Program ROM's handling of branch instructions were wrong and have been rolled back. See the PA3 FAQ for details.
  • Oct 7: The cs316 Logisim library has been updated again. This release fixes a bug in the register file. Writes to the register file now happen on the falling edge of the clock, out of phase with the pipeline registers. This avoids the need to forward data from the WB stage.
  • Oct 7: The cs316 Logisim library has been updated. This release fixes bugs in the handling of branch instructions. Also included is a drop-in replacement for the RAM component built into Logisim, which exhibits bugs when you try to do logging with it.
  • Sep 27: PA3 has been released.
  • Sep 27: The cs316 Logisim library has been updated: the MIPS Program ROM component now understands the JAL and JALR instructions, which will be needed in PA3..
  • Sep 25: The cs316 Logisim library has been updated: the MIPS Program ROM component now understands the nop instruction.
  • Sep 21: Some grading comments on where points were commonly lost have been added to the PA1 FAQ.
  • Sep 19: The cs316 Logisim library has been updated with new components that you are required to use in PA2. Check here for details.
  • Sep 19: PA2 has been updated. You are no longer required to compute jump addresses based on the delay slot's PC.
  • Sep 16: Link to MIPS instruction reference added to Tools section.
  • Sep 15: PA2 has been released.
  • Sep 11: There have been updates to the PA1 FAQ.
  • Sep 10: Unless otherwised notified, the recitation sections can be considered additional office hours for the TAs and are not mandatory. For example, all recitations this week will be optional.
  • Sep 10: There have been updates to the PA1 FAQ.
  • Sep 4: PA1 has been released.
  • Aug 31: The "Introduction to Logisim" slides are available. [6 per page][2 per page]
  • Aug 27: The class newsgroup is now up: cornell.class.cs316


  • CS 316 Intro to Computer System Organization & Programming
  • Instructor: Kavita Bala
    • Office: 5142 Upson Hall
    • Office Hours: Tuesdays 2:45 p.m. – 3:45 p.m. and by appointment
  • Teaching Assistants:
    • Adam Arbree
      • Office: 594 Rhodes Hall
      • Office Hours: Thursdays 4:15 p.m. – 5:15 p.m. and by appointment
    • Robert Burgess
      • Office: 4161 Upson Hall
      • Office Hours: Wednesdays 1 p.m. – 2 p.m. and by appointment
    • Jed Liu
      • Office: 5157 Upson Hall
      • Office Hours: Mondays 2 p.m. – 3 p.m. and by appointment
  • Undergraduate Consultants:
    • Daniel Margo
      • Office: CSUG Lab
      • Office Hours: Wednesdays 10:10 a.m. – 11:05 a.m.
    • Matt Oliveri
      • Office: CSUG Lab
      • Office Hours: Fridays 11:40 a.m. – 12:55 p.m.
    • Ben Pu
      • Office: CSUG Lab
      • Office Hours: Thursdays 11:30 a.m. – 12:30 p.m.
  • Administrative Assistant: Amy Fish
    • Office: 4115 Upson Hall

C Programming Help



David Patterson, John Hennessy
Computer Organization and Design

Get the revised printing from summer 2007.