Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following RISC - V procedure is intended to reverse a string. We have deliberately omitted the code that saves and restores registers from the
The following RISCV procedure is intended to reverse a string. We have deliberately omitted the code that saves and restores registers from the stack. Inspect the code and select which registers, if any, must be saved in the stack.
section text
global strrev
strrevi
s str
a sz
# ttheta sz
#Enter stack frame
#What registers should we push to the stack?
#Get the size of the string
mv $ ao #this is the same as add si ae zero
jal strlen
srai to ab # Divide sz by
tl #
matrix L&g& for oop matrix
bget te L add tst str subt atheta t forall sz a dd tt sz add tts forall str sz bt thetatstrb t thetat forall strsz
sbt thetat ne swap
sbt thetat
addi t t
JL
L:
#Leave stack frame
#what registers should we pop from the stack?
jr rab
which ones from below is correct:
ra
t
No register needs saving
t
t
t
t
t
a
s
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started