1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Yuki888 [10]
3 years ago
14

convert the following c code to mips. assume the address of base array is associated with $s0, n is associated with $s1, positio

n is associated with $t0, c is associated with $t1, d is associated with $t2, and swap is associated with $t3 for (c
Computers and Technology
1 answer:
Brums [2.3K]3 years ago
7 0

Answer:

Explanation:

hello we will follow a step by step process for this code, i hope you find it easy.

Mips Equivalent code:

  sw      $0,0($fp)

.L7:

       lw      $2,12($fp)

       addiu   $2,$2,-1

       lw      $3,0($fp)

       slt     $2,$3,$2

       beq     $2,$0,.L2

       nop

       lw      $2,0($fp)

       sw      $2,8($fp)

       lw      $2,0($fp)

       addiu   $2,$2,1

       sw      $2,4($fp)

.L5:

       lw      $3,4($fp)

       lw      $2,12($fp)

       slt     $2,$3,$2

       beq     $2,$0,.L3

       nop

       lw      $2,8($fp)

       dsll    $2,$2,2

       daddu   $2,$fp,$2

       lw      $3,24($2)

       lw      $2,4($fp)

       dsll    $2,$2,2

       daddu   $2,$fp,$2

       lw      $2,24($2)

       slt     $2,$2,$3

       beq     $2,$0,.L4

       nop

       lw      $2,4($fp)

       sw      $2,8($fp)

.L4:

       lw      $2,4($fp)

       addiu   $2,$2,1

       sw      $2,4($fp)

       b       .L5

       nop

.L3:

       lw      $3,8($fp)

       lw      $2,0($fp)

       beq     $3,$2,.L6

       nop

       lw      $2,0($fp)

       dsll    $2,$2,2

       daddu   $2,$fp,$2

       lw      $2,24($2)

       sw      $2,16($fp)

       lw      $2,8($fp)

       dsll    $2,$2,2

       daddu   $2,$fp,$2

       lw      $3,24($2)

       lw      $2,0($fp)

       dsll    $2,$2,2

       daddu   $2,$fp,$2

       sw      $3,24($2)

       lw      $2,8($fp)

       dsll    $2,$2,2

       daddu   $2,$fp,$2

       lw      $3,16($fp)

       sw      $3,24($2)

.L6:

    lw      $2,0($fp)

       addiu   $2,$2,1

       sw      $2,0($fp)

       b       .L7

        nop

cheers  i hope this helps

You might be interested in
Which of the following is the fundamental unit of the virtualized client in an IaaS deployment? a)Workload b)Workspace c)Work un
forsale [732]

Answer:

a. Workload

Explanation:

The most fundamental unit of the virtualized client in an IaaS deployment is the workload because it simulates the potential of a certain server to perform a specific amount of work given.

6 0
3 years ago
If a while loop iterates forever,what is the most likely cause?
miv72 [106K]

Answer:

Runtime error probably. The program won't make it past the while loop in the code.

5 0
2 years ago
Please help!!!!!!! 50 POINTS!!!!
mrs_skeptik [129]

Answer:

A,D,C,B are the correct answers

Explanation:

Hope this helps:)

3 0
3 years ago
Cell address A4 in a formula means it is a _________Mixed cell reference
WITCHER [35]

Answer:

A. Relative cell reference.

Explanation:

A relative cell reference is like a pointer to a cell or range of cell in Excel. In Excel all cell references, by default, are relative cell references.

In the given instance, the cell address A4 in a formula means it is a relative cell reference. If there would have been a $ sign before A4, then it will be an absolute cell reference. But since, it is without dollar sign, it is a relative cell reference.

Therefore, option A is correct.

4 0
3 years ago
Write a program to enter a number and test if it is greater than 45.6. If the number entered is greater than 45.6, the program n
WARRIOR [948]

Answer:

#include <iostream>

using namespace std;

int main ()

{

 float number = 0.0;

 float check = 45.6;

 cout << "Enter Numeber";

 cin >> number;

 if (number > check)

   {

     cout << " Greater than 45.6" << endl;

   }

 else

   {

     cout << " Lesser than 45.6" << endl;

   }

 return 0;

}

Explanation:

declare and initialize float type variable number. Float is used to cater for decimal but not using to much space which is used by double data type. Check value is stored in other variable called check.

Take input from user in number and write an if statement to check whether entered number is less than 45.6 or greater.If number is lesser than check display message "Greater than 45.6" other wise display message "Lesser than 45.6"

5 0
4 years ago
Other questions:
  • If your vehicle leaves the pavement for any reason, remember to take your foot off the gas pedal, hold the wheel firmly, and
    12·2 answers
  • Text that does not fit in a cell
    7·1 answer
  • A comma is also called a statement terminator. A. True B. False
    8·1 answer
  • ​Microsoft claims that the microsoft project software can _____.
    11·1 answer
  • Explain how you would insert graphics using your word-processing software.
    14·1 answer
  • Zahra's softball team needs money for team T-shirts. The coach makes some fundraising suggestions, while team members brainstorm
    5·2 answers
  • 1. Write an application that throws and catches an ArithmeticException when you attempt to take the square root of a negative va
    11·1 answer
  • Solving Systems of Equations by Substitution <br> pdf
    11·1 answer
  • Match the parts of a CPU to their functions. Thanks in advance.
    7·1 answer
  • In your own words, describe invention.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!