Question
Question 2: a) Translate the following C code to MIPS. Assume f, g, h, i and j are assigned to registers $1, $2, $3, $4,
Question 2:
a) Translate the following C code to MIPS. Assume f, g, h, i and j are assigned to registers $1, $2, $3, $4, $5
f = g + h; i = j - 3; j = j & 0xFFFE; g = h - j;
b) For the following two MIPS instructions, show the value of the opcode, rs rt rd and immediate fields as appropriate for that type of instruction (R- or I-type).
addi $7, $9, 4 add $18, $9, $0
c) Assume for the following instructions, variable A is assigned to register $18, B is assigned to $19, x is assigned to $7 and y is assigned to $9. Translate the three instructions into C code.
addi $7, $9, 4 add $18, $9, $0 add $19, $7, $18
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started