Write the corresponding MIPS assembly equivalent of the given pseudo code. Assume that register Ss0...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write the corresponding MIPS assembly equivalent of the given pseudo code. • Assume that register Ss0 contains the base address for array arr. • Use a register for each of the variables. (e.g. use $s1 for total, etc.) and indicate them as a comment line in your code. i=0, s= 10; total, ps, ng; arr [10] = {3, -21, 18, 0, 16, 85, -44, 23, 100, -20); total= 0; ps = 0; ng = 0; do { total = total + [arr[i]; if (arr[i] > 0) i++; if (arr[i] < 0) } while ( ps ps+arr[i]; H. = ng = ng + arr[i]; <s) Write the corresponding MIPS assembly equivalent of the given pseudo code. • Assume that register Ss0 contains the base address for array arr. • Use a register for each of the variables. (e.g. use $s1 for total, etc.) and indicate them as a comment line in your code. i=0, s= 10; total, ps, ng; arr [10] = {3, -21, 18, 0, 16, 85, -44, 23, 100, -20); total= 0; ps = 0; ng = 0; do { total = total + [arr[i]; if (arr[i] > 0) i++; if (arr[i] < 0) } while ( ps ps+arr[i]; H. = ng = ng + arr[i]; <s)
Expert Answer:
Answer rating: 100% (QA)
The provided pseudo code is performing a loop over an array and summing the elements to a total vari... View the full answer
Related Book For
Computer Organization and Design The Hardware Software Interface
ISBN: 978-0124077263
5th edition
Authors: David A. Patterson, John L. Hennessy
Posted Date:
Students also viewed these programming questions
-
Chiquita should be given the civil death penalty and be put out of business for the actions that took place Chiquita did not have to be involved with giving money to this group and did not think of...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
North Folk Dairy has an unused bank revolving credit of $50 million. North Folk Dairys vendor provided an invoice in the amount of $100,000 with payment terms of 2/10, net 45. Compute the nominal...
-
On January 5, 2019, Phelps Corporation received a charter granting the right to issue 5,000 shares of $100 par value, 8% cumulative and non-participating preference shares, and 50,000 shares of $10...
-
Explain intuitively why any normal good cannot possibly be a Giffen good. (You may wish to illustrate your answer with a budget line/indifference curve graph.)
-
Political expectations, inflation, and unemployment Consider a country with two political parties, Democrats and Republicans. Democrats care more about unemployment than Republicans, and Republicans...
-
Valdespin Company manufactures three sizes of camping tentssmall (S), medium (M), and large (L). The income statement has consistently indicated a net loss for the M size, and management is...
-
Part A Learning Goal: To understand that the charge stored by capacitors represents energy; to be able to calculate the stored energy and its changes under different circumstances. An air-filled...
-
Figure E3.3 shows a pulse function,u(t). (a) From the information shown in Fig. 3.3, calculate the pulse width, t w . (b) Express u(t) as the sum of simpler functions (some perhaps translated in...
-
Consider the following projects: Project Co C C A +$ 2,400 +$ 1,600 +1,840 +1,808 B -$ 2,500 -2,500 a. Calculate the profitability index for A and B assuming a 24% opportunity cost of capital. Note:...
-
To whom will an auditor report uncovered deficiencies in a clients system of internal controls?
-
List three guidelines that should be included in a board of directors mandate.
-
What is the particular risk when an auditor believes that their client is under pressure to report strong results?
-
What are the responsibilities of the client and the auditor when it comes to fraud?
-
What is qualitative materiality?
-
link-2 about shaft O2, and a horizontal external force P is acting on link-5 to hold the linkage in the static equilibrium. Assume that gravity is acting into the plane and effects of friction in the...
-
Explain five different cases of income exempt from tax with clear examples.
-
For the following C statement, what is the corresponding MIPS assembly code? Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume...
-
Show how the value 0xabcdef12 would be arranged in memory of a little-endian and a big-endian machine. Assume the data is stored starting at address 0.
-
Prove that the NOR gate is universal by showing how to build the AND, OR, and NOT functions using a two-input NOR gate.
-
The following table shows the interest rates on the fixed and floating borrowing choices available to three firms. Firms A and B want to be exposed to a floating interest rate while Firm C would...
-
Futures contracts are standardized contracts for the delivery of a specified quantity of a commodity or financial instrument on a prearranged future date, at an agreed- upon price. They are a bet on...
-
Derivatives transfer risk from one person or firm to another. They can be used in any combination to unbundle risks and resell them.
Study smarter with the SolutionInn App