Question: [6] The following problems deal with translating from C to MIPS. Assume that the variables f, g, h, i, and j are assigned to registers

 [6] The following problems deal with translating from C to MIPS.Assume that the variables f, g, h, i, and j are assigned

[6] The following problems deal with translating from C to MIPS. Assume that the variables f, g, h, i, and j are assigned to registers $0, $sl, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $87, respectively. Assume that the elements of the arrays A and B are 4-byte words: f = f + A[2]; b. B[8] A[i] + A[j]; a. = For the statements above, what is the corresponding MIPS assembly code? [7] For these problems, the table holds various binary values for register $t0. Given the value of $t0, you will be asked to evaluate the outcome of different branches. a. b. Ox00101000 Ox80001000 Suppose that register $t0 contains a value from above. What is the value of $t2 after the following instructions? slt $t2, $0, $to bne $t2, $0, ELSE j DONE ELSE: addi $t2, $t2, 2 DONE: [8] Assume that the variables f, g, h, i, and j are assigned to registers $s0, $sl, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $6 and $s7, respectively. (a) What is the corresponding MIPS assembly code For the statement: f = g - A[3] + B[4]; (b) What is the corresponding C statement? For the MIPS assembly instructions lw $so, 4($56) [1] Provide the type, assembly language instruction, and binary representation of instruction described by the following MIPS fields: op=0, rs=3, rt=2, rd=3, shamt=0, funct=34 [2] Provide the type, assembly language instruction, and binary representation of instruction described by the following MIPS fields: op=0x23, rs=1, rt=2, const=0x4 [3] Assume that registers $80 and $sl hold the values 0x80000000 and OxD0000000, respectively. (a) What is the value of $t0 for the following assembly code? add $t0, $50, $s1 (b) For the contents of registers $80 and $sl as specified above, What is the value of $t0 for the following assembly code? sub $t0,$50, $s1 (c) For the contents of registers $50 and $sl as specified above, What is the value of $t0 for the following assembly code? add $t0, $50, $s1 add $t0,$t0, $50 [4] Assume the following register contents: $t0 = OxAAAAAAAA, $t1 = 0x12345678. For the register values shown above, what is the value of $t2 for the following sequence of instructions? (a) slti $t2, $to, 4 $t2, $t2, $t1 (b) sll $t2, $t0, 4 andi $t2, $t2, -1 or [5] The following problems deal with translating from C to MIPS. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $sl, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively. What is the corresponding MIPS assembly code? a. f = -g - A[4]; B[8] A[i-j]; b. = [6] The following problems deal with translating from C to MIPS. Assume that the variables f, g, h, i, and j are assigned to registers $0, $sl, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $87, respectively. Assume that the elements of the arrays A and B are 4-byte words: f = f + A[2]; b. B[8] A[i] + A[j]; a. = For the statements above, what is the corresponding MIPS assembly code? [7] For these problems, the table holds various binary values for register $t0. Given the value of $t0, you will be asked to evaluate the outcome of different branches. a. b. Ox00101000 Ox80001000 Suppose that register $t0 contains a value from above. What is the value of $t2 after the following instructions? slt $t2, $0, $to bne $t2, $0, ELSE j DONE ELSE: addi $t2, $t2, 2 DONE: [8] Assume that the variables f, g, h, i, and j are assigned to registers $s0, $sl, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $6 and $s7, respectively. (a) What is the corresponding MIPS assembly code For the statement: f = g - A[3] + B[4]; (b) What is the corresponding C statement? For the MIPS assembly instructions lw $so, 4($56) [1] Provide the type, assembly language instruction, and binary representation of instruction described by the following MIPS fields: op=0, rs=3, rt=2, rd=3, shamt=0, funct=34 [2] Provide the type, assembly language instruction, and binary representation of instruction described by the following MIPS fields: op=0x23, rs=1, rt=2, const=0x4 [3] Assume that registers $80 and $sl hold the values 0x80000000 and OxD0000000, respectively. (a) What is the value of $t0 for the following assembly code? add $t0, $50, $s1 (b) For the contents of registers $80 and $sl as specified above, What is the value of $t0 for the following assembly code? sub $t0,$50, $s1 (c) For the contents of registers $50 and $sl as specified above, What is the value of $t0 for the following assembly code? add $t0, $50, $s1 add $t0,$t0, $50 [4] Assume the following register contents: $t0 = OxAAAAAAAA, $t1 = 0x12345678. For the register values shown above, what is the value of $t2 for the following sequence of instructions? (a) slti $t2, $to, 4 $t2, $t2, $t1 (b) sll $t2, $t0, 4 andi $t2, $t2, -1 or [5] The following problems deal with translating from C to MIPS. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $sl, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively. What is the corresponding MIPS assembly code? a. f = -g - A[4]; B[8] A[i-j]; b. =

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!