Question: Problem 1: (12 pts, 3 pts each subpart) Compile the RISC-V assembly code for the following C code LOOP: beq x6, x0, DONE addi x6,

 Problem 1: (12 pts, 3 pts each subpart) Compile the RISC-V

Problem 1: (12 pts, 3 pts each subpart) Compile the RISC-V assembly code for the following C code LOOP: beq x6, x0, DONE addi x6, x6,-1 addi x5, x5, 2 jal x0, LOOP DONE: Partl: Assume that the register x6 is initialized to the value 10. What is the final value in register x5 ssuming the x5 is initially zero? Part 2: For the loop above, write the equivalent C code. Assume that the registers x5 and x6 are integers acc and i, respectively Part 3: For the loop written in RISC-V assembly above, assume that the register x6 is initialized to the value N. How many RISC-V instructions are executed? Part 4: For the loop written in RISC-V assembly above, replace the instruction "beq x6, x0, DONE" with the instruction "blt x6, x0, DONE" and write the equivalent C code Solution Problem 2: (8 pts) Find the shortest sequence of RISC-V instructions that extracts bits 16 down to 11 from register x5 and uses the value of this field to replace bits 31 down to 26 in register x6 without changing the other bits of registers x5 or x6. (Be sure to test your code using x50 and x60xffffffffffffffff. Doing so may reveal a common oversight.) Solution

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!