Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QI (60 points) Translate the following MIPS code snippets into C code a. (15 points) For the MIPS assembly instructions below, what is the corresponding

image text in transcribed
QI (60 points) Translate the following MIPS code snippets into C code a. (15 points) For the MIPS assembly instructions below, what is the corresponding statement? Assume that the variables f, g, h, i, and are assigned to registers SsO, Ssl, Ss2, S3, and $54, respectively. Assume that the base address of the arrays A and B are in registers Ss6 and $57, respectively. sll $t0. $50. 2 # $t0 - f + 4 add $t0. $56, $t0 # $t0 = &A[f] sli $t1,$sl. 2 # $tl = g * 4 add $ti. $97. $ti # $tl &B[9] Tw $50. 0(500) # f = A[f] addi $t2. $t0.4 lw $t0. 0($t2) add $t0,$t0,$50 SW $t0. 0($t1) b. (15 points) For the MIPS assembly instructions above, rewrite the assembly code to minimize the number if MIPS instructions (if possible) needed to carry out the same function c (15 points) Translate the following MIPS code to C. Assume that the variables f, g, h, i, and jare assigned to registers Ss0, $sl, SS2, S3, and $4, respectively. Assume that the base address of the arrays A and B are in registers Ss6 and $87, respectively. addi $t0,$87. 4 add $t1. $56. $0 SW $t1, 0($t0) Tw $t0. 0($t0) add $51. $ti. $t0 d. (15 points) Translate the following code to MIPS. Assume that the variables f, g, h, i, and jare assigned to registers $50, S1, S2, S3, and Ss4, respectively. Assume that the base address of the arrays A and B are in registers Ss6 and 8s7, respectively. Assume that the elements of the arrays A and B are 4-byte words. B[8] = A[i-]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions