24/7 Homework Help

Essaynice Will Help You Write Your Essays and Term Papers

From initial topic to finished paper

Answered » You can buy a ready-made answer or pick a professional tutor to order an original one.

Assignment help 1768

by | Apr 10, 2023 | Posted Assignments

For the following C statement, write the corresponding RISC-V assembly code.

Assume that the variables i, and j are assigned to registers x28, and x29, respectively.

Assume that the base address of the arrays A and B are in registers x10 and x11,

respectively.

B[8] = A[i – j]

here is the solution:

Sub x5, x28, x29 // temp x5 gets i-j

Sll x5, x5, 3 // temp x5 gets (i-j)*8

Add x5, x10, x5 // temp x5 gets base_add A + (i-j)*8

Ld x9, 0(x5) // load from A[i-j] to temp x9

Sd x9, 64(x11) // store x9 to B[8] (mem[ base_add B + 8*8])

I dont understand that why we need get (i-j)*8 in the second command line.

HOME TO CERTIFIED WRITERS

Why Place An Order With Us?

  • Certified Editors
  • 24/7 Customer Support
  • Profesional Research
  • Easy to Use System Interface
  • Student Friendly Pricing

Have a similar question?

PLAGIRAISM FREE PAPERS

All papers we provide are well-researched, properly formatted and cited.

TOP QUALITY

All papers we provide are well-researched, properly formatted and cited.

HIGHLY SECURED

All papers we provide are well-researched, properly formatted and cited.

Order-Essaynice
Open chat
1
Powered by Essaynice
Hello! Welcome to to our WhatsApp support.
We offer READY solutions, HIGH QUALITY PLAGIARISM FREE essays and term-papers.

We are online and ready to help.