1. [12 points] This problem uses the RISC-V program fragment below. L1: addi x12, x0, 5...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. [12 points] This problem uses the RISC-V program fragment below. L1: addi x12, x0, 5 add x11, x0, // x11 = 0 // x19 = 0 add x19, x0, addi x20, x0, 150 bge x11, x12, Exit slli x13, x11, 3 add x14, x16, x13 ld x15, 0(x14) blt x15, x20, L2 sd x0, 0(x14) add x19, x15, x19 beq x0, x0, L3 // i8 //x16 address of array[0] L2: addi x15, x15, 1 sd x15, 0(x14) L3: addi x11, x11, 1 jal x0, L1 // i++ Exit: (a) Write code (C or Java) that performs the same function as this code. (b) Assume that array [] = {100, 150, 200, 250, 300}. What is the value of x19 at the end? (c) Assume that array[] = {100, 150, 200, 250, 300}. What is the average CPI of the code frag- ment, assuming the cycle latencies shown in the table below? format R-type CPI 1 I-type 2 S-type SB-type U-type UJ-type 4 3 1 2 (d) Rewrite the assembly code above to use pointers instead of array indexes. Your code should modify x16 to do this, and you should have no need for x14. 1. [12 points] This problem uses the RISC-V program fragment below. L1: addi x12, x0, 5 add x11, x0, // x11 = 0 // x19 = 0 add x19, x0, addi x20, x0, 150 bge x11, x12, Exit slli x13, x11, 3 add x14, x16, x13 ld x15, 0(x14) blt x15, x20, L2 sd x0, 0(x14) add x19, x15, x19 beq x0, x0, L3 // i8 //x16 address of array[0] L2: addi x15, x15, 1 sd x15, 0(x14) L3: addi x11, x11, 1 jal x0, L1 // i++ Exit: (a) Write code (C or Java) that performs the same function as this code. (b) Assume that array [] = {100, 150, 200, 250, 300}. What is the value of x19 at the end? (c) Assume that array[] = {100, 150, 200, 250, 300}. What is the average CPI of the code frag- ment, assuming the cycle latencies shown in the table below? format R-type CPI 1 I-type 2 S-type SB-type U-type UJ-type 4 3 1 2 (d) Rewrite the assembly code above to use pointers instead of array indexes. Your code should modify x16 to do this, and you should have no need for x14.
Expert Answer:
Answer rating: 100% (QA)
a Code in C that performs the same function as the RISCV program fragment c include stdio h int main ... View the full answer
Related Book For
College Algebra With Modeling And Visualization
ISBN: 9780134418049
6th Edition
Authors: Gary Rockswold
Posted Date:
Students also viewed these programming questions
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
Perform the same computation as Sec. 24.1, but compute the amount of heat requited to raise the temperature of 1200 g of the material from -150 to 100C. Use Simpsons rule for your computation, with...
-
"I'm not looking forward to breaking the news," groaned Charlie Wettle, the controller of Meyer Paint Company. He and Don Smith, state liaison for the firm, were returning from a meeting with...
-
Find three positive integers x, y, and z that satisfy the given conditions. The sum is 30, and the sum of the squares is a minimum.
-
What minimum information must be extracted from a video clip of a moving object in order to quantify the object's motion?
-
Jennings operated a courier service to collect and deliver money. The contract with his customers allowed him a day or so to deliver the money that had been collected. Instead of holding collections...
-
Swifty Company is performing a post-audit of a project completed one year ago. The initial estimates were that the project would cost $245,000, would have a useful life of 9 years, zero salvage...
-
1. + -/1 points BBBasicStat7 1.2.001 Explain the difference between a stratified sample and a cluster sample. (Select all that apply.) In a cluster sample, every sample of size n has an equal chance...
-
List the changes that can be taken to ensure the success completion of data collection and transformation into BiiP system from Property Government Department after failure cause of short staff and...
-
How could you ensure that your organization's learning strategy will meet compliance and other regulatory requirements?
-
What cultural significance do indigenous folk art traditions hold within their respective communities, and how have they evolved over time amidst modernization and globalization?
-
A hotel in Orlando, Florida, experiences peak periods and slower times. How should prices be adjusted during peak periods? During slow times? Why? Clark Manufacturing offers two product lines, IN2...
-
what ways can governmental policies and cultural initiatives support the recognition, documentation, and safeguarding of folk art traditions, particularly those facing threats from urbanization,...
-
Draw a triangle ABC and two of its medians AM and BN. Let G be the point where AM intersects BN. Extend AM to the point P that makes GM- MP. Extend BN to the point Q that makes GN NQ (a) Explain why...
-
Let (X. A. p) be a measure space. Show that for any A,B A, we have the equality: (AUB)+(An B) = (A) + (B).
-
The electrical power generated by a windmill varies jointly with the square of the diameter of the area swept out by the blades and the cube of the wind velocity. If a windmill with an 8-foot...
-
Use synthetic division to divide the first polynomial by the second. x + x + 2x + 2 x+1
-
Solve each equation. Approximate answers to four decimal places when appropriate. 2log x= 3.4
-
True or False: Engineers seldom have an opportunity to influence the recovery period for expenditures.
-
True or False: Straight-line depreciation is the most popular depreciation method used in financial reporting.
-
A lumber company purchases and installs a wood chipper for \(\$ 200,000\). The chipper is classified as MACRS 7-year property. Its useful life is 10 years. The estimated salvage value at the end of...
Study smarter with the SolutionInn App