2. [20 points] When introducing RISC-V instructions, we have seen several required formats that do not...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
2. [20 points] When introducing RISC-V instructions, we have seen several required formats that do not seem to follow a straightforward or convenient design. For example: (a) All arithmetic operations must have 3 operands, which makes the addition of n numbers requiring n-1 instructions. (b) The S-type RISC-V instruction format has the 12-bit immediate field split into two fields, which makes the format hard to read and understand For each of the two cases above, can you please explain, using you own words, why it is designed that way in RISC-V? 3. [40 points] Assuming variable i is in register x6, the base address of array A in memory is in register x23, and variable s is in register x18. (a) Please convert the following C code to RISC-V assembly code. Please write clear comments (using "/") to make your code easier to understand. for (i =0; i <= 1999; i = i + 1) A[i] = A[i] + s; (b) Now the C code is updated to the following, which would produce the same results as in (1): for (i = 0; i <- 1998; i - i + 2){ A[1] =A[1] +s; A[i+1] = A[i+1] + s; } Please convert this version of the loop to RISC-V assembly code (with clear comments using ") and discuss about the pros s and cons compared to the version in (a). When discussing about the pros and cons, please consider both the performance and the size of the program and conduct the analysis/comparison in a quantitative manner. 2. [20 points] When introducing RISC-V instructions, we have seen several required formats that do not seem to follow a straightforward or convenient design. For example: (a) All arithmetic operations must have 3 operands, which makes the addition of n numbers requiring n-1 instructions. (b) The S-type RISC-V instruction format has the 12-bit immediate field split into two fields, which makes the format hard to read and understand For each of the two cases above, can you please explain, using you own words, why it is designed that way in RISC-V? 3. [40 points] Assuming variable i is in register x6, the base address of array A in memory is in register x23, and variable s is in register x18. (a) Please convert the following C code to RISC-V assembly code. Please write clear comments (using "/") to make your code easier to understand. for (i =0; i <= 1999; i = i + 1) A[i] = A[i] + s; (b) Now the C code is updated to the following, which would produce the same results as in (1): for (i = 0; i <- 1998; i - i + 2){ A[1] =A[1] +s; A[i+1] = A[i+1] + s; } Please convert this version of the loop to RISC-V assembly code (with clear comments using ") and discuss about the pros s and cons compared to the version in (a). When discussing about the pros and cons, please consider both the performance and the size of the program and conduct the analysis/comparison in a quantitative manner.
Expert Answer:
Answer rating: 100% (QA)
The image youve provided contains a multipart question related to RISCV assembly language programming Ill provide you with explanations and the requir... View the full answer
Related Book For
Ethical Obligations and Decision Making in Accounting Text and Cases
ISBN: 978-1259969461
5th edition
Authors: Steven M. Mintz, Roselyn E. Morris
Posted Date:
Students also viewed these programming questions
-
A Moore sequential circuit has one input and one output. The output goes to 1 when the input sequence 111 has occurred, and the output goes to 0 if the input sequence 000 occurs. At all other times,...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
4. Jerry intends to use the money from his loan (and his personal savings if necessary) to make an investment in his friend Elaines business. In return, Elaine has predicted the following returns on...
-
On December 30, 2014, Maud sold land to her son, Charles, for $50,000 cash and a 7% installment note for $350,000, payable over 10 years. Maud's cost of the land was $150,000. In October 2016, after...
-
New West Company recently hired a new accountant whose first task was to prepare the financial statements for the year ended December 31, 2021. The following is what he produced: The owner of the...
-
Derive the finite difference equations governing the forced longitudinal vibration of a fixedfree uniform bar, using a total of \(n\) mesh points. Find the natural frequencies of the bar, using...
-
Copy the Mike Owjai Manufacturing financial statements from Problem 1 in Chapter 2 into a new workbook. a. Set up a ratio worksheet similar to the one in Exhibit 4-6, page 131, and calculate all of...
-
Skydiving terminal velocity. When determining the terminalvelocity of items in free fall, the friction factor f is typicallycalled the drag coefficient and is represented by the symbol CD.They are...
-
The company has made the following profit-sharing contributions to the retirement plan for Archie and Elaine for each of the related years. 2021 2020 2019 2018 2017 2016 Balance 1/1/16 Archie None...
-
In what ways do organizational subcultures interact with and differ from the dominant organizational culture?
-
The circuit in the figure below contains a 9.00 V battery and four capacitors. The two capacitors on the left and right both have same capacitance of C = 7.20 F. The capacitors in the top two...
-
In the figure, the particles have charges 91 = -92-867 nC and 93 = -94 = 90.7 nC, and distance a = 5.27 cm. What are the (a) x and (b) y components of the net electrostatic force on particle 3? 3
-
The volume and surface area of a cylinder are given, respectively, by the formulas V = Trh and SA= 2rh + 2r. a) Determine an expression, in simplified form, that represents the surface area-to-volume...
-
7. In a 5.00km race, one runner runs at a steady 12.0km/h and another runs at 14.5km/h. how long does the faster runner have to wait at the finish line to see the slower runner cross? 8. A car starts...
-
G13 2 3 Data X fx A B 12 Compute the ROI 13 Margin 14 Turnover 15 ROI 16 17 Compute the residual income 18 Average operating assets 19 Net operating income 20 Minimum required return 21 Residual...
-
The axle of an automobile is acted upon by the forces and couple shown in Figure 3. Knowing that the diameter of the solid axle is 32 mm, determine (a) the principal planes and principal stresses at...
-
Rowland Textile Inc. manufactures two products: sweatshirts and T-shirts. The manufacturing process involves two activities: cutting and sewing. Expected overhead costs and cost drivers are as...
-
1. Apply the steps in Exhibit 4.3, Ethical Conflicts and Compliance with the Rules of Conduct, and analyze whether the relationships described in this case create a conflict of interests and, if so,...
-
Solutions Network is attempting to manage earnings. Which features of earnings management is being employed by Solutions? a. Alter numbers not yet in the financial records by using discretionary...
-
Is it a positive result that 39.1 percent of occupational fraud is initially detected by a "tip"? Explain why or why not.
-
Weights of bricks at a construction site. Determine whether the data are qualitative or quantitative. Explain your reasoning.
-
Marital statuses mentioned in an employment form. Determine whether the data are qualitative or quantitative. Explain your reasoning.
-
The ranks that China secured at the Summer Olympics in different years are listed. Determine the level of measurement of the data set. Explain your reasoning. 42 11 4 4 3 1 2 3
Study smarter with the SolutionInn App