Question: 6) [20 points) C code: While (save[i] == k) { // long instruction sequence... i += 1; } This while loop example from the textbook

 6) [20 points) C code: While (save[i] == k) { //

6) [20 points) C code: While (save[i] == k) { // long instruction sequence... i += 1; } This while loop example from the textbook has been modified by inserting a large sequence of instructions inside the while loop as shown in the table. As a result, the beginning instruction of the loop is far away (address: 70000, instead of 80000) from the "beq" at the end of the loop. You are asked to make a correction to the beq instruction. You need to explain the reason why beq can no longer work. You are requested to replace the beq instruction with another instruction to accomplish the long jump. You also need to make the correct machine code! You must explain how you assemble every bit in the machine code of the new instruction. RISC-V code Address Machine code Decimal Hex imme rs2 rs! func3 rd opcode Loop: 70000 11170 sili x10, X22, 3 80000 13880 0 0 3 22 1 10 19 add x10, x10, X25 80004 13884 0 25 10 0 10 51 id x9, 0(x10) 80008 13888 0 0 10 3 9 3 bne X9, X24, Exit 80012 1388C 0 24 9 1 12 99 addi x22, 22, 1 80016 13890 0 1 22 0 22 19 beq x0, x0, Loop 80020 13894 Exit: ... 80024 13898

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!