Question

Translate one array operation from C to ASM: a = b * X[Y[2]], where assume X[]...

Translate one array operation from C to ASM: a = b * X[Y[2]], where assume X[] is from the memory address $s0; Y[] is from the memory address $s1; (ASM will use the least number of registers as needed)

Homework Answers

Answer #1

Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate the question. Thank You So Much.

#address of X is in $s0
#address of Y is in $s1
#also s2 is representing a
#also s3 is representing b
lw $t0,8($s1) #load Y[2]
mul $t0,$t0,4 #get address of Y[2]
add $t0,$t0,$s0 #get address of X[Y[2]]
mul $s0,$1,$t0 # a = b*X[Y[2]]


Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
This is a homework assignment for Computer Architecture and some question use MIPS Assembly language. 1.    ...
This is a homework assignment for Computer Architecture and some question use MIPS Assembly language. 1.     In the following MIPS assembly code, translate all the instructions to their corresponding machine code in hexadecimal format. This code is stored in the memory from address 0x1fff0000. Loop: sw $t1, 4($s0)        addi $t1, $t1, -1    sll $t1, $t1, 2        bne $t1, $s5, Exit    addi $s0, $s0, 4          j Loop Exit: … 2.     Find the MIPS...
2. (7 pts) Translate the following block of C code to MIPS assembly: if (i >...
2. (7 pts) Translate the following block of C code to MIPS assembly: if (i > 10) MemArray[i] = 0; else MemArray[i] = - MemArray[i]; Assume that the variable i is bound to register $t0, and that the base address of array MemArray is in register $s0.
. Assume that X={B,D,C,A} and Y={6,7,1}. A code consists of 2 different symbols selected from X...
. Assume that X={B,D,C,A} and Y={6,7,1}. A code consists of 2 different symbols selected from X followed by 2 not necessarily different symbols from Y. How many different codes are possible?
Evaluate the line integral R C (x 2 + y 2 ) ds where C is...
Evaluate the line integral R C (x 2 + y 2 ) ds where C is the line segment from (1, 1) to (2, 5).
Homework #2 Find the point (a, b, c) where the line x = 1-t, y =...
Homework #2 Find the point (a, b, c) where the line x = 1-t, y = t, z = 1 + t and the plane 2x-y + z = 1 intersect. Write the value of a + b + c Choose the correct answer: a)-1 b)3 c)2 d)1 e)other
maximize B=xy^2,where x and y are positive numbers such that x+y^2=11
maximize B=xy^2,where x and y are positive numbers such that x+y^2=11
Use the Chain Rule to evaluate the partial derivative ∂g/∂u at the point (u,v)=(0,1), where g(x,y)=x^2−y^2,...
Use the Chain Rule to evaluate the partial derivative ∂g/∂u at the point (u,v)=(0,1), where g(x,y)=x^2−y^2, x=e^3ucos(v), y=e^3usin(v). (Use symbolic notation and fractions where needed.)
(a) Write a function in C++ called readNumbers() to read data into an array from a...
(a) Write a function in C++ called readNumbers() to read data into an array from a file. Function should have the following parameters: (1) a reference to an ifstream object (2) the number of rows in the file (3) a pointer to an array of doubles The function returns the number of values read into the array. It stops reading if it encounters a negative number or if the number of rows is exceeded. (b) Write a program with the...
The joint PDF of X and Y is given by fX,Y(x, y) = c exp {-2/3(x^2...
The joint PDF of X and Y is given by fX,Y(x, y) = c exp {-2/3(x^2 + xy + y^2 )} (a) Find c and the correlation coe?cient of X and Y . (b) Find the best least square estimator of Y based on X.
Let the random variable X and Y have the joint pmf f(x, y) = xy^2/c where...
Let the random variable X and Y have the joint pmf f(x, y) = xy^2/c where x = 1, 2, 3; y = 1, 2, x + y ≤ 4 , that is, (x, y) are {(1, 1),(1, 2),(2, 1),(2, 2),(3, 1)} . (a) Find c > 0 . (b) Find μX (c) Find μY (d) Find σ^2 X (e) Find σ^2 Y (f) Find Cov (X, Y ) (g) Find ρ , Corr (X, Y ) (h) Are X...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT