Menu

(Solved) : 6 Write Legv8 Assembly Instructions Following C Program Sets Contents Two Dimensional Arra Q31608141 . . .

6. Write the LEGv8 assembly instructions for the following C program, that sets the contents of a two-dimensional array. Assume the array dimensions n and m are in registers X20 and X21, respectively. Also assume the base address of array A is in register X22, and each array element is eight bytes. The comments are given for each line of assembly code. [20 pts] . // initialize i to zero // initialize a reg to zero -> will hold i * m // check i > n // if so, we are done // initialize j to zero // check j n // if so, we are done with the inner loop //add j to i * м // multiply it with 8 // add the result to base address // compute i j // store i + j in address A8 * (i * mj) // increment j // repeat the inner loop // increment i . // adjust the reg that holds the i * m // repeat the outer loop until we are done

6. Write the LEGv8 assembly instructions for the following C program, that sets the contents of a two-dimensional array. Assume the array dimensions n and m are in registers X20 and X21, respectively. Also assume the base address of array A is in register X22, and each array element is eight bytes. The comments are given for each line of assembly code. [20 pts] . // initialize i to zero // initialize a reg to zero -> will hold i * m // check i > n // if so, we are done // initialize j to zero // check j n // if so, we are done with the inner loop //add j to i * м // multiply it with 8 // add the result to base address // compute i j // store i + j in address A8 * (i * mj) // increment j // repeat the inner loop // increment i . // adjust the reg that holds the i * m // repeat the outer loop until we are done Show transcribed image text

Expert Answer


Answer to 6 Write Legv8 Assembly Instructions Following C Program Sets Contents Two Dimensional Arra Q31608141 . . .

OR