CSE 378, Autumn 1997 | Assignment #7 | Due: Wednesday, Dec 10th, 1997 |
You'll hand in this assignment on paper. However, we request that you use your favorite word processor, as hand-written assignments are difficult to read. Please put the section name (AA or AB) on your assignment, along with your name.
1.
Consider executing the following code on the pipelined datapath shown
in the book in Figure 6.46 (new book) or Figure 6.48 (old book).
lw $3, 0($5)
lw $4, 4($5)
add $7, $7, $3
add $8, $8, $4
add $10, $7, $8
sw $6, 0($5)
For this code fragment, rewrite the code to minimize
performance - that is, reorder the instructions so that this sequence
takes the most clock cycles to execute in our pipelined
datapath while still obtaining the same result.
2.
Consider executing the following code on the pipelined datapath shown
in the book in Figure 6.46 (new book) or Figure 6.48 (old book).
add $1, $2, $3
add $3, $4, $2
sub $5, $2, $4
and $1, $6, $3
or $5, $7, $4
3.
Consider the following code fragment:
lw $t1, 0($a0)
addu $v0, $v0, $t1
lw $t1, 4($a0)
sub $t1, $t2, $t1
addu $v0, $v0, $t1
bne $t1, $t2, lab
add $t1, $t1, $t3
add $t1, $t1, $t4
lab: sw $t1, 4($a0)
4.
Following the rules specified in the calling conventions handout,
write the procedure prologue for each of the following procedures. When
deciding on the framesize, use the minimum required space.
5.
Suppose you are implementing a procedure that takes 7 integer arguments,
and suppose that the framesize of your procedure is 44 bytes.
Assume that the caller has placed those 7 arguments according to the
calling conventions document, and that your code fragments come after
the procedure prologue (so the stack pointer has already been adjusted).