Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A.) Please translate the following C code into MIPS. Also put comments in each line of MIPS // $s0 -> int *p = intArrary; //

A.) Please translate the following C code into MIPS. Also put comments in each line of MIPS

// $s0 -> int *p = intArrary;

// $s1 -> a

P[0] = 0;

int a = 2;

p[1] = a;

p[a] = a;

B.) Please explain what does this MIPS code do?

addi $s0, $0, 0

addi $s1, $0, 1

addi $t0, $s0, 50

loop: beq $s0, $t0, done

add $s1, $s1, $s1

addi $s0, $s0, 2

j loop

done:

C.) Please describe in one sentence what this code does. Assume that $a0 and $a1 are used for input and both initially contain the integers a and b, respectively. Assume that $v0 is used for the output. Also, convert this MIPS code to C & add comments to the code.

add

$t0, $zero, $zero

loop:

beq

$a1, $zero, finish

add

$t0, $t0, $a0

sub

$a1, $a1, 1

j

loop

finish:

addi

$t0, $t0, 100

add

$v0, $t0, $zero

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_2

Step: 3

blur-text-image_3

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

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

Give three examples of categorical data.

Answered: 1 week ago

Question

1.what is the significance of Taxonomy ?

Answered: 1 week ago

Question

What are the advantages and disadvantages of leasing ?

Answered: 1 week ago

Question

Name is needed for identifying organisms ?

Answered: 1 week ago