bne offset = 2 (add and j sit between bne and Else).
M.5Convert sub $s0,$s1,$s2 to machine code. (opcode 000000, funct 100000, as given.)
sub $s0, $s1, $s2
rs=$s1=17, rt=$s2=18, rd=$s0=16. (This exam sets subβs funct = 100000; the standard MIPS value is 100010 β always use the value the question supplies.)
M.6Address of the last byte and last word in MIPS-32.
232 bytes total. Last byte = 232β1. Words are 4 bytes and aligned, so last word = 232β4.
M.7Address of the last word in MIPS-64 (everything similar to MIPS-32).
Scaling the MIPS-32 relationship (address width = word width): 64-bit addresses, word = 8 bytes. Last byte = 264β1; last word = 264β8. (If the word is kept at 4 bytes, last word = 264β4 β state the assumption.)
M.8Max value of offset in lw $s1,offset($s2), and the machine instruction for it.
Offset is a signed 16-bit field β max = 215β1=32767.
lw $s1, 32767($s2)
M.9beq $s0,$s1,Label with PC=200, $s0=$s1=8, offset=1. New PC?
Equal β taken. PC=(200+4)+4Γ1=208. If not taken, PC = 204.