Page 1 of 1

1. (25 points) Write the RISC-V assembly code for the following C code. Take a screenshot of your completed assembly cod

Posted: Sat May 14, 2022 8:09 pm
by answerhappygod
1 25 Points Write The Risc V Assembly Code For The Following C Code Take A Screenshot Of Your Completed Assembly Cod 1
1 25 Points Write The Risc V Assembly Code For The Following C Code Take A Screenshot Of Your Completed Assembly Cod 1 (146.96 KiB) Viewed 62 times
1 25 Points Write The Risc V Assembly Code For The Following C Code Take A Screenshot Of Your Completed Assembly Cod 2
1 25 Points Write The Risc V Assembly Code For The Following C Code Take A Screenshot Of Your Completed Assembly Cod 2 (62.06 KiB) Viewed 62 times
1 25 Points Write The Risc V Assembly Code For The Following C Code Take A Screenshot Of Your Completed Assembly Cod 3
1 25 Points Write The Risc V Assembly Code For The Following C Code Take A Screenshot Of Your Completed Assembly Cod 3 (51.4 KiB) Viewed 62 times
1. (25 points) Write the RISC-V assembly code for the following C code. Take a screenshot of your completed assembly code. Skeleton is provided (hw2_1_skeleton.s). Assume that the register x10 holds the base address of array A. The length of array A is stored in the register x11. Registers x5, x6, and x7 hold the values of i, j, and temp, respectively. 2

= = = O O OCTA co N A 1 for (i = 0; i < LENGTH; i++) { 0 2 for (j = i + 1; j < LENGTH; j++) { 3 if (A > A[j]) { 4 temp = A; 5 A A [j]; 6 A [j] = temp; 7 } 8 } 9} =

.data A: .word 27,20,2,24,7,19,2, 10, 10,22 .text la x10, A addi x11, x0, 10 addi x5, 0 addi x6, xe, 0 addi x7, x0 0 х0, # put the base address of array A in x10 # put the length of array A in x11 # the temperary variable i # the temperary variable j # the temperary variable temp # insert your code here exit: nop