Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

1. [12 points] This problem uses the RISC-V program fragment below. addi x12, x0, 5 add x11, x0, x0 add x19, x0, xO addi x20, x0, 150 //x19 =0 LI: bge x11, x12, Exit slli x13, x11, 3 add x14, x16, x13 ld x15, 0(x14) blt x15, x20, L2 sdx0, 0(x14) add x19, x15, x19 beq x0, x0, L3 //x16 = address of array [O] L2: addi x15, x15, 1 sd x15, 0(x14) L3: addi x11, x11, 1 jal x0, 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 x 19 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 I-type S-type CPI SB-type U-type UJ-type 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions