Cpre305 Homework #4


Reading Assignment: Chapter 3 (see notes on what we covered in detail), Chapter 4.1 to 4.4, and Appendix A


P1. (5 points) Chapter 3, Problem 3.5.
P2. (5 points) Chapter 3, Problem 3.7.
P3. (10 points) Chapter 3, Problem 3.19. Read material on Page 201 and 202.
P4. (20 points) Chapter 3, Problem 3.25. Code each instruction in MIPS machine language format (by providing value of each field in binary, hex or decimal).
P5. (10 points) There are six relative conditions between the values of two registers. Assuming that variable i corresponds to register $19 and variable j corresponds to $20, show the MIPS code for the condition corresponding to the following C codes. Notice that MIPS does not provide all types of branch instructions.

(a) if (i == j) go to L1;
(b) if (i != j) go to L1;
(c) if (i < j) go to L1
(d) if (i <= j) go to L1
(e) if (i > j) go to L1;
(f) if (i >= j) go to L1;

P6. (5 points) Chapter 4, Problem 4.9.
P7. (5 points) Chapter 4, Problem 4.11.
P8. (10 points) Chapter 4, Problem 4.13.
P9. (10 points) Chapter 4, Problem 4.17.
P10. (10 points) Chapter 4, Problem 4.18.
P11. (10 points) Chapter 4, Problem 4.20.