Please explain this question in detail? thank you so much (2%) Consider the foll
ID: 3577177 • Letter: P
Question
Please explain this question in detail? thank you so much
(2%) Consider the following MIPs assembly language code segment. Determine the values in registers $t2, $t3, $s4, $a2, and $vo after the instructions have executed. In addition, indicate if the contents of memory have changed. If they have denote them directly on the memory map. Initially, $t2 contains ox1000000E, $t3 contains 0x10000010, ss4 contains ox10000004, sa2 contains ox10000004, and svo contains 0x10000008. lui $s4, 0x1000 Contents ori $s4, $s4, 0x10 Address lhu St, 2, 6 ($s4) 0x10000000 0x0005FFFC lb $v0, 4 ($s4) 0x0009 AFCE 0x10000004 sw $13, ($a2) AC980423 0x10000008. 0x8482043E 0x1000000C After Execution 0x40021301 0x10000010 0x10000014 0x2016 9090 0x10000018 0x80FA005C $t2 0x125EAD7 B 0x1000001C 0000010 0x1000001E 0x1000001C $s4 sa 2: 000 000 svo: D, 000000 X. Have the contents of memory changed? yes Identify all delay slots in the previous problem by writing the instruction(s) that is/are the delay slot (s). Label each one as either a load or branch slot.
Explanation / Answer
lui instruction will store upper 16 bits into $s4.
So $s4 contains 0x10000000
-----------------------------------------------------
ori instrucion will do bitwise OR logical operation.
So $s4 = 10000000
(OR) 00000010
--------------------
10000010
So s4 contains 0x10000010
------------------------------------------------------------------
lhu $t,P($s) ==> $t = Memory [$s + P]
so lhu $t2, 6($s4)
==> $t2 = [10000010 + 00000110]
==> $t2 = 0x010001000
--------------------------------------------------
lb instrucion is load byte instrucion where it includes sign bit.
lb $v0, -4($s4)
==> $v0 = Memory($s4 - 4)
==> 0x10000010 - 0x00000100
==> $v0 = 0x01111110
----------------------------------------------------------
$a2 given straight forward in question itself as 0x10000004
$t3 will store word in address a2, so address will be [$a2 + offet] ==> 10000004 + 2 = 0x10000006
offset is 2 beacuse in the given stack table ,, address 10000004 is present in second index.
Contents of memory changed is YES
************************************************************************************
Delay slots will be
Load ==> lui , lhm,lb
breanch ==> sw, ori