In: Computer Science
Variable Register a $9 b $19 c $2
C Operators + add - subtract & bitwise and ! bitwise or ~ bitwise not
Assume the variables, a, b and c are stored in the registers given above. Give a single MIPS assembly instruction from the MIPS Core Instruction Set that performs the equivalent operation for each of the following C
statements. a = ~ ( b | c ); // MIPS equivalent: --------
c = b - 2; // MIPS equivalent: ----------
b = a & 0x100F; // MIPS equivalent:----------
)
1.a=~(b|c)
lw $3,4($fp)
lw $2,8($fp)
or $2,$3,$2
nor $2,$0,$2
sw $2,0($fp)
2.c=b-2
lw $2,4($fp)
addiu $2,$2,-2
sw $2,8($fp)
3.b = a & 0x100F
lw $2,0($fp)
andi $2,$2,0x100f
sw $2,4($fp)