Hanas J.
asked 05/30/23Order of Stack using RISC-V
Suppose we have the following stack, where the red line is the indicator for sp:
Suppose we now want the stack to contain these additional data items in the following order:
We are given the following instructions:
(a) addi sp, sp, -8
(b) addi sp, sp, 4
(c) add sp, sp, 8
(d) sw t2, 0(sp)
(e) sw t2, 4(sp)
(f) sw t0, 0(sp)
(g) sw t0, 4(sp)
(h) lw t0, 4(sp)
(i) lw t2, 0(sp)
Which of the following sequence of RISC-V instructions will generate the stack status we want? Assuming that all the contents in the registers are words (4 bytes) and that the growth of the stack is downwards in memory(as was discussed in lectures).
None of the options
(b) -> (a) -> (e) -> (f)
(b) -> (a) -> (g) -> (d)
(b) -> (b) -> (h) -> (i)
(c) -> (d) -> (g) -> (h)
1 Expert Answer
Jeff S. answered 06/10/23
Software dev. w/ B.S. in Computer Science and 20+ yrs exp.
This question appears to be lacking key information.
In particular, there seem to be images that cannot be displayed.
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Hanas J.
anyone have the answer?05/31/23