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
11Alexandr11 [23.1K]
3 years ago
5

For the following MIPS code write the C equivalent: The following code fragment processes two arrays and produces an important v

alue in register $v0. Assume that each array consists of 2500 words indexed 0 through 2499, that the base addresses of the arrays are stored in $a0 and $a1 respectively, and their sizes (2500) are stored in $a2 and $a3 , respectively. Add comments to the code and describe in one sentence what this code does. Specifically, what will be returned in $v0 ? Also, convert this MIPS code to C (you may find it easier to understand if you do this first!).
Computers and Technology
1 answer:
mestny [16]3 years ago
8 0

Answer:

//get size of array one

int size1 =2500; // sll $a2,$a2,2

int array1[size1];

//get size of array two

int size2 = 2500; // sll $a3,$a3,2

int array2[size2];

int v0=0 ; // $v0,$zero,$zero

int t0 = 0; //$t0,$zero,$zero

do{ //outer:

//add $t4,$a0,$t0

//lw $t4,0($t4)

int t4 = array1[t0];

int t1 = 0; //$t1,$zer0,$zer0

do{

//add $t3,$a1,$t1

//lw $t3,0($t3)

int t3 = array2[t1];

if(t3==t4){ //bne $t3,$t4,skip

v0 = v0+1; //addi $v0,$v0,1

}

//skip:

t1 = t1+1; //addi $t1,$t1,4

}while(t1!=size2);

t0 = t0+1; //addi $to,$to,4

}while(t0!=size1);

return 0;

Given code loops through the two array. It will count the number of duplicates found in both array.

You might be interested in
Look at the following structure declaration.
myrzilka [38]

Answer:

B. a tag

Explanation:

In the structure definition given below:

struct Employee

{

string name;

int idNum;  

};

Employee corresponds to the tag of the structure. The tag is used to create additional instances of the structure. For example:

struct Employee e1;

struct Employee e2;

name and idNum are members of the Employee structure and are referenced using the dot notation. e.g.,

struct Employee e1;

e1.idNum=1;

7 0
3 years ago
Who wants to give free points to me?
Bad White [126]

Answer:

I can :) just comment lol

3 0
3 years ago
Read 2 more answers
_________ is a society organized with the purpose of rendering service to its members and to the public in general.
sesenic [268]

Answer:

cooperate society

Explanation:

A cooperative society is a voluntary association that started with the aim of the service of its members.

8 0
2 years ago
Whoever understands this first and replies will be the brainliest.<br><br><br><br> Road work ahead?
Scorpion4ik [409]

I SURE HOPE IT DOES (this is the best vibe if you dont get this you are an uncultured swine)

7 0
3 years ago
Read 2 more answers
Which tab on the Ribbon contains the command to add a new, blank page to a publication?
aleksklad [387]

It's Insert. Insert > Page > Insert Page

4 0
2 years ago
Other questions:
  • Write a Java application that inputs a series of 10 integers and determines and prints the largest and smallest integer. Use a c
    12·1 answer
  • To prevent rust from forming, a light coating of_____should be applied to all machined surfaces
    8·1 answer
  • What are the five types of alignment in Word?
    12·2 answers
  • Before a program written in c can be executed on a computer, what step is required to be done first?
    7·1 answer
  • JAVA QUESTION::
    10·1 answer
  • Question :
    6·1 answer
  • What is the answer???​
    6·1 answer
  • The average pH of citrus fruits is 2.2, and this value has been stored in the variable avg_citrus_pH . Provide a statement to di
    15·1 answer
  • How are most databases organized?
    15·1 answer
  • Which of the following is not considered essential for an electronic device to be called a computer?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!