Detailed schedule and resources for COMP251
Class 1: Tuesday, August 31
Brief introduction to syllabus.
Minilab:
- Read, then run each of the methods in CodeParadoxes.java. Make sure you
clearly understand the output you would expect from an "ideal"
computer (whatever that means!). Then make a note of the different
output that was actually produced.
- Choose one of the code paradoxes you just observed. (I recommend
choosing the infinite loop, unless you already know the answer.) By
editing, debugging, and investigating the code, see if you can come
up with an explanation resolving the paradox. If you cannot fully
explain the paradox, at least try to determine some of the
circumstances which trigger it.
We may also have time to discuss the paradox in SheepTracker.java.
Class 2: Thursday, September 2
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.5, using SmallProgram.java as a starting point.
Class 3: Tuesday, September 7
Minilab 1:
- code: unsigned.c
- to compile, use gcc -o unsigned.exe unsigned.c (ignore the warning message)
- to run, use ./unsigned.exe
- attempt the challenges given as comments in the code
Minilab 2:
- code: ascii.c
- attempt the challenges given as comments in the code
Class 4: Thursday, September 9
Discussion of Project 1. Begin work on
the project in class if time allows. Review your knowledge of big-O
notation by describing the two methods in BigODemo.java using this notation.
Class 5: Tuesday, September 14
The textbook's table 2.2 (page 63) is extremely important, but
difficult to understand. Here's my
explanation of the table.
Minilab using SignedIntExperiments.java:
- Don't try to understand the code. Skip to the
main method, and make sure you understand its output.
- Do
the challenge exercise in the comments at the end of the code.
- Now go back and try to understand the code, especially
makeBitString().
As discussed in the lecture, Java gives no warnings about integer
overflows. This
article discusses one way of adding such warnings to Java -- it
is rather advanced, and requires you to learn something about Java
byte code, but if you're interested in this kind of thing, is well
worth it.
Class 6: Thursday, September 16
Announcement: solutions to homework assignment 1 are now available
on Moodle.
Minilab code:
FloatingPointExperiments.java
Some further experiments to try at home:
- Compute (0.1+0.2)+0.3 and 0.1+(0.2+0.3) in Java. Are they the same? Explain your result.
- 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 7: Tuesday, September 21
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
SimCir, a
nifty circuit simulator by Kazuhiko Arase. Instructions:
- Download simcir.zip by clicking on the "binary" link on the SimCir page.
- If it does not unzip automatically, double-click on simcir.zip;
you should now see simcir.jar and a few other files.
- Double-click on simcir.jar.
- Create inputs A, B, C by dragging the "toggle switch" tool, then double-click to rename.
- Send some power to the inputs by dragging the "D.C. 5V" tool, and connecting it to each of the inputs.
- Create an output by dragging the "LED" tool.
- 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 8: Thursday, September 23
- See previous class for instructions on installing and using SimCir. Minilabs include (save these in separate files for later use):
- create a 1-to-2 decoder in SimCir
- create a 2-to-1 multiplexer in SimCir
- build a ripple carry adder with several digits in SimCir
- expand your decoder and multiplexer to more digits
- Some beautiful JavaScript demos
of important circuits by Ken Bigelow:
half
and full adders, multiplexer,
decoder
- circuit puzzles
Class 9: Tuesday, September 28
Peer-review of Project 1. Please bring a hard copy of your
assignment to class.
Class 10: Thursday, September 30
- An explanation of the instability
of the SR flip-flop. Also note that, in my
opinion, the first paragraph of page 134 in the
text book (the discussion of instability of the SR
flip-flop) is potentially misleading: an SR
flip-flop without a clock is perfectly stable when
S=R=1, and results in Q = Qbar =
0. It is only when we have a clock that S=R=1
becomes a problem, because immediately after the
clock cycle, the inputs S, R are killed and the
resulting state depends on which one happens to
die off first, resulting in either Q=0 or Q=1.
Please see the linked document above for a more
detailed explanation. The difference between the
first two links below should also make this
distinction clear.
- An important lesson about
clocks.
-
More circuits by Ken Bigelow:
- Please note the error on slide 50 of the
textbook authors' PowerPoint slides for chapter 3.
A corrected version is available from the PowerPoint slides
link.
- circuit puzzles
Class 11: Tuesday, October 5
An interesting experiment with word sizes: can we explain the output
of the program WordSizeExperiment.java, in terms
of the word size of the machine it is run on? Additional exercise:
add some code that performs a similar comparison of the cost of
performing arithmetic on bytes.
Class 12: Thursday, October 7
You'll need the MARIE simulator from the textbook's student resource page. Steps to create and run an assembly language program:
- run MarieSim.jar
- in simulator: File | Edit
- in editor: Type program
- in editor: File | Save [saves text file as *.mas]
- in editor: Assemble | Assemble current file [creates machine language file as *.mex]
- [optional] in editor: Assemble | Show assembly listing
- in simulator: File | Load [load the .mex file]
- in simulator: Run | Run (you can experiment with single stepping)
Here's a simple example program that adds two numbers: simpleAdd.zip. (Note: this and all the
other example assembly language files below are stored as zip files
for technical reasons. You may need to extract the file
"simpleAdd.mas" from the downloaded file "simpleAdd.zip".)
Class 13: Tuesday, October 12
Here's 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 14: Thursday, October 14
Exam 1. See the exam web page for details. Don't forget that
homework solutions are available on Moodle.
Class 15: Thursday, October 21
ZIP file of assembly language
demos for the JumpI, AddI, JnS, and Clear instructions, and a
subroutine.
Instructions for minilab:
- Download the above zip file of assembly language demos.
- Extract and open the file subDemo.mas in MARIE.
- Run the code and make sure you understand the result.
- Complete the challenge exercise given at the bottom of the code listing.
Class 16: Tuesday, October 26
Project 3 has been posted -- please read it and bring any questions
to the next class.
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.
Special homework question (label this as "class 16 homework"):
Write a MARIE assembly language program with the following
properties. There is a location labelled N storing a
positive integer n. There is a label Array marking
the start of an array containing n integers. There is a
location labelled Value storing an integer
value. There is a label Answer that will store the
answer of the computation. The program must output (i.e. store in
Anwser) the number of elements of the array which are
greater than value. The program must use the subroutine you
wrote as the solution to the textbook exercise 4.20. Important
hint: manipulating arrays in MARIE requires some special
tricks. Look carefully at arrayDemo.zip
in order to understand the techniques you will need.
Class 17: Thursday, October 28
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 IA32 instruction
set reference 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: Tuesday, November 2
Here is a C program we can use to determine the endianness of the
lab machines: endian.c.
- To compile, use gcc -o endian.exe endian.c
- To run, use ./endian.exe
A simple example of expanding
opcodes is provided. This example also demonstrates several
different addressing modes.
Class 19: Thursday, November 4
Here is a simple Java program that we can compile, then disassemble,
to understand something about Java byte code: Mult.java.
Command line for disassembling a java file: javap -c
ClassName
Class 20: Tuesday, November 9
A simple program for empirically determining cache sizes: CacheTimer.java.
Some cool results from CacheTimer.java.
Class 21: Thursday, November 11
The caching worksheet should
help you to understand the three main cache mapping techniques.
Class 22: Tuesday, November 16
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: Thursday, November 11
Exam 2. Covers classes 12-21 inclusive.
Class 24: Tuesday, November 23
Minilab options:
- Use different array sizes to understand the effect of virtual
memory on the performance of your machine, using bigarray.c.
- Predict the new time taken when recompiling this file with different values for chunkSize and numComputations in the main() method: Amdahl.java.
Class 25: Tuesday, November 30
Minilab: use DiskSpeed.java to estimate
disk access time and transfer rate on the lab machines.
Class 26: Thursday, December 2
Required reading: From the book The Elements of Computing
Systems, by Noam Nisan and Shimon Schocken, read the
publicly-available online versions
of Chapter
1
and Appendix
A (Sections 1-6 only).
Check out the Study
Plan page for more resources, such as lecture slides.
Final Project: The bulk of the last three classes will
be spent on an ungraded final project. In these classes, we will
also spend a little time doing revision for the final exam, and
mentioning one or two interesting (but non-examinable) topics in
computer architecture. The primary recommended project is Project
1 from Nisan and Schocken's Elements of Computing Systems.
All the necessary resources are available on this book's Study Plan page.
You will need to download the necessary software from the
"Software" link on that page. Then, go to the "Project 1" link and
follow the instructions there.
Project 1 concerns designing logic gates. If you're already
familiar with this topic, or perhaps you just prefer to do something
different, you might consider tackling Project 6 instead. This is a
very interesting and educational project in which you write an
assembler program for a particular instruction set. Before starting
the project, you will need to read Chapter 6 of the book (and
possibly refer back to some earlier parts of the book too). This
project is a little more challenging than Project 1.
If you enjoy these projects, why not try some of the others? They
are all extremely worthwhile and will increase the depth of your
knowledge and experience as a computer scientist. Almost all the
resources you need are provided online. In addition, you can
purchase a copy of the book, or use the copy that will soon arrive
in the Tome library.
Class 27: Tuesday, December 7
An example of self-modifying
code: self-modifying-code.zip.
The subroutine in this particular file implements an indirect store
for MARIE.
Class 28: Thursday, December 7
RAID5 example discussed in class.
Last updated: