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.](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f0c0290a16b_86466f0c028829b7.jpg)
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
Get step-by-step solutions from verified subject matter experts
