Detailed schedule and resources for COMP251

Class 1: Monday, August 29

Brief introduction to syllabus.

Background information on text editors and the terminal window.

Minilab:

We may also have time to discuss the paradox in SheepTracker.java.

Class 2: Thursday, September 1

Interesting background on why binary numbers are used in computers: the designers of one of the earliest computers give their reasoning in section 5.2 of Preliminary Discussion of the Logical Design of an Electronic Computing Instrument, by Burks, Goldstine, and von Neumann (1947).

Minilab 1:

Minilab 2: Minilab 3:

Class 3: Monday, September 5

Today's lecture notes on signed integers are available.

The textbook's table 2.2 (page 82 in 4th edition) is extremely important, but difficult to understand. Here's my explanation of the table.

Minilab using SignedIntExperiments.java:

  1. Don't try to understand the code. Skip to the main method, and make sure you understand its output.
  2. Do the challenge exercise in the comments at the end of the code.
  3. Now go back and try to understand the code, especially makeBitString().

Class 4: Thursday, September 8

Lecture notes on floating-point numbers.

Minilab code: FloatingPointExperiments.java

Some further experiments to try at home:

  1. Compute (0.1+0.2)+0.3 and 0.1+(0.2+0.3) in Java. Are they the same? Explain your result.
  2. Write some Java code that will initialize a double to 1.0, then repeatedly multiply its value by 10, printing out the result each time. What happens? Why? Can you explain the exact time at which things start to go wrong?

Class 5: Monday, September 12

Important announcement: late days may not be used for writing assignment 1, part a (WA1a). If you don't bring a satisfactory printout of your assignment to class on Thursday, September 22, the late penalty specified in the syllabus will be applied.

These links will help us understand the von Neumann architecture (and give us a blast from the past for those who are nostalgic about COMP131):

Challenge 1: implement MM[9] = MM[8] - MM[7] on the knob and switch computer above.

Challenge 2: find out as much as you can about the hardware of the computer you're working on (CPU specs, memory specs, disk drive, and anything else you can think of).

If there's time, we'll do a quick mini-lab that will get you started on Homework exercise 1.6, using SmallProgram.java as a starting point.

Class 6: Thursday, September 15

Today's lecture notes on Boolean algebra and logic gates.

For interest only: Some brief excerpts from George Boole's Laws of Thought (1854).

Minilab 1: Use TruthTable.java to check your own computation of the truth table for a Boolean function of three variables.

Minilab 2: If we have time, we will acquaint ourselves with SimcirJS, a nifty circuit simulator by Kazuhiko Arase. Instructions:

  1. Create inputs A, B, C by dragging the "toggle switch" tool, then double-click to rename.
  2. Send some power to the inputs by dragging the "DC" tool, and connecting it to each of the inputs.
  3. Create an output by dragging the "LED" tool.
  4. Connect the inputs to the output using your favorite circuit. Click on the inputs to toggle them on or off. Check that the output lights up when you expect it to.

Class 7: Monday, September 19

Today's lecture notes on combinational circuits.

Some beautiful JavaScript demos of important circuits by Ken Bigelow: half and full adders, multiplexer, decoder.

Circuit puzzles from the textbook authors.

Minilabs: See previous class for instructions on using SimCir. Then use SimCir for the following (save these in for later use):

Class 8: Thursday, September 22

WA1a peer review. Please bring a hard copy of your report to class. In class, we will conduct peer review of the reports in groups. Please see the file groups-for-peer-review.pdf (available on Moodle) for the group assignments. This peer review activity will be graded as a homework assignment worth 20 points. You should easily have time to complete the assignment in class, but if you need more time it must be completed within 24 hours. Late days cannot be used. Specific instructions are as follows. Each student is assigned to review the reports of two other students. For each of the reports that you are required to review:

Class 9: Monday, September 26

Class 10: Thursday, September 29

An interesting experiment with word sizes: can we explain the output of the program WordSizeExperiment.c, in terms of the word size of the machine it is run on? Additional exercise: (i) add some code that performs a similar comparison of the cost of performing addition on bytes; (ii) run the same experiment using multiplication rather than addition.

Check out the Intel spec for examples of what kinds of registers are present (fig 3-1 on p65 is a great place to start; see also the 64-bit setup in fig 3-2).

Class 11: Monday, October 3

Today's lecture notes on introduction to assembly language.

