Name: Box: Date:
(6 points) Convert the following C code to MIPS assembly instructions. Use the minimum number of instructions necessary. Assume that variables f, g and h are 32- bit integers stored in registers
$t2respectively and that the base address of arrays A and B are in registers
$s4respectively. A and B are arrays of 4-byte integers (this is important). If you need to store temporary values, use one of the other t registers.
f = 1; A[f] = 0;
B = A[f-5];
(4 points) Show the hexadecimal representation of the following MIPS instructions. Show your work.
addi $s0, $s0, 4
lw $s1, 8($t0)
(5 points) Consider changing the MIPS instruction set to support 64 registers instead of 32. Assuming changes are made only to the register fields, draw the new R-type instruction format. Be sure to label each field and include its size.
(5 points) How many total instructions does MIPS support if opcode
000000is the only opcode used for R-types? Remember that R-types also use a function code.