This is a test of my mailing list for CS 2321. No need to reply, but I'll be asking in class whether everyone received this message.
There's a small error in the solution to problem 3.11 distributed in class today. Near the end of my sample solution code is the line: slti $t1, $t0, 101 # i < 101? It should read slti $t1, $t0, 100 # i < 100?
(I guess the moral of the story is that even experienced programmers make off-by-one errors when they're writing code in too big a hurry, as I was with this solution. I discovered the mistake by doing a short test with the simulator.)
The solution to problem 3.7 mentions that it's not clear what the proper value for the "immediate" field of the "bne" instruction should be. I assembled this code on a real MIPS machine (Puck) and looked at the result, and it appears that the "right" answer is -6 (offset from *next* instruction to branch target, divided by 4).
Additional experiments on Puck indicate that the address in a "jump" instruction represents an absolute address divided by 4.
FYI. For the purposes of grading homework 3, I'll accept any answer for which there is some justification (e.g., textbook's example).
A correction to the correction: The original solution to problem 3.11 was correct -- you do in fact want to continue the loop as long as the loop counter is less than *or equal to* 100, not strictly less than 100 as my previous would-be correction claimed. The moral of *this* story is that it's a good idea to read the problem carefully; I somehow misread the loop as "for (i=0; i<100; i=i+1)", assuming that the array was of size 100 (a nice round number).
Apologies for any confusion.
One more correction to that final problem (as mentioned in class today, but I thought I'd send e-mail so I have a record of the correction): The counts of instructions executed and memory references are also off; the number of instructions executed should be 1011, and the number of memory references should be 202.
As mentioned in class, it turns out that the last problem in homework 4 is more difficult than I thought, so I've replaced it with an easier problem. Please see the updated version on the Web -- I sketched the problem on the board in class today, but I think I did so in a way that duplicates one of the textbook's examples, which was not my intent. The version on the Web should be correct.
-- blm
P.S. Anyone who prefers to do the originally-assigned problem (4.54 in the textbook) is welcome to do so for extra credit. But it really is a pretty tough problem.
By consent of all present in class today, the date of exam 2 is being changed from April 10 (Wednesday) to April 12 (Friday). I'll update the syllabus to reflect the change.