Translate the following LEGv8 assembly into C, assuming that:
X19 = f, X20 = g, X21 = h, X22 = &a
SUB X9, X20, X21
CBZ X9, ELSE
LSL X9, X20, #3
ADD X9, X22, X9
LDUR X19, [X9, #0]
B END
ELSE: LDUR X19, [X22, #0]
END: SUB X21, X19, X20
Translate the following LEGv8 assembly into C, assuming that: X19 = f, X20 = g, X21...
Use the following assembly code to answer the questions below, assuming that: X19 = f, X20 = g, X21 = i, X22 = &a LDUR X19, [X22, #0] LDUR X20, [X22, #8] ADDI X21, XZR, #0 LOOP: SUB X9, X19, X20 CBZ ENDLOOP ADDI X19, X19, #1 ADDI X21, X21, #1 B LOOP ENDLOOP: STUR X21, [X22, #16] a.What value would the assembler insert for ENDLOOP in the CBZ instruction? b. What value would the assembler insert for LOOP in...
Convert the following C statement to the corresponding ARMv7 assembly code: Assume that the variables f, g, h, i, and j are assigned to registers X0,X1,X2,X3, and X4, respectively. Assume that the base address of the arrays A and B are in registers X6 and X7, respectively. B[8] = A[i−j]; Convert the following LEGv8 assembly instructions to ARMv7 as well as find the corresponding C statement. Assume that the variables f, g, h, i, and j are assigned to registers...
4. Convert the below C code snippet to LEGV8 assembly code. Base address of x is stored in register X19. Assume variables a, b, andc are stored in registers X20, X21, and X22 respectively. Assume all values are 64-bits. Do not use divide and multiply instructions in your code. Comment your assembly code. (30 Points) x[e] a x[1]; q [e]x x[a/2]b; x[2]; + x[1] x[2] x[c] C >> 4: x[1] +
4. Convert the below C code snippet to LEGV8...
Could someone help me to solve this problem? Please explain
the steps
Insulated x1 x 2 x 3 x4 x5 x 6 x7 x8 x9 x10 x1 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 T 30 ← |T-50C h- 500 W/m2 C T-20 C 1. 2. Write the Finite Volume equation for node 23. [3 points] Write the 23"d line of the coefficient matrix and the right hand side [2 points] [ k-200...
Translate the following C code to LEGv8. Assume that the variables f, g, h, i, and j are assigned to registers X0, X1, X2, X3, and X4, respectively. Assume that the base address of the arrays A and B are in registers X6 and X7, respectively. Assume that the elements of the arrays A and B are 8-byte words: B[8] = A[i] + A[j];
Please do the following problems 1. translate into RISC-V Assembly variable rpt in x19 register. if(rpt>0){ rpt=rpt-1; goto loop } 2. Translate the following Risc-V code into C. variable 'i' in register x5, variable 'result' in x6 ,base address of integer 'memarray' in x10 addi x6,x0,0 addi x29,x0,100 LOOP: ld x7,0(x10) add x5,x5,x7 addi x10,x10,8 addi x6,x6,1 blt x6,x29, LOOP
convert C to LEGv8
(an example given below)
Q1 [15] Convert the following C code to LEG. Assume the following variable/register assignments: Base of A i X19 X20 int main { long long int A[6] = {1, 2, e, e, e, e}; for unsigned int i = 0; i < { A[i+2] myFunction (A[ i] , A[i+1] ); } return 0 } 4; i+ //convert to LEG //convert to LEG //convert the entire myFunction to LEG long long int myFunction...
6. [5 points] Translate the following c code to MIPS assembly code. f = g - A(B[h]] The value of A, B, g, and h are in registers $a0, $al, $a2, and Sa3, respectively. The value of f should be stored in the register $v0.
Computer Architecture
Please help me explain the answer
3 For the following statement, translate the statement to ARM assembly code. Assume that variable fand g are each in register rO, r1. Base address of array A is in r3 and base address of array B is in r4. Temporary register is r5. f= g + A[B[3]] Ans) sol) LDR r5, 14, #12] ADD rs. r3. r5, LSL #2 LDR r5, [r3. #01 ADD rO, rl, r5
3 For the following...
19. (4 points) Convert the following C function (a leaf procedure) to an LEGv8 assembly subroutine. Make sure that you follow the LEGv8 calling conventions. long long int func (long long int a, long long int b) long long int 0: long long int s 0: while (s < b) return k;