Computer Organization and Design: The Hardware/Software Interface, Patterson and Hennessy, 3rd Edition.
There will be 5 homeworks. Each will contribute 4% to the final grade for the course (i.e. all five homeworks combined will constitute 20% of your final grade).
Week | Assigned | Due |
1 | ||
2 | Homework 1 (Apr-10) | Homework 1 (Apr-16, 5:00 PM) |
3 | Homework 2 (Apr-17) | |
4 | Homework 2 (Apr-28, 5:00 PM) | |
5 | Homework 3 (May-1) | |
6 | Homework 3 (May-12, 5:00 PM) | |
7 | Homework 4 (May-15) | |
8 | Homework 4 (May-26, 5:00 PM) | |
9 | Homework 5 (May-29) | Homework 5 (Jun-2, 5:00 PM) |
10 |
Your homeworks must represent your original work and must be developed completely independently by each one of you. Copying from any sources (web, other books, past or current students, etc.) is strictly prohibited. No cooperation, discussion, sharing, exchange or consultation between the students themselves is allowed. This, of course, does not apply to any discussions taking place during the lectures under the supervision of the instructor.
You can report cheating anonymously at: https://www.cs.ucr.edu/cheating/.
Students violating this policy will be given a failing grade for the course and their case will be referred to the office of Vice-Chancellor for Student Affairs. On the other hand, students are strongly encouraged to cooperate and consult each other in preparation for the exams.
A class mailing list: cs161@lists.cs.ucr.edu will be established to disseminate information pertaining to this class. Make sure to sign-up for the mailing list in order to receive prompt information about class assignments, additional resources and other pertinent matters.
You can sign up for it at: https://www.cs.ucr.edu/mailman/listinfo/cs161
IMPORTANT: only UCR e-mail addresses will be allowed on the list!
while (save[i]==k) i = i + j;with i, j, and k corresponding to registers
$s3
, $s4
, and
$s5
, and the base of the array save
in $s6
, is:
Loop: add $t1, $s3, $s3 # Temp reg $t1 = 2 * i add $t1, $t1, $t1 # Temp reg $t1 = 4 * i add $t1, $t1, $s6 # $t1 = address of save[i] lw $t0, 0($t1) # Temp reg $t0 = save[i] bne $t0, $s5, Exit # go to Exit if save[i] != k add $s3, $s3, $s4 # i = i + j j Loop # go to Loop Exit:This translation uses both a conditional branch and an unconditional jump each time through the loop. Only poor compilers would produce code with this loop overhead. Rewrite the assembly code so that it uses at most one branch or jump each time through the loop. How many instructions were executed before and after the optimization if the number of iterations of the loop is 10? (25 points)