Homework 1: Architecture overview, instruction sets
CSE 410, Autumn 1999
Due in class, October 4th

Reading

H+P Chapter 1, sections 1, 2, and 3. Skim the rest of chapter 1.
H+P Chapter 3, sections 1, 2, 3, and 5.

To do on your own:

H+P Exercises 1.1-1.26. Don't worry much about definitions from section 4 onward.

To turn in:

1. H+P Exercises 1.27-1.44, 1.54.

2. H+P Exercises 3.1 and 3.2. You may find the hint in the exercise below useful. In general, if you see an instruction you don't understand, Appendix A may be helpful.

3. Here is a snippet of MIPS assembly:

Here are the contents of a portion of memory before this snippet runs: Finally, here are the values in some of the registers before this snippet runs: Trace through the code. Each time you reach the "j start" line, write down the contents of memory and all used registers. What does the program do? Hint: the "addi" instruction is just like "add" except it allows you to add in a small constant directly rather than specifying a register.

Extra credit: Write two C snippets that would compile down to this assembly. For the first one, translate line-by-line. For the second, write more natural C, which achieves the same effect as this code while observing standard C idioms. Which do you think is more likely to come out of an automatic translation program? Which is more useful to a human?