Uploaded by Ryan A

CMPS255 - Assignment 1

advertisement
CMPS255 Assignment 1
Exercise 1.
Translate the following C code to MIPS and write the necessary comments beside your
instructions code to explain them.
k= 2*(A[i] + B[j] + 1);
Assume that the variables i, and j and k are assigned to registers $s2, $s3, and $s4, respectively.
Assume that the base address of the arrays A and B are in registers $s5 and $s6, respectively.
Assume that the elements of the arrays A and B are 4-byte words.
Note: use the shift left (sll) for the multiplication.
Exercise 2.
Consider the register $t2 to hold the value of 0X00F0FFFF.
a- What is the value of register t2 in binary?
b- What is the value of register t2 in binary and hexa-decimal after the executing following
MIPS instructions?
sll $t2, $t2, 2
nor $t1, $t2, $t2
Download