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]
2 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]2 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
Is(are) input value(s) to use with a program to test the accuracy of the output.
Law Incorporation [45]

Answer:

test cases

Explanation:

5 0
3 years ago
Read 2 more answers
Greg is the purchasing manager at a jeans-manufacturing company. He knows he could save his company money by using cheaper, thin
olasank [31]

Answer: B) Character

Explanation:

According to the question, character of Greg is depicted through the scenario as he is displaying his moral quality ,honesty and mind integrity through not providing low-quality product to his customers even though he has chance to save company money through buying shape material  .

Thus, he has good character to provide quality product and maintaining reputation and company as well as valuing his customers.                      

Other options are incorrect because fairness, community, expertise and competence are not the quality trait depicted through question's scenario. Thus, the correct option is option(B).

4 0
3 years ago
An administrator needs to set up an authentication server for users connecting to a network through a VPN. What kind of server c
nalin [4]

Answer:

RADIUS

Explanation:

RADIUS is the networking protocol that is used for the purpose of authentication to access the network resources. The full form of RADIUS is Remote Authentication Dial In User Service. It is used by different organizations, which setup their own network that can be accessible through VPN, DSL or modems through different networks. The purpose of this protocol is to establish the security and authentication mechanism by organization itself.

So, If an administrator needs to set up an authentication server for users connecting to a network through a VPN, he should establsih the RADIUS based Server.

3 0
3 years ago
ou are working as a technician on a computer loaded with MS Windows. You boot the computer that has an incorrect driver loaded f
jeka94

Answer:

My Computer>>Properties>>Device Manager>>Video Card Properties>>Drivers Tab>>Roll Back Driver.

Explanation:

The user can do so by reverting the driver to the previous  version, The correct process to do so is by the Right Clicking on the computer menu and clicking device manager from the properties. In the device manager, click the properties of the video card and select the Drivers tab. In the Drivers tab, click on the Roll Back Driver. This will restore to the previous driver.

7 0
3 years ago
The ArrayList class contains a trim method that resizes the internal array to exactly the capacity. The trim method is intended
andreev551 [17]

Answer:

public void trimToSize() {

modCount++;

if (size < elementData.length) {

elementData = (size == 0)

? EMPTY_ELEMENTDATA

: Arrays.copyOf(elementData, size);

}

}

Now, the running time for copyOf() function is O(N) where N is the size/capacity of the ArrayList. Hence, the time complexity of trimToSize() function is O(N).

Hence, the running time of building an N-item ArrayList is O(N^2).

Please find the sample code below.

CODE

==================

import java.util.ArrayList;

public class Driver {

  public static void main(String[] args) throws Exception{

      int N = 100000;

      ArrayList<Integer> arr = new ArrayList<>(N);

     

      long startTime = System.currentTimeMillis();

      for(int i=0; i<N; i++) {

          arr.add(i);

          arr.trimToSize();

      }

      long endTime = System.currentTimeMillis();

      double time = (endTime - startTime)/1000;

      System.out.println("Total time taken = " + time + " seconds.");

  }

}

Explanation:

5 0
3 years ago
Other questions:
  • Which of the following are you likely to find between multiple school buildings in a city wide school district?
    9·1 answer
  • A port is the point at which a peripheral device attaches to or communicates with a computer or mobile device. True False
    15·1 answer
  • Two types of formulas in Excel, what are they? A. Complex and simple, B. General and currency, C. Logical and Boolean, D. Trig a
    15·1 answer
  • Calculate the cash available to retire debt for each of the six months. There is cash available to retire debt if there is a cas
    8·1 answer
  • Any material that comes into contact with the body must be __________.
    6·1 answer
  • Write a procedure ConvertToBinary that takes an input as a number from 0 to 16 (including 0 but not 16) and converts it to a bin
    11·1 answer
  • Define two benefits to members of the community of replacing the printed copy with an online version.
    5·1 answer
  • The part of the computer that provides access to the internet is the
    7·1 answer
  • What is the duty of WHH? (white hat hackers)<br><br><br>ANY WHH HERE?<br>​
    8·1 answer
  • Ninety percent of the fastest-growing jobs require some kind of postsecondary education.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!