Answered step by step
Verified Expert Solution
Link Copied!

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,

image text in transcribed

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

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

What is conservative approach ?

Answered: 1 week ago

Question

What are the basic financial decisions ?

Answered: 1 week ago