4. The MIPS instruction \'j target\' will start the execution from the address \
ID: 2266019 • Letter: 4
Question
4. The MIPS instruction 'j target' will start the execution from the address 'target The Ss' behaves just like jr target, except that the target address of the jump is i how 'jr Sra' works). Suppose we have two sets of MIPS codes shown below. w rgs codes shown below, which recall belong to the MIPS codes on the left are being executed. What is the contents of Sa0 wh instruction at the label cont' is about to be executed. Write your answer in hetadeinw instruction at the label 'cont' is a WW: b FO li Sa0,-2 li Sal, 20 at 20 b Fl b F2 la Ssl, WW li $s0,2 O:2 sll Ss0, $0,2 80: FO: add Sa0, Sa0, Sal b cont add Ssl, Ss1, Ss0 jr Ssl Fl: sub Sa0, Sa0, Sal b cont F2: mul Sa0, Sa0, Sal b cont cont:Explanation / Answer
Answer:- For the code on left, the first instruction set value -2 in a0. So initially a0 valuein hexadecimal is 0xFFFFFFE.
Before jump instruction " jr $s1 ", s1 contains address of (WW + 8) i.e the address where the instruction " b F2 " has been written. So " jr $s1" will jump to " b F2" which will jump to label F2 finally. There " mul $a0, $a0, $a1 " will execute. Hence a0 and a1 is being multiplied and result will be stored in a0.
So a0 = -2 x 20 = -40, in hexadecimal it is 0xFFFFFFD8 as a 32-bit value.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.