Question: 1. [12 points] This problem uses the RISC-V program fragment below. addi x12, x0, 5 add x11, x0, x0 add x19, x0, x0 addi x20,

 1. [12 points] This problem uses the RISC-V program fragment below.

1. [12 points] This problem uses the RISC-V program fragment below. addi x12, x0, 5 add x11, x0, x0 add x19, x0, x0 addi x20, x0, 150 x110 // x19= LI : bge x11, x12, Exit s11 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 //x16 = address of array[0] L2 : addi x15, x15, 1 sd x15, 0(x14) addi x11, x11, 1 jal x L1 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 -type S-type SB-type U-type UJ ype CPI 4 (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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!