Computer Organization & Design 2. EditionThese are my solutions for some of the exercises of Computer Organization & Design 2. Edition by David A. Patterson and John L. Hennessy. All of them were made by me, with no guarantee whatsoever. They could all be flawed, incomplete, etc., but I still hope that they are useful, correct and understandable. Usage is unlimited, but don't use them for cheating by claiming that you made them yourself, your instructor could be smarter than you think ... Please note that all of the files here may not show correctly in Notepad, because of Unix linebreaks. Please use any other editor that just works (vim, gvim, kwrite, kate, smarteditor, emacs, whatever).
|
| Exercise | link | file type | remarks |
|---|---|---|---|
| Exercise 3.1 | show | C source | C equivalent of given asm source. |
| Exercise 4.29 | show | C source | Shows bit representation of float in hex. |
| Exercise 4.30 | show | C++ source | Shows bit representation of float in hex. |
| Exercise 7.13 | show | C++ source | Helper progr. to determine the right answer. |
| Exercise 7.18 | show | C++ source | Helper progr. to determine the right answer. |
| Exercise 7.19 | show | C++ source | Helper progr. to determine the right answer. |
| Exercise 7.45 | show | C++ source | Small experiment to determine the order of array elements in mem in C/C++. |
| Exercise 8.13 | show | OpenOffice.org Calc doc. | Solution to exercise. |
| Exercise 8.14 | show | OpenOffice.org Calc doc. | Solution to exercise. |
| Exercise 8.24 | show | MIPS asm source (run with (X)SPIM) | Solution to exercise. |
| Exercise 8.25 (notes) | show | remarks | Some debug output of XSPIM I needed. |
| Exercise 8.25 (pseudo) | show | pseudocode | C-Style pseudocode as preparation for 'the real thing' (MIPS asm). |
| Exercise 8.25 | show | MIPS asm source (run with (X)SPIM) | Solution to exercise. |
| Exercise 8.26 (notes) | show | remarks | Memory positions and other infos I needed for debugging. |
| Exercise 8.26 | show | MIPS asm source (run with (X)SPIM) | Solution to exercise. |
| Exercise A.2 (original) | show | MIPS asm source (run with (X)SPIM) | Original source. |
| Exercise A.2 (shorter) | show | MIPS asm source (run with (X)SPIM) | Shorter version (solution to exercise). |
| Exercise A.6 | show | MIPS asm source (run with (X)SPIM) | Solution to exercise. |
| Exercise A.7 | show | MIPS asm source (run with (X)SPIM) | Solution to exercise. |
| Exercise A.8 | show | MIPS asm source (run with (X)SPIM) | Solution to exercise. |
| Exercise A.9 | show | MIPS asm source (run with (X)SPIM) | Solution to exercise. |
| Exercise A.10 | show | MIPS asm source (run with (X)SPIM) | Solution to exercise. |
| Exercise A.10 | show | C source | Plays towers of hanoi. |
Please note that 'range' doesn't mean that all exercises in between are completely present, there may be gaps.
| Chapter | link | range (first solution) | range (last solution) |
|---|---|---|---|
| 4 | show | Exercise 4.12 | Exercise 4.41 |
| 5 | show | Exercise 5.1 | Exercise 5.36 |
| 6 | show | Exercise 6.1 | Exercise 6.29 |
| 7 | show | Exercise 7.1 | Exercise 7.45 |
| 8 | show | Exercise 8.1 | Exercise 8.24 |
| A | show | Exercise A.1 | Exercise A.9 |
| C | show | Exercise C.2 | Exercise C.7 |
I've written a short paper about some quirks with XSPIM, some things to know about exception handlers, etc. Probably quite useful: XSPIM_quirks.html.
What could also come handy for some of the exercises: I've written a simple PHP script that takes a hex-dump of a floating point number (32 and 64 bit only at present), analyses it and shows the semantic of the different bits. You can enter the hex dump here, and download the source code here.
Only available in German at the moment, but the usage is extremely straightforward: Just paste the hex dump in the upper field (for example: ABCDEF01), select the endian-ness in the lower field (MIPS is big endian), and push the button. The result should be understandable even if you don't speak a single German word. The most interesting statements are the colored bit dump (red=sign bit, green=exponent bits, blue=mantissa bits) and the final result (in bold).