You'll need the MARIE simulator from the textbook's student resource page. (Note that we will be using the simulator and other resources from the third edition, since the resources for the fourth edition require paid access.) Steps to create and run an assembly language program:

  1. run MarieSim.jar
  2. in simulator: File | Edit
  3. in editor: Type program
  4. in editor: File | Save (saves text file as *.mas; if it does not automatically give your file a ".mas" extention, then manually add ".mas" to the end of the filename)
  5. in editor: Assemble | Assemble current file (creates machine language file as *.mex)
  6. [optional] in editor: Assemble | Show assembly listing
  7. in simulator: File | Load (load the .mex file)
  8. in simulator: Run | Run (you can experiment with single stepping)

Here's a zip file containing a simple example program that adds two numbers, and another program that we will discuss in class: simpleAdd.zip.

Class 12: Thursday, October 6

[Bring any exam revision questions that you would like to go over in class.]

Today's lecture notes on assemblers and symbol tables.

Here's a zip file containing a simple example program demonstrating the skipcond instruction: simpleSkip.zip.

Here's a much more readable version of the same program using labels: simpleSkip2.zip.

Class 13: Monday, October 10

Exam 1. See the exam web page for details. Don't forget that homework solutions are available on Moodle.

Class 14: Thursday, October 13

Today's lecture notes on subroutines and loops.

ZIP file of assembly language demos for the JumpI, AddI, JnS, and Clear instructions, and a subroutine.

Instructions for minilab:

  1. Download the above zip file of assembly language demos.
  2. Extract and open the file subroutineDemo.mas in MARIE.
  3. Run the code and make sure you understand the result.
  4. Complete the challenge exercise given at the bottom of the code listing. That is, alter subroutineDemo.mas to achieve the result X=(4*X-1)*4*4.
  5. Write subroutine that multiplies two positive integers X and Y, storing the result in Z.
  6. Use your answer to write an assembly program that computes the product of five numbers.
  7. Can one subroutine call another subroutine? Give examples or counterexamples.
  8. Can a subroutine call itself? Why or why not?

Class 16: Thursday, October 20

At the start of class (or before class if you prefer), please take the mid-semester survey.

Take a look at Part 2 of the writing assignment, and please ask any questions in class.

Today's lecture notes on further assembly language (specifically, describing one reason we learn assembly language, and self-modifying code).

Demo of the importance of understanding assembly language: Counter.java. The strange behavior of this program can only be explained by understanding the instruction set of the computer on which it's run.

Demos of self-modifying code.

Class 17: Monday, October 24

Today's lecture notes on real world architectures.

Examining this java program in the Eclipse debugger shows some aspects of the call stack: StackDemo.java.

Examining the assembly language from the following C programs gives some interesting clues about real-world assembly language: variables.c, subroutine.c, loop.c.

The Intel spec contains all the gory details of a real assembly language. Glance at this for interest only; there is nothing in this document that you need to know.

Class 18: Thursday, October 27

Today's lecture notes on instruction set design.

Here is a C program we can use to determine the endianness of the lab machines: endian.c.

Suggested extra practice exercises (3rd edition): Ch 5, exercises 1a, 1b, 4, 8, 17. Solutions are in the back of the textbook.

Class 19: Monday, October 31

Today's lecture notes on pipelining and real-world ISAs. [Updated version posted 9pm 10/31/16 -- fixed the two errors noted in class.]

Java bytecode minilab

Here is a simple Java program that we can compile, then disassemble, to understand something about Java bytecode: Mult.java.

Here are the steps to follow for this minilab:

Class 20: Thursday, November 3

Today's lecture notes on memory systems and performance.

A simple program for empirically determining cache sizes: CacheTimer.java. Compile it, then run using the commandline java CacheTimer N, where N is the size of an array of integers whose random access time you want to estimate.

Some cool results from CacheTimer.java.

Class 21: Monday, November 7

Today's lecture notes on cache mapping schemes.

The caching worksheet should help you to understand the three main cache mapping techniques.

Class 22: Thursday, November 10

Today's lecture notes on virtual-memory.

A worksheet to help understand virtual memory: vm-worksheet.pdf.

A C program that can provide some interesting experimentation with virtual memory: bigarray.c.

Class 23: Monday, November 14

Exam revision.

Class 24: Thursday, November 17

Exam 2.

Class 25: Monday, November 21

Today's lecture notes on I/O systems.

Over Thanksgiving, it is recommended that you do the reading and tutorials to prepare for homework 10. Specifically, you should read Chapter 1 of The Elements of Computing Systems, by Noam Nisan and Shimon Schocken. You should also read sections 1-6 of Appendix A. Both chapter 1 and Appendix A are available from the course page based on the book.

Class 27: Monday, November 28

Today's lecture notes on disk systems. Minilab: use DiskSpeed.java to estimate disk access time and transfer rate on the lab machines.

Class 28: Thursday, December 1

Today's lecture notes explaining the XOR demo for the final project.

Class 29: Monday, December 5

Exam revision handout.


Last updated: