1048 Computer Organization

學號:
姓名:
1048 Computer Organization
Quiz 1
1. Let’s assume that A is an array of 100 words and that the compiler has associated
the variables f, g, h, i, and j with the registers $s1, $s2, $s3, $s4, and $s5
respectively. Let’s also assume that the starting address, or base address, of the
array is in $s6. Please compile the following C code into MIPS assembly code:
f=(g+h)-(i+j);
g=h+A[8];
if (f==h) A[12] = h + A[8]; else A[12] = h - A[8];
2. Please translate the above MIPS assembly instructions into machine instructions
(a). First interpret the machine instruction as a combination of decimal numbers
(b). Then translate the first two instructions as combinations of binary numbers