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...
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...
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...
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.
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;
Assignment 3 Translate the following MIPS code to C. Assume that the variables f, g, h, i and j are assigned to registers Ss0, Ss1, Ss2, Ss3 and Ss4, respectively. Assume that the base address of the arrays A and B are in registers Ss6 and $s7, respectively. addi St0, Ss6, 4 add $t1, $s6, $0 #register $0 always holds 320s sw St1, 0(Sto) add Ss0, St1, Sto
IN RISC-V
a) Consider the RISC-V code below. Indicate what is the value in register x20 after the code below is executed, and explain why; ori x18 x0 16 addi x20 x18 0 beq x20, x18, HERE add x20 x20, x20 b) Assume that the code above is part of a procedure called by main. What happens with the stack pointer during the procedure execution and why? Draw and explain. c) Add instructions to the above code to implement your...