- Q4 Translate The Following C Code To Risc V Assume That The Variables F G H 1 And Are Assigned To Registers X5 X6 1 (47.65 KiB) Viewed 48 times
Q4. Translate the following C code to RISC-v Assume that the variables f, g, h, 1, and are assigned to registers x5, x6,
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Q4. Translate the following C code to RISC-v Assume that the variables f, g, h, 1, and are assigned to registers x5, x6,
Q4. Translate the following C code to RISC-v Assume that the variables f, g, h, 1, and are assigned to registers x5, x6, x7, x28, and x29, respectively. Assume that the base address of the arrays A and в are in registers x10 and x11, respectively. Assume that the elements of the arrays A and B are 8-byte words: B[8] A + A[j]; - Answer: Slli X30, X28, 3 www Add X30, X10, X30 Ld X30, 0(X30) www Slli X31, X29, 3 wwww Add X31, X10, X31 Ld X31, 0(X31) Add X6, X30, X31 Sd X6, 64(X11) // X30 = i * 8 // X30 = &A // X30 = A // X31 =j * 8 // X31 = &A[j] //31 = A[j] // X6 = A + A[j] // B[8] =X6