Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2.3 (10 pts) [51 COD S$2.2, 2.3> Translate the following C language instruction to MIPS assembly language This will require multiple MIPS commands: you will

image text in transcribed

2.3 (10 pts) [51 COD S$2.2, 2.3> Translate the following C language instruction to MIPS assembly language This will require multiple MIPS commands: you will need to add, subtract, load, store, and multiply. For this problem we will use the conventional register names that we would see in real MIPS assembly code Let us try and stay within $s0-$s7 for the starting addresses for the three arrays and the indices (i, j, k). If we need temporary regisers for intermediate values, use any of the eight registers St0 through $t7 A command reference is found in Appendix A, section 10 (which is included in your zyBook) The formulas behind each command can be found in the MIPS Reference Data card (found at mips reference data.pdf in the Extras & Helpful Info folder on Google Drive. Assume that the variables have been loaded as follows into registers: Variable Register name unusedSs0 Ssl Ss2 Ss3 Ss4 Ss5 Ss6 Ss7 unused Let's go step-by-step Again the equation: For Ali a. Put the value of i in a temporary register b. Multiply it by 4 using sll and shifting left by 2 bits, store it in your temp register c. Add the result to the base address for A, in Ss5, and store it in your temp register d. Load the contents of that location from memory using using lw, and place the result in a temp register For Bli-jl a. Subtract j from i by subtracting Ss2 by Ss1. Store the result in a temp register b. Multiply it by 4 c. Add it to the starting address for array B, found in $s6 d. Load that word from memory and store in a temp register For C[k] a. Calculate k*4, add it to C's base address and store the resulting memory byte address in a temp variable b. Add the two parts from above from arrays A and B, and store in a temp register C. Store the result in the address from (a)

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

Step: 3

blur-text-image

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

Understand the use of different performance-rating techniques

Answered: 1 week ago