Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started